diff options
author | Greg Hudson <ghudson@mit.edu> | 2008-12-03 18:21:22 +0000 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2008-12-03 18:21:22 +0000 |
commit | 7a64640413a306635ad94403b72d798e4aa527ee (patch) | |
tree | d7de9ad9825efdde5efe329a774c4df65d75e4b3 /src/aclocal.m4 | |
parent | 2a43fdbc47af63acccb80cbeab3bfb84394002b7 (diff) | |
download | krb5-7a64640413a306635ad94403b72d798e4aa527ee.zip krb5-7a64640413a306635ad94403b72d798e4aa527ee.tar.gz krb5-7a64640413a306635ad94403b72d798e4aa527ee.tar.bz2 |
Move warning flags to new variables WARN_CFLAGS and WARN_CXXFLAGS, so
that users can override the debugging and optimization flags
independently of the warning flags.
Remove -Wconversion from the standard set of warning flags since it
warns excessively on perfectly good code, and is designed to aid in
conversion of code from K&R to ANSI C rather than to maintain code
quality.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21273 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/aclocal.m4')
-rw-r--r-- | src/aclocal.m4 | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/aclocal.m4 b/src/aclocal.m4 index cd4ac9c..051f01f 100644 --- a/src/aclocal.m4 +++ b/src/aclocal.m4 @@ -562,9 +562,11 @@ AC_BEFORE([$0],[AC_PROG_CC]) AC_BEFORE([$0],[AC_PROG_CXX]) krb5_ac_cflags_set=${CFLAGS+set} krb5_ac_cxxflags_set=${CXXFLAGS+set} +krb5_ac_warn_cflags_set=${WARN_CFLAGS+set} +krb5_ac_warn_cxxflags_set=${WARN_CXXFLAGS+set} ]) dnl -AC_DEFUN(TRY_CC_FLAG,[dnl +AC_DEFUN(TRY_WARN_CC_FLAG,[dnl cachevar=`echo "krb5_cv_cc_flag_$1" | sed s/[[^a-zA-Z0-9_]]/_/g` AC_CACHE_CHECK([if C compiler supports $1], [$cachevar], [# first try without, then with @@ -575,7 +577,7 @@ AC_DEFUN(TRY_CC_FLAG,[dnl CFLAGS="$old_cflags"], [AC_MSG_ERROR(compiling simple test program with $CFLAGS failed)])]) if eval test '"${'$cachevar'}"' = yes; then - CFLAGS="$CFLAGS $1" + WARN_CFLAGS="$WARN_CFLAGS $1" fi eval flag_supported='${'$cachevar'}' ])dnl @@ -606,7 +608,7 @@ if test "$withval" = yes; then AC_DEFINE(CONFIG_SMALL,1,[Define to reduce code size even if it means more cpu usage]) fi # -Wno-long-long, if needed, for k5-platform.h without inttypes.h etc. -extra_gcc_warn_opts="-Wall -Wcast-qual -Wcast-align -Wconversion -Wshadow" +extra_gcc_warn_opts="-Wall -Wcast-qual -Wcast-align -Wshadow" # -Wmissing-prototypes if test "$GCC" = yes ; then # Putting this here means we get -Os after -O2, which works. @@ -618,32 +620,32 @@ if test "$GCC" = yes ; then *) CFLAGS="$CFLAGS -Os" ;; esac fi - if test "x$krb5_ac_cflags_set" = xset ; then - AC_MSG_NOTICE(not adding extra gcc warning flags because CFLAGS was set) + if test "x$krb5_ac_warn_cflags_set" = xset ; then + AC_MSG_NOTICE(not adding extra gcc warning flags because WARN_CFLAGS was set) else AC_MSG_NOTICE(adding extra warning flags for gcc) - CFLAGS="$CFLAGS $extra_gcc_warn_opts -Wmissing-prototypes" + WARN_CFLAGS="$WARN_CFLAGS $extra_gcc_warn_opts -Wmissing-prototypes" if test "`uname -s`" = Darwin ; then AC_MSG_NOTICE(skipping pedantic warnings on Darwin) elif test "`uname -s`" = Linux ; then AC_MSG_NOTICE(skipping pedantic warnings on Linux) else - CFLAGS="$CFLAGS -pedantic" + WARN_CFLAGS="$WARN_CFLAGS -pedantic" fi if test "$ac_cv_cxx_compiler_gnu" = yes; then - if test "x$krb5_ac_cxxflags_set" = xset ; then - AC_MSG_NOTICE(not adding extra g++ warnings because CXXFLAGS was set) + if test "x$krb5_ac_warn_cxxflags_set" = xset ; then + AC_MSG_NOTICE(not adding extra g++ warnings because WARN_CXXFLAGS was set) else AC_MSG_NOTICE(adding extra warning flags for g++) - CXXFLAGS="$CXXFLAGS $extra_gcc_warn_opts" + WARN_CXXFLAGS="$WARN_CXXFLAGS $extra_gcc_warn_opts" fi fi # Currently, G++ does not support -Wno-format-zero-length. - TRY_CC_FLAG(-Wno-format-zero-length) + TRY_WARN_CC_FLAG(-Wno-format-zero-length) # Other flags here may not be supported on some versions of # gcc that people want to use. for flag in overflow strict-overflow missing-format-attribute missing-prototypes return-type missing-braces parentheses switch unused-function unused-label unused-variable unused-value unknown-pragmas sign-compare newline-eof ; do - TRY_CC_FLAG(-W$flag) + TRY_WARN_CC_FLAG(-W$flag) done # old-style-definition? generates many, many warnings # @@ -659,9 +661,9 @@ if test "$GCC" = yes ; then # We're currently targeting C89+, not C99, so disallow some # constructs. for flag in declaration-after-statement variadic-macros ; do - TRY_CC_FLAG(-Werror=$flag) + TRY_WARN_CC_FLAG(-Werror=$flag) if test "$flag_supported" = no; then - TRY_CC_FLAG(-W$flag) + TRY_WARN_CC_FLAG(-W$flag) fi done # missing-prototypes? maybe someday @@ -713,6 +715,8 @@ else esac fi fi +AC_SUBST(WARN_CFLAGS) +AC_SUBST(WARN_CXXFLAGS) ])dnl dnl dnl |