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