aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2012-04-09 00:45:59 -0700
committerPaul Eggert2012-04-09 00:45:59 -0700
commitb8df54ffbefc5ddf40ddcda68a2a682769c5833d (patch)
tree95b4e71a64030550e3c1719575121e773167d53a /src
parentcb3c2e3eca8bf31ac861739272ba1e182f4ec295 (diff)
downloademacs-b8df54ffbefc5ddf40ddcda68a2a682769c5833d.tar.gz
emacs-b8df54ffbefc5ddf40ddcda68a2a682769c5833d.zip
configure: new option --enable-gcc-warnings
I have been using this change for many months in my private copy of Emacs, and have used it to find several bugs. It's mature enough to publish now. * Makefile.in (GNULIB_MODULES): Add warnings, manywarnings. * configure.in: Support --enable-gcc-warnings, in the style of other GNU packages such as coreutils. (C_WARNINGS_SWITCH): Remove, replacing with... (WARN_CFLAGS, GNULIB_WARN_CFLAGS): New variable. (PKG_CHECK_MODULES, C_SWITCH_X_SITE): Use -isystem rather than -I, when including system files with GCC. * etc/NEWS: Mention --enable-gcc-warnings. * lib/Makefile.am (AM_CFLAGS): New macro. * m4/manywarnings.m4, m4/warnings.m4: New files, from gnulib. * lib-src/Makefile.in (C_WARNINGS_SWITCH): Remove. (WARN_CFLAGS, WERROR_CFLAGS): New macros. (BASE_CFLAGS): Use new macros rather than old. * lwlib/Makefile.in (C_WARNINGS_SWITCH): Remove. (WARN_CFLAGS, WERROR_CFLAGS): New macros. (ALL_CFLAGS): Use new macros rather than old. * oldXMenu/Makefile.in (C_WARNINGS_SWITCH): Remove. (WARN_CFLAGS, WERROR_CFLAGS): New macros. (ALL_CFLAGS): Use new macros rather than old. * src/Makefile.in (C_WARNINGS_SWITCH): Remove. (WARN_CFLAGS, WERROR_CFLAGS): New macros. (ALL_CFLAGS): Use new macros rather than old. * src/process.c: Ignore -Wstrict-overflow to work around GCC bug 52904. * src/regex.c: Ignore -Wstrict-overflow. If !emacs, also ignore -Wunused-but-set-variable, -Wunused-function, -Wunused-macros, -Wunused-result, -Wunused-variable. This should go away once the Emacs and Gnulib regex code is merged. (xmalloc, xrealloc): Now static.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog13
-rw-r--r--src/Makefile.in5
-rw-r--r--src/process.c7
-rw-r--r--src/regex.c17
4 files changed, 38 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index dbff8e35492..df3336b52e1 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,18 @@
12012-04-09 Paul Eggert <eggert@cs.ucla.edu> 12012-04-09 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 configure: new option --enable-gcc-warnings
4 * Makefile.in (C_WARNINGS_SWITCH): Remove.
5 (WARN_CFLAGS, WERROR_CFLAGS): New macros.
6 (ALL_CFLAGS): Use new macros rather than old.
7 * process.c: Ignore -Wstrict-overflow to work around GCC bug 52904.
8 * regex.c: Ignore -Wstrict-overflow. If !emacs, also ignore
9 -Wunused-but-set-variable, -Wunused-function, -Wunused-macros,
10 -Wunused-result, -Wunused-variable. This should go away once
11 the Emacs and Gnulib regex code is merged.
12 (xmalloc, xrealloc): Now static.
13
142012-04-09 Paul Eggert <eggert@cs.ucla.edu>
15
3 composite.c: use 'double' consistently 16 composite.c: use 'double' consistently
4 * composite.c (get_composition_id): Use 'double' consistently 17 * composite.c (get_composition_id): Use 'double' consistently
5 instead of converting 'float' to 'double' and vice versa; this is 18 instead of converting 'float' to 'double' and vice versa; this is
diff --git a/src/Makefile.in b/src/Makefile.in
index 8c3704f830e..19f586396cb 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -68,7 +68,8 @@ OTHER_FILES = @OTHER_FILES@
68PROFILING_CFLAGS = @PROFILING_CFLAGS@ 68PROFILING_CFLAGS = @PROFILING_CFLAGS@
69 69
70## Flags to pass to the compiler to enable build warnings 70## Flags to pass to the compiler to enable build warnings
71C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@ 71WARN_CFLAGS = @WARN_CFLAGS@
72WERROR_CFLAGS = @WERROR_CFLAGS@
72 73
73## Machine-specific CFLAGS. 74## Machine-specific CFLAGS.
74C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ 75C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
@@ -314,7 +315,7 @@ ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I$(srcdir) \
314 $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \ 315 $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \
315 $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) $(PROFILING_CFLAGS) \ 316 $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) $(PROFILING_CFLAGS) \
316 $(LIBGNUTLS_CFLAGS) \ 317 $(LIBGNUTLS_CFLAGS) \
317 $(C_WARNINGS_SWITCH) $(CFLAGS) 318 $(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS)
318ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS) 319ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS)
319 320
320.SUFFIXES: .m 321.SUFFIXES: .m
diff --git a/src/process.c b/src/process.c
index f2f33a9eafc..f14de474ee0 100644
--- a/src/process.c
+++ b/src/process.c
@@ -120,6 +120,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
120#include "nsterm.h" 120#include "nsterm.h"
121#endif 121#endif
122 122
123/* Work around GCC 4.7.0 bug with strict overflow checking; see
124 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52904>.
125 These lines can be removed once the GCC bug is fixed. */
126#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
127# pragma GCC diagnostic ignored "-Wstrict-overflow"
128#endif
129
123Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid; 130Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid;
124Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime, Qcstime; 131Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime, Qcstime;
125Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs; 132Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs;
diff --git a/src/regex.c b/src/regex.c
index 0f9150193ec..d16a5148054 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -33,6 +33,19 @@
33 #pragma alloca 33 #pragma alloca
34#endif 34#endif
35 35
36/* Ignore some GCC warnings for now. This section should go away
37 once the Emacs and Gnulib regex code is merged. */
38#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
39# pragma GCC diagnostic ignored "-Wstrict-overflow"
40# ifndef emacs
41# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
42# pragma GCC diagnostic ignored "-Wunused-function"
43# pragma GCC diagnostic ignored "-Wunused-macros"
44# pragma GCC diagnostic ignored "-Wunused-result"
45# pragma GCC diagnostic ignored "-Wunused-variable"
46# endif
47#endif
48
36#ifdef HAVE_CONFIG_H 49#ifdef HAVE_CONFIG_H
37# include <config.h> 50# include <config.h>
38#endif 51#endif
@@ -198,7 +211,7 @@
198 211
199/* When used in Emacs's lib-src, we need xmalloc and xrealloc. */ 212/* When used in Emacs's lib-src, we need xmalloc and xrealloc. */
200 213
201void * 214static void *
202xmalloc (size_t size) 215xmalloc (size_t size)
203{ 216{
204 register void *val; 217 register void *val;
@@ -211,7 +224,7 @@ xmalloc (size_t size)
211 return val; 224 return val;
212} 225}
213 226
214void * 227static void *
215xrealloc (void *block, size_t size) 228xrealloc (void *block, size_t size)
216{ 229{
217 register void *val; 230 register void *val;