Commit 5baecbc0 authored by Paul Eggert's avatar Paul Eggert

Enable GCC warnings in developer builds

However, do not fail; just issue the warnings.  Add an option
--enable-gcc-warnings=warn-only to configure, to implement this.
* INSTALL, etc/NEWS: Document this.
* (gl_GCC_VERSION_IFELSE): New macro, from coreutils.
(gl_gcc_warnings, WERROR_CFLAGS): Use it to add new option.
Don’t treat --with-x-toolkit=no as a special case when configuring
parent 93d54ba1
......@@ -318,9 +318,11 @@ Use --enable-gcc-warnings to enable compile-time checks that warn
about possibly-questionable C code. This is intended for developers
and is useful with GNU-compatible compilers. On a recent GNU system
there should be no warnings; on older and on non-GNU systems the
generated warnings may still be useful, though you may prefer building
with 'make WERROR_CFLAGS=' so that the warnings are not treated as
generated warnings may still be useful, though you may prefer
configuring with --enable-gcc-warnings=warn-only so they are not
treated as errors. The default is --enable-gcc-warnings=warn-only if
it appears to be a developer build, and is --disable-gcc-warnings
Use --disable-silent-rules to cause 'make' to give more details about
the commands it executes. This can be helpful when debugging a build
......@@ -842,17 +842,44 @@ if test "$ac_test_CFLAGS" != set; then
# gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
# ---------------------------------------------------------------------------
# If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
# Otherwise, run RUN-IF-NOT-FOUND.
#if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__)
/* ok */
# error "your version of gcc is older than $1.$2"
], [$3], [$4])
[turn on lots of GCC warnings/errors. This is intended for
developers, and may generate false alarms when used
with older or non-GNU development tools.])],
[control generation of GCC warnings. The TYPE 'yes'
means to fail if any warnings are issued; 'warn-only'
means issue warnings without failing (default for
developer builds); 'no' means disable warnings
(default for non-developer builds).])],
[case $enableval in
yes|no) ;;
yes|no|warn-only) ;;
*) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
[# By default, use 'warn-only' if it looks like the invoker of 'configure'
# is a developer as opposed to a builder. This is most likely true
# if GCC is recent enough and there is a .git subdirectory;
# however, if there is also a .tarball-version file it is probably
# just a reliease imported into Git for patch management.
test -d "$srcdir"/.git && test ! -f "$srcdir"/.tarball-version &&
gl_GCC_VERSION_IFELSE([5], [3], [gl_gcc_warnings=warn-only])]
# clang is unduly picky about some things.
......@@ -868,7 +895,7 @@ AC_CACHE_CHECK([whether the compiler is clang], [emacs_cv_clang],
# When compiling with GCC, prefer -isystem to -I when including system
# include files, to avoid generating useless diagnostics for the files.
AS_IF([test "$gl_gcc_warnings" != yes],
AS_IF([test $gl_gcc_warnings = no],
AS_IF([test "$emacs_cv_clang" = yes],
......@@ -892,7 +919,7 @@ AS_IF([test "$gl_gcc_warnings" != yes],
nw="$nw -Wwrite-strings"
AS_IF([test -z "$nw"],
AS_IF([test $gl_gcc_warnings = yes],
[gl_WARN_ADD([-Werror], [WERROR_CFLAGS])])
......@@ -2011,17 +2038,6 @@ fi
## $window_system is now set to the window system we will
## ultimately use.
if test "$window_system" = none && test "$gl_gcc_warnings" = yes; then
# Too many warnings for now.
nw="$nw -Wsuggest-attribute=noreturn"
......@@ -25,6 +25,12 @@ otherwise leave it unmarked.
* Installation Changes in Emacs 25.2
** The new option 'configure --enable-gcc-warnings=warn-only' causes
GCC to issue warnings without stopping the bild. This behavior is now
the default in developer builds. As before, use
'--disable-gcc-warnings' to suppress GCC's warnings, and
'--enable-gcc-warnings' to stop the build if GCC issues warnings.
** New configure option '--disable-build-details' attempts to build an
Emacs that is more likely to be reproducible; that is, if you build
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment