diff options
| author | Paul Eggert | 2016-04-05 07:51:28 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-04-05 08:09:43 -0700 |
| commit | 5baecbc0ebc11178edd73431b644a5de0a31be25 (patch) | |
| tree | 1b11fc90b0935fa57768d314b4fab457f0c3694a | |
| parent | 93d54ba104bf85d487eb8e90a4857789e0c9a210 (diff) | |
| download | emacs-5baecbc0ebc11178edd73431b644a5de0a31be25.tar.gz emacs-5baecbc0ebc11178edd73431b644a5de0a31be25.zip | |
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.
* configure.ac (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
warnings.
| -rw-r--r-- | INSTALL | 8 | ||||
| -rw-r--r-- | configure.ac | 54 | ||||
| -rw-r--r-- | etc/NEWS | 6 |
3 files changed, 46 insertions, 22 deletions
| @@ -318,9 +318,11 @@ Use --enable-gcc-warnings to enable compile-time checks that warn | |||
| 318 | about possibly-questionable C code. This is intended for developers | 318 | about possibly-questionable C code. This is intended for developers |
| 319 | and is useful with GNU-compatible compilers. On a recent GNU system | 319 | and is useful with GNU-compatible compilers. On a recent GNU system |
| 320 | there should be no warnings; on older and on non-GNU systems the | 320 | there should be no warnings; on older and on non-GNU systems the |
| 321 | generated warnings may still be useful, though you may prefer building | 321 | generated warnings may still be useful, though you may prefer |
| 322 | with 'make WERROR_CFLAGS=' so that the warnings are not treated as | 322 | configuring with --enable-gcc-warnings=warn-only so they are not |
| 323 | errors. | 323 | treated as errors. The default is --enable-gcc-warnings=warn-only if |
| 324 | it appears to be a developer build, and is --disable-gcc-warnings | ||
| 325 | otherwise. | ||
| 324 | 326 | ||
| 325 | Use --disable-silent-rules to cause 'make' to give more details about | 327 | Use --disable-silent-rules to cause 'make' to give more details about |
| 326 | the commands it executes. This can be helpful when debugging a build | 328 | the commands it executes. This can be helpful when debugging a build |
diff --git a/configure.ac b/configure.ac index f3846f4a256..917ca3a2f3d 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -842,17 +842,44 @@ if test "$ac_test_CFLAGS" != set; then | |||
| 842 | esac | 842 | esac |
| 843 | fi | 843 | fi |
| 844 | 844 | ||
| 845 | # gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found]) | ||
| 846 | # --------------------------------------------------------------------------- | ||
| 847 | # If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND. | ||
| 848 | # Otherwise, run RUN-IF-NOT-FOUND. | ||
| 849 | AC_DEFUN([gl_GCC_VERSION_IFELSE], | ||
| 850 | [AC_PREPROC_IFELSE( | ||
| 851 | [AC_LANG_PROGRAM( | ||
| 852 | [[ | ||
| 853 | #if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__) | ||
| 854 | /* ok */ | ||
| 855 | #else | ||
| 856 | # error "your version of gcc is older than $1.$2" | ||
| 857 | #endif | ||
| 858 | ]]), | ||
| 859 | ], [$3], [$4]) | ||
| 860 | ] | ||
| 861 | ) | ||
| 862 | |||
| 845 | AC_ARG_ENABLE([gcc-warnings], | 863 | AC_ARG_ENABLE([gcc-warnings], |
| 846 | [AS_HELP_STRING([--enable-gcc-warnings], | 864 | [AS_HELP_STRING([--enable-gcc-warnings@<:@=TYPE@:>@], |
| 847 | [turn on lots of GCC warnings/errors. This is intended for | 865 | [control generation of GCC warnings. The TYPE 'yes' |
| 848 | developers, and may generate false alarms when used | 866 | means to fail if any warnings are issued; 'warn-only' |
| 849 | with older or non-GNU development tools.])], | 867 | means issue warnings without failing (default for |
| 868 | developer builds); 'no' means disable warnings | ||
| 869 | (default for non-developer builds).])], | ||
| 850 | [case $enableval in | 870 | [case $enableval in |
| 851 | yes|no) ;; | 871 | yes|no|warn-only) ;; |
| 852 | *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;; | 872 | *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;; |
| 853 | esac | 873 | esac |
| 854 | gl_gcc_warnings=$enableval], | 874 | gl_gcc_warnings=$enableval], |
| 855 | [gl_gcc_warnings=no] | 875 | [# By default, use 'warn-only' if it looks like the invoker of 'configure' |
| 876 | # is a developer as opposed to a builder. This is most likely true | ||
| 877 | # if GCC is recent enough and there is a .git subdirectory; | ||
| 878 | # however, if there is also a .tarball-version file it is probably | ||
| 879 | # just a reliease imported into Git for patch management. | ||
| 880 | gl_gcc_warnings=no | ||
| 881 | test -d "$srcdir"/.git && test ! -f "$srcdir"/.tarball-version && | ||
| 882 | gl_GCC_VERSION_IFELSE([5], [3], [gl_gcc_warnings=warn-only])] | ||
| 856 | ) | 883 | ) |
| 857 | 884 | ||
| 858 | # clang is unduly picky about some things. | 885 | # clang is unduly picky about some things. |
| @@ -868,7 +895,7 @@ AC_CACHE_CHECK([whether the compiler is clang], [emacs_cv_clang], | |||
| 868 | 895 | ||
| 869 | # When compiling with GCC, prefer -isystem to -I when including system | 896 | # When compiling with GCC, prefer -isystem to -I when including system |
| 870 | # include files, to avoid generating useless diagnostics for the files. | 897 | # include files, to avoid generating useless diagnostics for the files. |
| 871 | AS_IF([test "$gl_gcc_warnings" != yes], | 898 | AS_IF([test $gl_gcc_warnings = no], |
| 872 | [ | 899 | [ |
| 873 | isystem='-I' | 900 | isystem='-I' |
| 874 | AS_IF([test "$emacs_cv_clang" = yes], | 901 | AS_IF([test "$emacs_cv_clang" = yes], |
| @@ -892,7 +919,7 @@ AS_IF([test "$gl_gcc_warnings" != yes], | |||
| 892 | nw="$nw -Wwrite-strings" | 919 | nw="$nw -Wwrite-strings" |
| 893 | ;; | 920 | ;; |
| 894 | esac | 921 | esac |
| 895 | AS_IF([test -z "$nw"], | 922 | AS_IF([test $gl_gcc_warnings = yes], |
| 896 | [gl_WARN_ADD([-Werror], [WERROR_CFLAGS])]) | 923 | [gl_WARN_ADD([-Werror], [WERROR_CFLAGS])]) |
| 897 | AC_SUBST([WERROR_CFLAGS]) | 924 | AC_SUBST([WERROR_CFLAGS]) |
| 898 | 925 | ||
| @@ -2011,17 +2038,6 @@ fi | |||
| 2011 | ## $window_system is now set to the window system we will | 2038 | ## $window_system is now set to the window system we will |
| 2012 | ## ultimately use. | 2039 | ## ultimately use. |
| 2013 | 2040 | ||
| 2014 | if test "$window_system" = none && test "$gl_gcc_warnings" = yes; then | ||
| 2015 | # Too many warnings for now. | ||
| 2016 | nw= | ||
| 2017 | nw="$nw -Wsuggest-attribute=noreturn" | ||
| 2018 | gl_MANYWARN_COMPLEMENT([WARN_CFLAGS], [$WARN_CFLAGS], [$nw]) | ||
| 2019 | |||
| 2020 | gl_WARN_ADD([-Wno-unused-variable]) | ||
| 2021 | gl_WARN_ADD([-Wno-unused-but-set-variable]) | ||
| 2022 | gl_WARN_ADD([-Wno-unused-but-set-parameter]) | ||
| 2023 | fi | ||
| 2024 | |||
| 2025 | term_header= | 2041 | term_header= |
| 2026 | HAVE_X_WINDOWS=no | 2042 | HAVE_X_WINDOWS=no |
| 2027 | HAVE_X11=no | 2043 | HAVE_X11=no |
| @@ -25,6 +25,12 @@ otherwise leave it unmarked. | |||
| 25 | 25 | ||
| 26 | * Installation Changes in Emacs 25.2 | 26 | * Installation Changes in Emacs 25.2 |
| 27 | 27 | ||
| 28 | ** The new option 'configure --enable-gcc-warnings=warn-only' causes | ||
| 29 | GCC to issue warnings without stopping the bild. This behavior is now | ||
| 30 | the default in developer builds. As before, use | ||
| 31 | '--disable-gcc-warnings' to suppress GCC's warnings, and | ||
| 32 | '--enable-gcc-warnings' to stop the build if GCC issues warnings. | ||
| 33 | |||
| 28 | +++ | 34 | +++ |
| 29 | ** New configure option '--disable-build-details' attempts to build an | 35 | ** New configure option '--disable-build-details' attempts to build an |
| 30 | Emacs that is more likely to be reproducible; that is, if you build | 36 | Emacs that is more likely to be reproducible; that is, if you build |