Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(23)

Unified Diff: configure.ac

Issue 23545: Turn on extra warnings on GCC
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « configure ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/configure.ac Wed Mar 18 21:53:15 2015 +0200
+++ b/configure.ac Wed Mar 18 22:36:00 2015 +0200
@@ -1163,6 +1163,50 @@ AC_SUBST(UNIVERSAL_ARCH_FLAGS)
# tweak BASECFLAGS based on compiler and platform
case $GCC in
yes)
+ AC_MSG_CHECKING(for -Wall)
+ ac_save_cc="$CC"
+ CC="$CC -Wall -Werror"
Martin Panter 2016/07/24 16:05:29 Do you know why you add -Werror to each of these t
storchaka 2016/07/24 16:49:36 Seems I copied this from the check for -Wunused-re
Martin Panter 2016/07/24 17:09:46 I’m not sure. Google for similar autoconf scripts
+ save_CFLAGS="$CFLAGS"
Martin Panter 2016/07/24 16:05:29 I suspect you don’t need to save $CFLAGS if you ar
storchaka 2016/07/24 16:49:36 I copied it from other checks below. I don't know
Martin Panter 2016/07/24 17:09:46 I say get rid of your save_CFLAGS="$CFLAGS" and CF
+ AC_CACHE_VAL(ac_cv_all_warnings,
+ AC_COMPILE_IFELSE(
+ [
+ AC_LANG_PROGRAM([[]], [[]])
+ ],[
+ ac_cv_all_warnings=yes
+ ],[
+ ac_cv_all_warnings=no
+ ]))
+ CFLAGS="$save_CFLAGS"
+ CC="$ac_save_cc"
+ AC_MSG_RESULT($ac_cv_all_warnings)
+
+ if test $ac_cv_all_warnings = yes
+ then
+ CFLAGS_NODIST="$CFLAGS_NODIST -Wall"
+ fi
+
+ AC_MSG_CHECKING(for -Wextra)
+ ac_save_cc="$CC"
+ CC="$CC -Wextra -Werror"
+ save_CFLAGS="$CFLAGS"
+ AC_CACHE_VAL(ac_cv_extra_warnings,
+ AC_COMPILE_IFELSE(
+ [
+ AC_LANG_PROGRAM([[]], [[]])
+ ],[
+ ac_cv_extra_warnings=yes
+ ],[
+ ac_cv_extra_warnings=no
+ ]))
+ CFLAGS="$save_CFLAGS"
+ CC="$ac_save_cc"
+ AC_MSG_RESULT($ac_cv_extra_warnings)
+
+ if test $ac_cv_extra_warnings = yes
+ then
+ CFLAGS_NODIST="$CFLAGS_NODIST -Wextra"
+ fi
+
# Python doesn't violate C99 aliasing rules, but older versions of
# GCC produce warnings for legal Python code. Enable
# -fno-strict-aliasing on versions of GCC that support but produce
@@ -1218,6 +1262,51 @@ yes)
if test $ac_cv_disable_unused_result_warning = yes
then
BASECFLAGS="$BASECFLAGS -Wno-unused-result"
+ CFLAGS_NODIST="$CFLAGS_NODIST -Wno-unused-result"
+ fi
+
+ AC_MSG_CHECKING(if we can turn off $CC unused parameter warning)
+ ac_save_cc="$CC"
+ CC="$CC -Wunused-parameter -Werror"
+ save_CFLAGS="$CFLAGS"
+ AC_CACHE_VAL(ac_cv_disable_unused_parameter_warning,
+ AC_COMPILE_IFELSE(
+ [
+ AC_LANG_PROGRAM([[]], [[]])
+ ],[
+ ac_cv_disable_unused_parameter_warning=yes
+ ],[
+ ac_cv_disable_unused_parameter_warning=no
+ ]))
+ CFLAGS="$save_CFLAGS"
+ CC="$ac_save_cc"
+ AC_MSG_RESULT($ac_cv_disable_unused_parameter_warning)
+
+ if test $ac_cv_disable_unused_parameter_warning = yes
+ then
+ CFLAGS_NODIST="$CFLAGS_NODIST -Wno-unused-parameter"
+ fi
+
+ AC_MSG_CHECKING(if we can turn off $CC missing field initializers warning)
+ ac_save_cc="$CC"
+ CC="$CC -Wmissing-field-initializers -Werror"
+ save_CFLAGS="$CFLAGS"
+ AC_CACHE_VAL(ac_cv_disable_missing_field_initializers,
+ AC_COMPILE_IFELSE(
+ [
+ AC_LANG_PROGRAM([[]], [[]])
+ ],[
+ ac_cv_disable_missing_field_initializers=yes
+ ],[
+ ac_cv_disable_missing_field_initializers=no
+ ]))
+ CFLAGS="$save_CFLAGS"
+ CC="$ac_save_cc"
+ AC_MSG_RESULT($ac_cv_disable_missing_field_initializers)
+
+ if test $ac_cv_disable_missing_field_initializers = yes
+ then
+ CFLAGS_NODIST="$CFLAGS_NODIST -Wno-missing-field-initializers"
fi
AC_MSG_CHECKING(for -Werror=declaration-after-statement)
« no previous file with comments | « configure ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+