1 # ============================================================================== 2 # https://www.gnu.org/software/autoconf-archive/ax_gcc_warn_unused_result.html 3 # ============================================================================== 4 # 5 # SYNOPSIS 6 # 7 # AX_GCC_WARN_UNUSED_RESULT 8 # 9 # DESCRIPTION 10 # 11 # The macro will compile a test program to see whether the compiler does 12 # understand the per-function postfix pragma. 13 # 14 # LICENSE 15 # 16 # Copyright (c) 2008 Guido U. Draheim <guidod (a] gmx.de> 17 # 18 # Copying and distribution of this file, with or without modification, are 19 # permitted in any medium without royalty provided the copyright notice 20 # and this notice are preserved. This file is offered as-is, without any 21 # warranty. 22 23 #serial 10 24 25 AC_DEFUN([AX_GCC_WARN_UNUSED_RESULT],[dnl 26 AC_CACHE_CHECK( 27 [whether the compiler supports function __attribute__((__warn_unused_result__))], 28 ax_cv_gcc_warn_unused_result,[ 29 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[__attribute__((__warn_unused_result__)) 30 int f(int i) { return i; }]], 31 [])], 32 [ax_cv_gcc_warn_unused_result=yes], [ax_cv_gcc_warn_unused_result=no])]) 33 if test "$ax_cv_gcc_warn_unused_result" = yes; then 34 AC_DEFINE([GCC_WARN_UNUSED_RESULT],[__attribute__((__warn_unused_result__))], 35 [most gcc compilers know a function __attribute__((__warn_unused_result__))]) 36 fi 37 ]) 38