Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7ddbf10

Browse files
committed
disable unused result warnings when possible
1 parent a1fe1f8 commit 7ddbf10

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

configure

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5561,6 +5561,49 @@ $as_echo "$ac_cv_no_strict_aliasing" >&6; }
55615561
BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
55625562
fi
55635563

5564+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can turn off $CC unused result warning" >&5
5565+
$as_echo_n "checking if we can turn off $CC unused result warning... " >&6; }
5566+
ac_save_cc="$CC"
5567+
CC="$CC -Wunused-result -Werror"
5568+
save_CFLAGS="$CFLAGS"
5569+
if ${ac_cv_disable_unused_result_warning+:} false; then :
5570+
$as_echo_n "(cached) " >&6
5571+
else
5572+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5573+
/* end confdefs.h. */
5574+
5575+
5576+
int
5577+
main ()
5578+
{
5579+
5580+
;
5581+
return 0;
5582+
}
5583+
5584+
_ACEOF
5585+
if ac_fn_c_try_compile "$LINENO"; then :
5586+
5587+
ac_cv_disable_unused_result_warning=yes
5588+
5589+
else
5590+
5591+
ac_cv_disable_unused_result_warning=no
5592+
5593+
fi
5594+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5595+
fi
5596+
5597+
CFLAGS="$save_CFLAGS"
5598+
CC="$ac_save_cc"
5599+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_disable_unused_result_warning" >&5
5600+
$as_echo "$ac_cv_disable_unused_result_warning" >&6; }
5601+
5602+
if test $ac_cv_disable_unused_result_warning = yes
5603+
then
5604+
BASECFLAGS="$BASECFLAGS -Wno-unused-result"
5605+
fi
5606+
55645607
# if using gcc on alpha, use -mieee to get (near) full IEEE 754
55655608
# support. Without this, treatment of subnormals doesn't follow
55665609
# the standard.

configure.in

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,28 @@ yes)
981981
BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
982982
fi
983983

984+
AC_MSG_CHECKING(if we can turn off $CC unused result warning)
985+
ac_save_cc="$CC"
986+
CC="$CC -Wunused-result -Werror"
987+
save_CFLAGS="$CFLAGS"
988+
AC_CACHE_VAL(ac_cv_disable_unused_result_warning,
989+
AC_COMPILE_IFELSE(
990+
[
991+
AC_LANG_PROGRAM([[]], [[]])
992+
],[
993+
ac_cv_disable_unused_result_warning=yes
994+
],[
995+
ac_cv_disable_unused_result_warning=no
996+
]))
997+
CFLAGS="$save_CFLAGS"
998+
CC="$ac_save_cc"
999+
AC_MSG_RESULT($ac_cv_disable_unused_result_warning)
1000+
1001+
if test $ac_cv_disable_unused_result_warning = yes
1002+
then
1003+
BASECFLAGS="$BASECFLAGS -Wno-unused-result"
1004+
fi
1005+
9841006
# if using gcc on alpha, use -mieee to get (near) full IEEE 754
9851007
# support. Without this, treatment of subnormals doesn't follow
9861008
# the standard.

0 commit comments

Comments
 (0)