From 00dd08cb0fc7a83808bf5883166e182d58187472 Mon Sep 17 00:00:00 2001 From: NicJA Date: Wed, 13 Jun 2018 20:46:59 +0000 Subject: [PATCH] check for -Wshift-negative-value git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@55336 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- config/compiler.cfg.in | 2 ++ config/features | 32 ++++++++++++++++++++++++++++++++ config/features.in | 14 +++++++++++++- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/config/compiler.cfg.in b/config/compiler.cfg.in index 1af504e96f..3d79e4d119 100644 --- a/config/compiler.cfg.in +++ b/config/compiler.cfg.in @@ -118,6 +118,7 @@ WARN_TAUTOLOGICAL_COMPARE := @aros_warnflags_tautological_compare@ WARN_EMPTY_BODY := @aros_warnflags_empty_body@ WARN_STRINGOP_OVERFLOW := @aros_warnflags_stringop_overflow@ WARN_FORMAT_TRUNCATION := @aros_warnflags_format_truncation@ +WARN_SHIFT_NEGATIVE_VALUE := @aros_warnflags_shift_negative_value@ # # "Disable" compiler warning flags @@ -188,3 +189,4 @@ NOWARN_TAUTOLOGICAL_COMPARE := @aros_nowarnflags_tautological_compar NOWARN_EMPTY_BODY := @aros_nowarnflags_empty_body@ NOWARN_STRINGOP_OVERFLOW := @aros_nowarnflags_stringop_overflow@ NOWARN_FORMAT_TRUNCATION := @aros_nowarnflags_format_truncation@ +NOWARN_SHIFT_NEGATIVE_VALUE := @aros_nowarnflags_shift_negative_value@ diff --git a/config/features b/config/features index 462be02670..19171a41ba 100755 --- a/config/features +++ b/config/features @@ -584,6 +584,8 @@ PACKAGE_URL= ac_unique_file="../mmakefile" ac_subst_vars='LTLIBOBJS LIBOBJS +aros_nowarnflags_shift_negative_value +aros_warnflags_shift_negative_value aros_nowarnflags_format_truncation aros_warnflags_format_truncation aros_nowarnflags_stringop_overflow @@ -3238,6 +3240,7 @@ fi # -Wempty-body # -Wstringop-overflow # -Wformat-truncation +# -Wshift-negative-value { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} accepts -Werror" >&5 $as_echo_n "checking whether ${CC} accepts -Werror... " >&6; } @@ -4943,6 +4946,33 @@ if test "x-$aros_format_truncation" = "x-yes" ; then aros_nowarnflags_format_truncation=-Wno-format-truncation fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} accepts -Wshift-negative-value" >&5 +$as_echo_n "checking whether ${CC} accepts -Wshift-negative-value... " >&6; } +CFLAGS=-Wshift-negative-value +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + aros_shift_negative_value="yes" +else + aros_shift_negative_value="no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $aros_shift_negative_value" >&5 +$as_echo "$aros_shift_negative_value" >&6; } +if test "x-$aros_shift_negative_value" = "x-yes" ; then + aros_warnflags_shift_negative_value=-Wshift-negative-value + aros_nowarnflags_shift_negative_value=-Wno-shift-negative-value +fi + # # export the feature flags... # @@ -5106,6 +5136,8 @@ fi + + ac_config_files="$ac_config_files ${aros_targetcfg_dir}/compiler.cfg:compiler.cfg.in" diff --git a/config/features.in b/config/features.in index 09417f402d..1e3331236e 100644 --- a/config/features.in +++ b/config/features.in @@ -256,6 +256,7 @@ fi # -Wempty-body # -Wstringop-overflow # -Wformat-truncation +# -Wshift-negative-value AC_MSG_CHECKING([whether ${CC} accepts -Werror]) CFLAGS=-Werror @@ -827,6 +828,15 @@ if test "x-$aros_format_truncation" = "x-yes" ; then aros_nowarnflags_format_truncation=-Wno-format-truncation fi +AC_MSG_CHECKING([whether ${CC} accepts -Wshift-negative-value]) +CFLAGS=-Wshift-negative-value +AC_TRY_COMPILE(,, aros_shift_negative_value="yes", aros_shift_negative_value="no") +AC_MSG_RESULT($aros_shift_negative_value) +if test "x-$aros_shift_negative_value" = "x-yes" ; then + aros_warnflags_shift_negative_value=-Wshift-negative-value + aros_nowarnflags_shift_negative_value=-Wno-shift-negative-value +fi + # # export the feature flags... # @@ -989,7 +999,9 @@ AC_SUBST(aros_warnflags_stringop_overflow) AC_SUBST(aros_nowarnflags_stringop_overflow) AC_SUBST(aros_warnflags_format_truncation) AC_SUBST(aros_nowarnflags_format_truncation) - +AC_SUBST(aros_warnflags_shift_negative_value) +AC_SUBST(aros_nowarnflags_shift_negative_value) + AC_CONFIG_FILES( ${aros_targetcfg_dir}/compiler.cfg:compiler.cfg.in ) -- 2.11.4.GIT