From 27b7d38e40938681b02c27ea75c127394a278e6e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 29 Apr 2016 00:16:49 +0300 Subject: Add some usefull gcc 6 warnings. --- configure | 189 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- configure.in | 4 ++ 2 files changed, 192 insertions(+), 1 deletion(-) diff --git a/configure b/configure index c2df511b9..4bf9d9a90 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in d8c88a7. +# From configure.in af1c906. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # @@ -4603,6 +4603,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # -Wunused-parameter -Wunused-but-set-parameter unused parameters # -Wunused-macros unused macro warnings, but it also enable unused parameters # -Wstrict-prototypes show warning in grammar.y +# -wdiscarded-qualifiers show different const removal # attributes suggestion # -Wsuggest-attribute=const -Wsuggest-attribute=format -Wsuggest-attribute=pure @@ -7233,6 +7234,104 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wmisleading-indentation" >&5 +$as_echo_n "checking whether $CC supports -Wmisleading-indentation... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wmisleading-indentation" + 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 -Wmisleading-indentation" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wmisleading-indentation" >&5 +$as_echo_n "checking whether $CC can actually use -Wmisleading-indentation... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wmisleading-indentation" + 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 -Wmisleading-indentation" + +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 + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wnull-dereference" >&5 +$as_echo_n "checking whether $CC supports -Wnull-dereference... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wnull-dereference" + 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 -Wnull-dereference" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wnull-dereference" >&5 +$as_echo_n "checking whether $CC can actually use -Wnull-dereference... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wnull-dereference" + 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 -Wnull-dereference" + +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 + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-format-nonliteral" >&5 $as_echo_n "checking whether $CC supports -Wno-format-nonliteral... " >&6; } OLD_CFLAGS="$CFLAGS" @@ -7471,6 +7570,94 @@ 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 + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-suggest-attribute=format" >&5 +$as_echo_n "checking whether $CC supports -Wno-suggest-attribute=format... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wno-suggest-attribute=format" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + # 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 -Wsuggest-attribute=format" + 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-suggest-attribute=format" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wno-suggest-attribute=format" >&5 +$as_echo_n "checking whether $CC can actually use -Wno-suggest-attribute=format... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wsuggest-attribute=format" + 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-suggest-attribute=format" + 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-suggest-attribute=format" + +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 + + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi diff --git a/configure.in b/configure.in index b308eab2d..f25c2592f 100644 --- a/configure.in +++ b/configure.in @@ -492,6 +492,7 @@ AC_LANG([C]) # -Wunused-parameter -Wunused-but-set-parameter unused parameters # -Wunused-macros unused macro warnings, but it also enable unused parameters # -Wstrict-prototypes show warning in grammar.y +# -wdiscarded-qualifiers show different const removal # attributes suggestion # -Wsuggest-attribute=const -Wsuggest-attribute=format -Wsuggest-attribute=pure @@ -860,9 +861,12 @@ AC_CHECK_COMPILER_WFLAG(old-style-definition) AC_CHECK_COMPILER_WFLAG(overlength-strings) AC_CHECK_COMPILER_WFLAG(redundant-decls) AC_CHECK_COMPILER_WFLAG(cast-qual) +AC_CHECK_COMPILER_WFLAG(misleading-indentation) +AC_CHECK_COMPILER_WFLAG(null-dereference) AC_CHECK_COMPILER_WNOFLAG(format-nonliteral) AC_CHECK_COMPILER_WNOFLAG(switch) AC_CHECK_COMPILER_WNOFLAG(missing-field-initializers) +AC_CHECK_COMPILER_WNOFLAG(suggest-attribute=format) # Certain versions of gcc make -Wshadow completely useless by making it flood # you with unnecessary warnings -- cgit v1.2.3-60-g2f50