X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=m4%2Fpandora_warnings.m4;h=d31965e0fd717cdc76f93305c382b34adab45a43;hb=303f0aafd224cdb5d27c717661c34eaf1eaf4cae;hp=2044cc9109309170699dfa5d53b4f4377171f9ba;hpb=8fa220229fdb895f6f07311124e9c71943fdbad4;p=m6w6%2Flibmemcached diff --git a/m4/pandora_warnings.m4 b/m4/pandora_warnings.m4 index 2044cc91..d31965e0 100644 --- a/m4/pandora_warnings.m4 +++ b/m4/pandora_warnings.m4 @@ -1,5 +1,5 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -27,13 +27,18 @@ AC_DEFUN([PANDORA_WARNINGS],[ ]) ]) - AC_REQUIRE([PANDORA_BUILDING_FROM_VC]) m4_if(PW_WARN_ALWAYS_ON, [yes], [ac_cv_warnings_as_errors=yes], - AS_IF([test "$ac_cv_building_from_vc" = "yes"], + AS_IF([test "$pandora_building_from_vc" = "yes"], [ac_cv_warnings_as_errors=yes], [ac_cv_warnings_as_errors=no])) + AC_ARG_ENABLE([gcc-profile-mode], + [AS_HELP_STRING([--enable-gcc-profile-mode], + [Toggle gcc profile mode @<:@default=off@:>@])], + [ac_gcc_profile_mode="$enableval"], + [ac_gcc_profile_mode="no"]) + AC_ARG_ENABLE([profiling], [AS_HELP_STRING([--enable-profiling], [Toggle profiling @<:@default=off@:>@])], @@ -69,8 +74,11 @@ AC_DEFUN([PANDORA_WARNINGS],[ - AS_IF([test "$ac_cv_warnings_as_errors" = "yes"], - [W_FAIL="-Werror"]) + AS_IF([test "$ac_cv_warnings_as_errors" = "yes"],[ + W_FAIL="-Werror" + SPHINX_WARNINGS="-W -n" + INTLTOOL_WARNINGS="yes" + ]) AC_CACHE_CHECK([whether it is safe to use -fdiagnostics-show-option], [ac_cv_safe_to_use_fdiagnostics_show_option_], @@ -87,67 +95,47 @@ AC_DEFUN([PANDORA_WARNINGS],[ F_DIAGNOSTICS_SHOW_OPTION="-fdiagnostics-show-option" ]) - AC_CACHE_CHECK([whether it is safe to use -Wconversion], - [ac_cv_safe_to_use_wconversion_], + AC_CACHE_CHECK([whether it is safe to use -floop-parallelize-all], + [ac_cv_safe_to_use_floop_parallelize_all_], [save_CFLAGS="$CFLAGS" - dnl Use -Werror here instead of ${W_FAIL} so that we don't spew - dnl conversion warnings to all the tarball folks - CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}" + CFLAGS="-Werror -floop-parallelize-all ${AM_CFLAGS} ${CFLAGS}" AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ -#include -void foo(bool a) -{ - (void)a; -} - ]],[[ -foo(0); - ]])], - [ac_cv_safe_to_use_wconversion_=yes], - [ac_cv_safe_to_use_wconversion_=no]) + [AC_LANG_PROGRAM([],[])], + [ac_cv_safe_to_use_floop_parallelize_all_=yes], + [ac_cv_safe_to_use_floop_parallelize_all_=no]) CFLAGS="$save_CFLAGS"]) - AS_IF([test "$ac_cv_safe_to_use_wconversion_" = "yes"], - [W_CONVERSION="-Wconversion" - AC_CACHE_CHECK([whether it is safe to use -Wconversion with htons], - [ac_cv_safe_to_use_Wconversion_], - [save_CFLAGS="$CFLAGS" - dnl Use -Werror here instead of ${W_FAIL} so that we don't spew - dnl conversion warnings to all the tarball folks - CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}" - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include - ]],[[ -uint16_t x= htons(80); - ]])], - [ac_cv_safe_to_use_Wconversion_=yes], - [ac_cv_safe_to_use_Wconversion_=no]) - CFLAGS="$save_CFLAGS"]) - - AS_IF([test "$ac_cv_safe_to_use_Wconversion_" = "no"], - [NO_CONVERSION="-Wno-conversion"]) - ]) + AS_IF([test "$ac_cv_safe_to_use_floop_parallelize_all_" = "yes"], + [ + F_LOOP_PARALLELIZE_ALL="-floop-parallelize-all" + ]) NO_STRICT_ALIASING="-fno-strict-aliasing -Wno-strict-aliasing" NO_SHADOW="-Wno-shadow" AS_IF([test "$INTELCC" = "yes"],[ m4_if(PW_LESS_WARNINGS,[no],[ - BASE_WARNINGS="-w1 -Werror -Wcheck -Wformat -Wp64 -Woverloaded-virtual -Wcast-qual" + BASE_WARNINGS="-w1 -Werror -Wcheck -Wp64 -Woverloaded-virtual -Wcast-qual -diag-disable 188" ],[ - BASE_WARNINGS="-w1 -Wcheck -Wformat -Wp64 -Woverloaded-virtual -Wcast-qual -diag-disable 981" + dnl 2203 is like old-style-cast + dnl 1684 is like strict-aliasing + dnl 188 is about using enums as bitfields + dnl 1683 is a warning about _EXPLICIT_ casting, which we want + BASE_WARNINGS="-w1 -Werror -Wcheck -Wp64 -Woverloaded-virtual -Wcast-qual -diag-disable 188,981,2259,2203,1683,1684" ]) CC_WARNINGS="${BASE_WARNINGS}" CXX_WARNINGS="${BASE_WARNINGS}" + PROTOSKIP_WARNINGS="-diag-disable 188,981,967,2259,1683,1684,2203" + ],[ m4_if(PW_LESS_WARNINGS,[no],[ - BASE_WARNINGS_FULL="-Wformat=2 ${W_CONVERSION} -Wstrict-aliasing" + BASE_WARNINGS_FULL="${W_CONVERSION} -Wstrict-aliasing -Wswitch-enum " CC_WARNINGS_FULL="-Wswitch-default -Wswitch-enum -Wwrite-strings" - CXX_WARNINGS_FULL="-Wold-style-cast" + CXX_WARNINGS_FULL="" + NO_OLD_STYLE_CAST="-Wno-old-style-cast" + NO_EFF_CXX="-Wno-effc++" ],[ - BASE_WARNINGS_FULL="-Wformat ${NO_STRICT_ALIASING}" + BASE_WARNINGS_FULL="${NO_STRICT_ALIASING}" ]) AS_IF([test "${ac_cv_assert}" = "no"], @@ -167,13 +155,89 @@ uint16_t x= htons(80); [ac_cv_safe_to_use_Wextra_=no]) CFLAGS="$save_CFLAGS"]) - BASE_WARNINGS="${W_FAIL} -pedantic -Wall -Wundef -Wshadow ${NO_UNUSED} ${F_DIAGNOSTICS_SHOW_OPTION} ${CFLAG_VISIBILITY} ${BASE_WARNINGS_FULL}" + BASE_WARNINGS="${W_FAIL} -pedantic -Wall -Wundef -Wshadow -Wparentheses ${NO_UNUSED} ${F_DIAGNOSTICS_SHOW_OPTION} ${F_LOOP_PARALLELIZE_ALL} ${BASE_WARNINGS_FULL}" AS_IF([test "$ac_cv_safe_to_use_Wextra_" = "yes"], [BASE_WARNINGS="${BASE_WARNINGS} -Wextra"], [BASE_WARNINGS="${BASE_WARNINGS} -W"]) - CC_WARNINGS="${BASE_WARNINGS} -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align ${CC_WARNINGS_FULL}" - CXX_WARNINGS="${BASE_WARNINGS} -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wno-long-long ${CXX_WARNINGS_FULL}" + AC_CACHE_CHECK([whether it is safe to use -Wformat], + [ac_cv_safe_to_use_wformat_], + [save_CFLAGS="$CFLAGS" + dnl Use -Werror here instead of ${W_FAIL} so that we don't spew + dnl conversion warnings to all the tarball folks + CFLAGS="-Wformat -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#include +#include +void foo(); +void foo() +{ + uint64_t test_u= 0; + printf("This is a %" PRIu64 "test\n", test_u); +} + ]],[[ +foo(); + ]])], + [ac_cv_safe_to_use_wformat_=yes], + [ac_cv_safe_to_use_wformat_=no]) + CFLAGS="$save_CFLAGS"]) + AS_IF([test "$ac_cv_safe_to_use_wformat_" = "yes"],[ + BASE_WARNINGS="${BASE_WARNINGS} -Wformat -Wno-format-nonliteral -Wformat-security" + BASE_WARNINGS_FULL="${BASE_WARNINGS_FULL} -Wformat=2 -Wno-format-nonliteral -Wformat-security" + ],[ + BASE_WARNINGS="${BASE_WARNINGS} -Wno-format" + BASE_WARNINGS_FULL="${BASE_WARNINGS_FULL} -Wno-format" + ]) + + + + AC_CACHE_CHECK([whether it is safe to use -Wconversion], + [ac_cv_safe_to_use_wconversion_], + [save_CFLAGS="$CFLAGS" + dnl Use -Werror here instead of ${W_FAIL} so that we don't spew + dnl conversion warnings to all the tarball folks + CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +#include +void foo(bool a) +{ + (void)a; +} + ]],[[ +foo(0); + ]])], + [ac_cv_safe_to_use_wconversion_=yes], + [ac_cv_safe_to_use_wconversion_=no]) + CFLAGS="$save_CFLAGS"]) + + AS_IF([test "$ac_cv_safe_to_use_wconversion_" = "yes"], + [W_CONVERSION="-Wconversion" + AC_CACHE_CHECK([whether it is safe to use -Wconversion with htons], + [ac_cv_safe_to_use_Wconversion_], + [save_CFLAGS="$CFLAGS" + dnl Use -Werror here instead of ${W_FAIL} so that we don't spew + dnl conversion warnings to all the tarball folks + CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include + ]],[[ +uint16_t x= htons(80); + ]])], + [ac_cv_safe_to_use_Wconversion_=yes], + [ac_cv_safe_to_use_Wconversion_=no]) + CFLAGS="$save_CFLAGS"]) + + AS_IF([test "$ac_cv_safe_to_use_Wconversion_" = "no"], + [NO_CONVERSION="-Wno-conversion"]) + ]) + + CC_WARNINGS="${BASE_WARNINGS} -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align -Wsign-compare ${CC_WARNINGS_FULL}" + CXX_WARNINGS="${BASE_WARNINGS} -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wno-long-long -Wsign-compare ${CXX_WARNINGS_FULL}" AC_CACHE_CHECK([whether it is safe to use -Wmissing-declarations from C++], [ac_cv_safe_to_use_Wmissing_declarations_], @@ -194,6 +258,25 @@ uint16_t x= htons(80); AS_IF([test "$ac_cv_safe_to_use_Wmissing_declarations_" = "yes"], [CXX_WARNINGS="${CXX_WARNINGS} -Wmissing-declarations"]) + AC_CACHE_CHECK([whether it is safe to use -Wframe-larger-than], + [ac_cv_safe_to_use_Wframe_larger_than_], + [AC_LANG_PUSH(C++) + save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="-Werror -pedantic -Wframe-larger-than=32768 ${AM_CXXFLAGS}" + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM( + [[ +#include + ]], [[]]) + ], + [ac_cv_safe_to_use_Wframe_larger_than_=yes], + [ac_cv_safe_to_use_Wframe_larger_than_=no]) + CXXFLAGS="$save_CXXFLAGS" + AC_LANG_POP() + ]) + AS_IF([test "$ac_cv_safe_to_use_Wframe_larger_than_" = "yes"], + [CXX_WARNINGS="${CXX_WARNINGS} -Wframe-larger-than=32768"]) + AC_CACHE_CHECK([whether it is safe to use -Wlogical-op], [ac_cv_safe_to_use_Wlogical_op_], [save_CFLAGS="$CFLAGS" @@ -290,8 +373,11 @@ inline const EnumDescriptor* GetEnumDescriptor() { dnl TODO: Figure out a better way to deal with this: PROTOSKIP_WARNINGS="-Wno-effc++ -Wno-shadow -Wno-missing-braces ${NO_ATTRIBUTES}" NO_WERROR="-Wno-error" - INNOBASE_SKIP_WARNINGS="-Wno-shadow -Wno-cast-align" - + PERMISSIVE_WARNINGS="-Wno-error -Wno-unused-function -fpermissive" + PERMISSIVE_C_WARNINGS="-Wno-error -Wno-redundant-decls" + AS_IF([test "$host_vendor" = "apple"],[ + BOOSTSKIP_WARNINGS="-Wno-uninitialized" + ]) ]) ]) @@ -322,16 +408,19 @@ inline const EnumDescriptor* GetEnumDescriptor() { m4_if(PW_LESS_WARNINGS, [no],[ - CC_WARNINGS_FULL="-erroff=E_INTEGER_OVERFLOW_DETECTED${W_PASTE_RESULT}" + CC_WARNINGS_FULL="-erroff=E_STATEMENT_NOT_REACHED,E_INTEGER_OVERFLOW_DETECTED${W_PASTE_RESULT}" CXX_WARNINGS_FULL="-erroff=inllargeuse" ],[ - CC_WARNINGS_FULL="-erroff=E_ATTRIBUTE_NOT_VAR" + CC_WARNINGS_FULL="-erroff=E_ATTRIBUTE_NOT_VAR,E_STATEMENT_NOT_REACHED" CXX_WARNINGS_FULL="-erroff=attrskipunsup,doubunder,reftotemp,inllargeuse,truncwarn1,signextwarn,inllargeint" ]) - CC_WARNINGS="-v -errtags=yes ${W_FAIL} ${CC_WARNINGS_FULL} ${CFLAG_VISIBILITY}" - CXX_WARNINGS="+w +w2 -xwe -xport64 -errtags=yes ${CXX_WARNINGS_FULL} ${W_FAIL} ${CFLAG_VISIBILITY}" + CC_WARNINGS="-v -errtags=yes ${W_FAIL} ${CC_WARNINGS_FULL}" + CXX_WARNINGS="+w +w2 -xwe -xport64 -errtags=yes ${CXX_WARNINGS_FULL} ${W_FAIL}" PROTOSKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,wbadinitl,identexpected,inllargeuse,truncwarn1,signextwarn,partinit,notused,badargtype2w,wbadinit" + BOOSTSKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,inllargeuse,truncwarn1,signextwarn,inllargeint,hidef,wvarhidenmem" + PERMISSIVE_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,inllargeuse,truncwarn1,signextwarn,inllargeint,hidef,wvarhidenmem,notused,badargtype2w,wunreachable" + INNOBASE_SKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,wbadinitl,identexpected,inllargeuse,truncwarn1,signextwarn,partinit,notused,badargtype2w,wbadinit,wunreachable" NO_UNREACHED="-erroff=E_STATEMENT_NOT_REACHED" NO_WERROR="-errwarn=%none" @@ -342,9 +431,16 @@ inline const EnumDescriptor* GetEnumDescriptor() { AC_SUBST(NO_UNREACHED) AC_SUBST(NO_SHADOW) AC_SUBST(NO_STRICT_ALIASING) + AC_SUBST(NO_EFF_CXX) + AC_SUBST(NO_OLD_STYLE_CAST) AC_SUBST(PROTOSKIP_WARNINGS) AC_SUBST(INNOBASE_SKIP_WARNINGS) + AC_SUBST(BOOSTSKIP_WARNINGS) + AC_SUBST(PERMISSIVE_WARNINGS) + AC_SUBST(PERMISSIVE_C_WARNINGS) AC_SUBST(NO_WERROR) AC_SUBST([GCOV_LIBS]) + AC_SUBST([SPHINX_WARNINGS]) + AC_SUBST([INTLTOOL_WARNINGS]) ])