diff options
author | Haru <haru@dotalux.com> | 2013-12-17 03:33:20 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2013-12-17 04:15:22 +0100 |
commit | 3917562fc493c031bb20181b5d9ae6ab15ce9b76 (patch) | |
tree | 4b62aa52844a1916db1f18faba8b9cf29ff30810 | |
parent | 3cd9f8d14eaccaffaa642b5e46f50493c213e7d8 (diff) | |
download | hercules-3917562fc493c031bb20181b5d9ae6ab15ce9b76.tar.gz hercules-3917562fc493c031bb20181b5d9ae6ab15ce9b76.tar.bz2 hercules-3917562fc493c031bb20181b5d9ae6ab15ce9b76.tar.xz hercules-3917562fc493c031bb20181b5d9ae6ab15ce9b76.zip |
Fixed some additional linux warnings
- Fixed some warnings we had missed.
- Improved -W cflag detection routines.
- Only use -Wshadow if it's actually useful.
Signed-off-by: Haru <haru@dotalux.com>
-rwxr-xr-x | configure | 819 | ||||
-rw-r--r-- | configure.in | 315 | ||||
-rw-r--r-- | src/common/timer.c | 8 |
3 files changed, 808 insertions, 334 deletions
@@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in 547ee9a. +# From configure.in d0f16b7. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # @@ -3643,12 +3643,12 @@ fi # Check whether --enable-lto was given. if test "${enable_lto+set}" = set; then : enableval=$enable_lto; - enable_lto="$enableval" - case $enableval in - "no");; - "yes");; - *) as_fn_error $? "invalid argument --enable-lto=$disableval... stopping" "$LINENO" 5;; - esac + enable_lto="$enableval" + case $enableval in + "no");; + "yes");; + *) as_fn_error $? "invalid argument --enable-lto=$disableval... stopping" "$LINENO" 5;; + esac else enable_lto="yes" @@ -4924,28 +4924,6 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-unused-parameter" >&5 -$as_echo_n "checking whether $CC supports -Wno-unused-parameter... " >&6; } -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wno-unused-parameter" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int foo; -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - CFLAGS="$OLD_CFLAGS" - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - # # LTO Support test # @@ -4970,8 +4948,8 @@ else /* end confdefs.h. */ int main(int argc, char **argv){ - return 0; - } + return 0; + } _ACEOF if ac_fn_c_try_run "$LINENO"; then : @@ -4994,320 +4972,881 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-maybe-uninitialized" >&5 -$as_echo_n "checking whether $CC supports -Wno-maybe-uninitialized... " >&6; } -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wno-maybe-uninitialized" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-unused-parameter" >&5 +$as_echo_n "checking whether $CC supports -Wno-unused-parameter... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wno-unused-parameter" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wno-maybe-uninitialized" >&5 -$as_echo_n "checking whether $CC can actually use -Wno-maybe-uninitialized... " >&6; } - # Note: -Werror must be before -Wno-maybe-uninitialized, otherwise it does not do anything - CFLAGS="$OLD_CFLAGS -Werror -Wno-maybe-uninitialized" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + # Recent versions of gcc don't fail if -Wno-foo is not recognized + # (unless there are also other warnings), so we also check for -Wfoo + # which always fails if not supported + CFLAGS="$OLD_CFLAGS -Werror -Wunused-parameter" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - CFLAGS="$OLD_CFLAGS -Wno-maybe-uninitialized" + CFLAGS="$OLD_CFLAGS -Wno-unused-parameter" + # Optionally, run a test + if test "xint foo(int bar) { return 0; }" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wno-unused-parameter" >&5 +$as_echo_n "checking whether $CC can actually use -Wno-unused-parameter... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wunused-parameter" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo(int bar) { return 0; } +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not needed but enabled" >&5 +$as_echo "not needed but enabled" >&6; } + CFLAGS="$OLD_CFLAGS" else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + CFLAGS="$OLD_CFLAGS -Werror -Wno-unused-parameter" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo(int bar) { return 0; } +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-unused-parameter" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - CFLAGS="$OLD_CFLAGS" + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - CFLAGS="$OLD_CFLAGS" + CFLAGS="$OLD_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-clobbered" >&5 -$as_echo_n "checking whether $CC supports -Wno-clobbered... " >&6; } -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wno-clobbered" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-maybe-uninitialized" >&5 +$as_echo_n "checking whether $CC supports -Wno-maybe-uninitialized... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wno-maybe-uninitialized" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wno-clobbered" >&5 -$as_echo_n "checking whether $CC can actually use -Wno-clobbered... " >&6; } - # Note: -Werror must be before -Wno-clobbered, otherwise it does not do anything - CFLAGS="$OLD_CFLAGS -Werror -Wno-clobbered" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + # Recent versions of gcc don't fail if -Wno-foo is not recognized + # (unless there are also other warnings), so we also check for -Wfoo + # which always fails if not supported + CFLAGS="$OLD_CFLAGS -Werror -Wmaybe-uninitialized" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - CFLAGS="$OLD_CFLAGS -Wno-clobbered" + CFLAGS="$OLD_CFLAGS -Wno-maybe-uninitialized" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wno-maybe-uninitialized" >&5 +$as_echo_n "checking whether $CC can actually use -Wno-maybe-uninitialized... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wmaybe-uninitialized" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not needed but enabled" >&5 +$as_echo "not needed but enabled" >&6; } + CFLAGS="$OLD_CFLAGS" else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + CFLAGS="$OLD_CFLAGS -Werror -Wno-maybe-uninitialized" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-maybe-uninitialized" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - CFLAGS="$OLD_CFLAGS" + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - CFLAGS="$OLD_CFLAGS" + CFLAGS="$OLD_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wempty-body" >&5 -$as_echo_n "checking whether $CC supports -Wempty-body... " >&6; } -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wempty-body" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-clobbered" >&5 +$as_echo_n "checking whether $CC supports -Wno-clobbered... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wno-clobbered" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + + # Recent versions of gcc don't fail if -Wno-foo is not recognized + # (unless there are also other warnings), so we also check for -Wfoo + # which always fails if not supported + CFLAGS="$OLD_CFLAGS -Werror -Wclobbered" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-clobbered" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wno-clobbered" >&5 +$as_echo_n "checking whether $CC can actually use -Wno-clobbered... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wclobbered" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not needed but enabled" >&5 +$as_echo "not needed but enabled" >&6; } + CFLAGS="$OLD_CFLAGS" + else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + CFLAGS="$OLD_CFLAGS -Werror -Wno-clobbered" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-clobbered" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - CFLAGS="$OLD_CFLAGS" + CFLAGS="$OLD_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wnewline-eof" >&5 -$as_echo_n "checking whether $CC supports -Wnewline-eof... " >&6; } -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wnewline-eof" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wempty-body" >&5 +$as_echo_n "checking whether $CC supports -Wempty-body... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wempty-body" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wempty-body" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wempty-body" >&5 +$as_echo_n "checking whether $CC can actually use -Wempty-body... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wempty-body" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wempty-body" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - CFLAGS="$OLD_CFLAGS" + CFLAGS="$OLD_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wshadow" >&5 -$as_echo_n "checking whether $CC supports -Wshadow... " >&6; } -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wshadow" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wnewline-eof" >&5 +$as_echo_n "checking whether $CC supports -Wnewline-eof... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wnewline-eof" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wnewline-eof" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wnewline-eof" >&5 +$as_echo_n "checking whether $CC can actually use -Wnewline-eof... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wnewline-eof" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wnewline-eof" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - CFLAGS="$OLD_CFLAGS" + CFLAGS="$OLD_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wint-conversion" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wint-conversion" >&5 $as_echo_n "checking whether $CC supports -Wint-conversion... " >&6; } -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wenum-conversion" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wint-conversion" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wint-conversion" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wint-conversion" >&5 +$as_echo_n "checking whether $CC can actually use -Wint-conversion... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wint-conversion" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wint-conversion" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - CFLAGS="$OLD_CFLAGS" + CFLAGS="$OLD_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wenum-conversion" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wenum-conversion" >&5 $as_echo_n "checking whether $CC supports -Wenum-conversion... " >&6; } -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wenum-conversion" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wenum-conversion" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wenum-conversion" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wenum-conversion" >&5 +$as_echo_n "checking whether $CC can actually use -Wenum-conversion... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wenum-conversion" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wenum-conversion" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - CFLAGS="$OLD_CFLAGS" + CFLAGS="$OLD_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wshorten-64-to-32" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wshorten-64-to-32" >&5 $as_echo_n "checking whether $CC supports -Wshorten-64-to-32... " >&6; } -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wshorten-64-to-32" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wshorten-64-to-32" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wshorten-64-to-32" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wshorten-64-to-32" >&5 +$as_echo_n "checking whether $CC can actually use -Wshorten-64-to-32... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wshorten-64-to-32" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wshorten-64-to-32" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - CFLAGS="$OLD_CFLAGS" + CFLAGS="$OLD_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wconstant-conversion" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wconstant-conversion" >&5 $as_echo_n "checking whether $CC supports -Wconstant-conversion... " >&6; } -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wconstant-conversion" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wconstant-conversion" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wconstant-conversion" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wconstant-conversion" >&5 +$as_echo_n "checking whether $CC can actually use -Wconstant-conversion... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wconstant-conversion" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wconstant-conversion" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - CFLAGS="$OLD_CFLAGS" + CFLAGS="$OLD_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wbool-conversion" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wbool-conversion" >&5 $as_echo_n "checking whether $CC supports -Wbool-conversion... " >&6; } -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wbool-conversion" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wbool-conversion" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wbool-conversion" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wbool-conversion" >&5 +$as_echo_n "checking whether $CC can actually use -Wbool-conversion... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wbool-conversion" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wbool-conversion" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - CFLAGS="$OLD_CFLAGS" + CFLAGS="$OLD_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-switch" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-switch" >&5 $as_echo_n "checking whether $CC supports -Wno-switch... " >&6; } -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wno-switch" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wno-switch" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + + # Recent versions of gcc don't fail if -Wno-foo is not recognized + # (unless there are also other warnings), so we also check for -Wfoo + # which always fails if not supported + CFLAGS="$OLD_CFLAGS -Werror -Wswitch" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-switch" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wno-switch" >&5 +$as_echo_n "checking whether $CC can actually use -Wno-switch... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wswitch" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not needed but enabled" >&5 +$as_echo "not needed but enabled" >&6; } + CFLAGS="$OLD_CFLAGS" + +else + + CFLAGS="$OLD_CFLAGS -Werror -Wno-switch" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-switch" + else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - CFLAGS="$OLD_CFLAGS" + CFLAGS="$OLD_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-missing-field-initializers" >&5 +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-missing-field-initializers" >&5 $as_echo_n "checking whether $CC supports -Wno-missing-field-initializers... " >&6; } -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wno-missing-field-initializers" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wno-missing-field-initializers" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + + # Recent versions of gcc don't fail if -Wno-foo is not recognized + # (unless there are also other warnings), so we also check for -Wfoo + # which always fails if not supported + CFLAGS="$OLD_CFLAGS -Werror -Wmissing-field-initializers" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-missing-field-initializers" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wno-missing-field-initializers" >&5 +$as_echo_n "checking whether $CC can actually use -Wno-missing-field-initializers... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wmissing-field-initializers" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not needed but enabled" >&5 +$as_echo "not needed but enabled" >&6; } + CFLAGS="$OLD_CFLAGS" + +else + + CFLAGS="$OLD_CFLAGS -Werror -Wno-missing-field-initializers" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-missing-field-initializers" + else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - CFLAGS="$OLD_CFLAGS" + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + +# Certain versions of gcc make -Wshadow completely useless by making it flood +# you with unnecessary warnings <https://lkml.org/lkml/2006/11/28/239> +# Let's check if we can really use it +SAVED_OLD_CFLAGS="$CFLAGS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wshadow" >&5 +$as_echo_n "checking whether $CC supports -Wshadow... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wshadow" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wshadow" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wshadow" >&5 +$as_echo_n "checking whether $CC can actually use -Wshadow... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wshadow" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wshadow" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +if test "x$CFLAGS" != "x$SAVED_OLD_CFLAGS"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can efficiently use -Wshadow" >&5 +$as_echo_n "checking whether $CC can efficiently use -Wshadow... " >&6; } + NEW_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wshadow" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int foo(void) { + return 0; + } + int bar(void) { + int foo = 0; + return foo + 1; + } + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$NEW_CFLAGS" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$SAVED_OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fPIC" >&5 $as_echo_n "checking whether $CC supports -fPIC... " >&6; } OLD_CFLAGS="$CFLAGS" diff --git a/configure.in b/configure.in index e8e2eba3f..94bad9ca4 100644 --- a/configure.in +++ b/configure.in @@ -248,22 +248,22 @@ AC_ARG_ENABLE( # LTO # AC_ARG_ENABLE( - [lto], - AC_HELP_STRING( - [--enable-lto], - [ + [lto], + AC_HELP_STRING( + [--enable-lto], + [ Enables or Disables Linktime Code Optimization (LTO is enabled by default) - ] - ), - [ - enable_lto="$enableval" - case $enableval in - "no");; - "yes");; - *) AC_MSG_ERROR([[invalid argument --enable-lto=$disableval... stopping]]);; - esac - ], - [enable_lto="yes"] + ] + ), + [ + enable_lto="$enableval" + case $enableval in + "no");; + "yes");; + *) AC_MSG_ERROR([[invalid argument --enable-lto=$disableval... stopping]]);; + esac + ], + [enable_lto="yes"] ) @@ -517,19 +517,6 @@ AC_RUN_IFELSE( ) -AC_MSG_CHECKING([whether $CC supports -Wno-unused-parameter]) -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wno-unused-parameter" -AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([int foo;])], - [AC_MSG_RESULT([yes])], - [ - AC_MSG_RESULT([no]) - CFLAGS="$OLD_CFLAGS" - ] -) - - # # LTO Support test # @@ -545,8 +532,8 @@ if test "$enable_lto" != "no" ; then AC_RUN_IFELSE( [AC_LANG_SOURCE([ int main(int argc, char **argv){ - return 0; - } + return 0; + } ])], [ AC_MSG_RESULT([yes]) @@ -563,193 +550,141 @@ if test "$enable_lto" != "no" ; then fi -AC_MSG_CHECKING([whether $CC supports -Wno-maybe-uninitialized]) -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wno-maybe-uninitialized" -AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([int foo;])], +AC_DEFUN(AC_CHECK_COMPILER_WFLAG, [ - AC_MSG_RESULT([yes]) - AC_MSG_CHECKING([whether $CC can actually use -Wno-maybe-uninitialized]) - # Note: -Werror must be before -Wno-maybe-uninitialized, otherwise it does not do anything - CFLAGS="$OLD_CFLAGS -Werror -Wno-maybe-uninitialized" + AC_MSG_CHECKING([whether $CC supports -W$1]) + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -W$1" AC_COMPILE_IFELSE( [AC_LANG_SOURCE([int foo;])], [ AC_MSG_RESULT([yes]) - CFLAGS="$OLD_CFLAGS -Wno-maybe-uninitialized" + CFLAGS="$OLD_CFLAGS -W$1" + # Optionally, run a test + if test "x$2" != "x"; then + AC_MSG_CHECKING([whether $CC can actually use -W$1]) + CFLAGS="$OLD_CFLAGS -Werror -W$1" + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([$2])], + [ + AC_MSG_RESULT([no]) + CFLAGS="$OLD_CFLAGS" + ] + [ + AC_MSG_RESULT([yes]) + CFLAGS="$OLD_CFLAGS -W$1" + ], + ) + fi ], [ AC_MSG_RESULT([no]) CFLAGS="$OLD_CFLAGS" ] ) - ], - [ - AC_MSG_RESULT([no]) - CFLAGS="$OLD_CFLAGS" ] ) - -AC_MSG_CHECKING([whether $CC supports -Wno-clobbered]) -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wno-clobbered" -AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([int foo;])], +AC_DEFUN(AC_CHECK_COMPILER_WNOFLAG, [ - AC_MSG_RESULT([yes]) - AC_MSG_CHECKING([whether $CC can actually use -Wno-clobbered]) - # Note: -Werror must be before -Wno-clobbered, otherwise it does not do anything - CFLAGS="$OLD_CFLAGS -Werror -Wno-clobbered" + AC_MSG_CHECKING([whether $CC supports -Wno-$1]) + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wno-$1" AC_COMPILE_IFELSE( [AC_LANG_SOURCE([int foo;])], [ - AC_MSG_RESULT([yes]) - CFLAGS="$OLD_CFLAGS -Wno-clobbered" + # Recent versions of gcc don't fail if -Wno-foo is not recognized + # (unless there are also other warnings), so we also check for -Wfoo + # which always fails if not supported + CFLAGS="$OLD_CFLAGS -Werror -W$1" + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([int foo;])], + [ + AC_MSG_RESULT([yes]) + CFLAGS="$OLD_CFLAGS -Wno-$1" + # Optionally, run a test + if test "x$2" != "x"; then + AC_MSG_CHECKING([whether $CC can actually use -Wno-$1]) + CFLAGS="$OLD_CFLAGS -Werror -W$1" + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([$2])], + [ + AC_MSG_RESULT([not needed but enabled]) + CFLAGS="$OLD_CFLAGS" + ], + [ + CFLAGS="$OLD_CFLAGS -Werror -Wno-$1" + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([$2])], + [ + AC_MSG_RESULT([yes]) + CFLAGS="$OLD_CFLAGS -Wno-$1" + ], + [ + AC_MSG_RESULT([no]) + CFLAGS="$OLD_CFLAGS" + ] + ) + ] + ) + fi + ], + [ + AC_MSG_RESULT([no]) + CFLAGS="$OLD_CFLAGS" + ] + ) ], [ AC_MSG_RESULT([no]) CFLAGS="$OLD_CFLAGS" ] ) - ], - [ - AC_MSG_RESULT([no]) - CFLAGS="$OLD_CFLAGS" - ] -) - - -AC_MSG_CHECKING([whether $CC supports -Wempty-body]) -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wempty-body" -AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([int foo;])], - [AC_MSG_RESULT([yes])], - [ - AC_MSG_RESULT([no]) - CFLAGS="$OLD_CFLAGS" - ] -) - - -AC_MSG_CHECKING([whether $CC supports -Wnewline-eof]) -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wnewline-eof" -AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([int foo;])], - [AC_MSG_RESULT([yes])], - [ - AC_MSG_RESULT([no]) - CFLAGS="$OLD_CFLAGS" - ] -) - - -AC_MSG_CHECKING([whether $CC supports -Wshadow]) -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wshadow" -AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([int foo;])], - [AC_MSG_RESULT([yes])], - [ - AC_MSG_RESULT([no]) - CFLAGS="$OLD_CFLAGS" - ] -) - - -AC_MSG_CHECKING([whether $CC supports -Wint-conversion]) -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wenum-conversion" -AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([int foo;])], - [AC_MSG_RESULT([yes])], - [ - AC_MSG_RESULT([no]) - CFLAGS="$OLD_CFLAGS" - ] -) - - -AC_MSG_CHECKING([whether $CC supports -Wenum-conversion]) -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wenum-conversion" -AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([int foo;])], - [AC_MSG_RESULT([yes])], - [ - AC_MSG_RESULT([no]) - CFLAGS="$OLD_CFLAGS" - ] -) - - -AC_MSG_CHECKING([whether $CC supports -Wshorten-64-to-32]) -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wshorten-64-to-32" -AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([int foo;])], - [AC_MSG_RESULT([yes])], - [ - AC_MSG_RESULT([no]) - CFLAGS="$OLD_CFLAGS" - ] -) - - -AC_MSG_CHECKING([whether $CC supports -Wconstant-conversion]) -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wconstant-conversion" -AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([int foo;])], - [AC_MSG_RESULT([yes])], - [ - AC_MSG_RESULT([no]) - CFLAGS="$OLD_CFLAGS" - ] -) - - -AC_MSG_CHECKING([whether $CC supports -Wbool-conversion]) -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wbool-conversion" -AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([int foo;])], - [AC_MSG_RESULT([yes])], - [ - AC_MSG_RESULT([no]) - CFLAGS="$OLD_CFLAGS" - ] -) - - -AC_MSG_CHECKING([whether $CC supports -Wno-switch]) -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wno-switch" -AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([int foo;])], - [AC_MSG_RESULT([yes])], - [ - AC_MSG_RESULT([no]) - CFLAGS="$OLD_CFLAGS" - ] -) - - -AC_MSG_CHECKING([whether $CC supports -Wno-missing-field-initializers]) -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wno-missing-field-initializers" -AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([int foo;])], - [AC_MSG_RESULT([yes])], - [ - AC_MSG_RESULT([no]) - CFLAGS="$OLD_CFLAGS" ] ) +AC_CHECK_COMPILER_WNOFLAG(unused-parameter, [int foo(int bar) { return 0; }]) +AC_CHECK_COMPILER_WNOFLAG(maybe-uninitialized) +AC_CHECK_COMPILER_WNOFLAG(clobbered) +AC_CHECK_COMPILER_WFLAG(empty-body) +AC_CHECK_COMPILER_WFLAG(newline-eof) +AC_CHECK_COMPILER_WFLAG(int-conversion) +AC_CHECK_COMPILER_WFLAG(enum-conversion) +AC_CHECK_COMPILER_WFLAG(shorten-64-to-32) +AC_CHECK_COMPILER_WFLAG(constant-conversion) +AC_CHECK_COMPILER_WFLAG(bool-conversion) +AC_CHECK_COMPILER_WNOFLAG(switch) +AC_CHECK_COMPILER_WNOFLAG(missing-field-initializers) + +# Certain versions of gcc make -Wshadow completely useless by making it flood +# you with unnecessary warnings <https://lkml.org/lkml/2006/11/28/239> +# Let's check if we can really use it +SAVED_OLD_CFLAGS="$CFLAGS" +AC_CHECK_COMPILER_WFLAG(shadow) +if test "x$CFLAGS" != "x$SAVED_OLD_CFLAGS"; then + AC_MSG_CHECKING([whether $CC can efficiently use -Wshadow]) + NEW_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wshadow" + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([ + int foo(void) { + return 0; + } + int bar(void) { + int foo = 0; + return foo + 1; + } + ])], + [ + AC_MSG_RESULT([yes]) + CFLAGS="$NEW_CFLAGS" + ], + [ + AC_MSG_RESULT([no]) + CFLAGS="$SAVED_OLD_CFLAGS" + ] + ) +fi AC_MSG_CHECKING([whether $CC supports -fPIC]) OLD_CFLAGS="$CFLAGS" diff --git a/src/common/timer.c b/src/common/timer.c index e5cf5df2a..7f9e20dad 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -142,7 +142,7 @@ static void rdtsc_calibrate(){ * platform-abstracted tick retrieval * @return server's current tick */ -static int64 tick(void) { +static int64 sys_tick(void) { #if defined(WIN32) // Windows: GetTickCount/GetTickCount64: Return the number of // milliseconds that have elapsed since the system was started. @@ -206,7 +206,7 @@ static int gettick_count = 1; int64 timer_gettick_nocache(void) { gettick_count = TICK_CACHE; - gettick_cache = tick(); + gettick_cache = sys_tick(); return gettick_cache; } @@ -219,11 +219,11 @@ int64 timer_gettick(void) { // tick doesn't get cached int64 timer_gettick_nocache(void) { - return tick(); + return sys_tick(); } int64 timer_gettick(void) { - return tick(); + return sys_tick(); } ////////////////////////////////////////////////////////////////////////// #endif |