1 # ==============================================================================
2 # https://www.gnu.org/software/autoconf-archive/ax_gcc_warn_unused_result.html
3 # ==============================================================================
7 # AX_GCC_WARN_UNUSED_RESULT
11 # The macro will compile a test program to see whether the compiler does
12 # understand the per-function postfix pragma.
16 # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
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
25 AC_DEFUN([AX_GCC_WARN_UNUSED_RESULT],[dnl
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; }]],
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__))])