Now on revision 107962. ------------------------------------------------------------ revno: 107962 committer: Sam Steingold branch nick: trunk timestamp: Wed 2012-04-18 16:26:57 -0400 message: * lisp/progmodes/gud.el (gud-key-prefix): Use :type 'key-sequence instead of 'string to accommodate values like [f11]. Always use `vconcat' instead of `concat' on it, like in `gud-def'. * lisp/progmodes/gdb-mi.el: Likewise. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-04-18 16:43:23 +0000 +++ lisp/ChangeLog 2012-04-18 20:26:57 +0000 @@ -1,3 +1,10 @@ +2012-04-18 Sam Steingold + + * progmodes/gud.el (gud-key-prefix): Use :type 'key-sequence + instead of 'string to accommodate values like [f11]. + Always use `vconcat' instead of `concat' on it, like in `gud-def'. + * progmodes/gdb-mi.el: Likewise. + 2012-04-18 Leo Liu * abbrev.el (edit-abbrevs): Move point to the abbrev table of === modified file 'lisp/progmodes/gdb-mi.el' --- lisp/progmodes/gdb-mi.el 2012-03-13 07:07:10 +0000 +++ lisp/progmodes/gdb-mi.el 2012-04-18 20:26:57 +0000 @@ -1056,7 +1056,7 @@ (if gdb-speedbar-auto-raise "en" "dis")))) (define-key gud-minor-mode-map "\C-c\C-w" 'gud-watch) -(define-key global-map (concat gud-key-prefix "\C-w") 'gud-watch) +(define-key global-map (vconcat gud-key-prefix "\C-w") 'gud-watch) (declare-function tooltip-identifier-from-point "tooltip" (point)) === modified file 'lisp/progmodes/gud.el' --- lisp/progmodes/gud.el 2012-04-09 13:05:48 +0000 +++ lisp/progmodes/gud.el 2012-04-18 20:26:57 +0000 @@ -66,10 +66,10 @@ (defcustom gud-key-prefix "\C-x\C-a" "Prefix of all GUD commands valid in C buffers." - :type 'string + :type 'key-sequence :group 'gud) -(global-set-key (concat gud-key-prefix "\C-l") 'gud-refresh) +(global-set-key (vconcat gud-key-prefix "\C-l") 'gud-refresh) (define-key ctl-x-map " " 'gud-break) ;; backward compatibility hack (defvar gud-marker-filter nil) ------------------------------------------------------------ revno: 107961 [merge] fixes bug(s): http://debbugs.gnu.org/11207 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-04-18 10:07:27 -0700 message: configure: new option --enable-gcc-warnings (Bug#11207) 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. * INSTALL (DETAILED BUILDING AND INSTALLATION): Likewise. * 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. * msdos/sed1v2.inp, msdos/sed3v2.inp, msdos/sedlibmk.inp: GNULIB_WARN_CFLAGS, WARN_CFLAGS, and WERROR_CFLAGS replace C_WARNINGS_SWITCH. * 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. diff: === modified file 'ChangeLog' --- ChangeLog 2012-04-17 01:29:58 +0000 +++ ChangeLog 2012-04-18 16:45:13 +0000 @@ -1,3 +1,21 @@ +2012-04-18 Paul Eggert + + configure: new option --enable-gcc-warnings (Bug#11207) + 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. + * INSTALL (DETAILED BUILDING AND INSTALLATION): Likewise. + * lib/Makefile.am (AM_CFLAGS): New macro. + * m4/manywarnings.m4, m4/warnings.m4: New files, from gnulib. + 2012-04-17 Dmitry Antipov * configure.in (AC_CHECK_FUNCS): === modified file 'INSTALL' --- INSTALL 2012-01-19 07:21:25 +0000 +++ INSTALL 2012-04-17 21:40:07 +0000 @@ -317,6 +317,12 @@ even on hosts where a narrower type would do. With this option, on a typical 32-bit host, Emacs integers have 62 bits instead of 30. +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. + The `--prefix=PREFIXDIR' option specifies where the installation process should put emacs and its data files. This defaults to `/usr/local'. - Emacs (and the other utilities users run) go in PREFIXDIR/bin === modified file 'Makefile.in' --- Makefile.in 2012-04-09 13:10:22 +0000 +++ Makefile.in 2012-04-09 19:51:06 +0000 @@ -336,8 +336,9 @@ careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr \ dup2 \ filemode getloadavg getopt-gnu ignore-value intprops lstat \ - mktime pthread_sigmask readlink \ - socklen stdarg stdio strftime strtoimax strtoumax symlink sys_stat + manywarnings mktime pthread_sigmask readlink \ + socklen stdarg stdio strftime strtoimax strtoumax symlink sys_stat \ + warnings GNULIB_TOOL_FLAGS = \ --avoid=msvc-inval --avoid=msvc-nothrow \ --avoid=raise --avoid=threadlib \ === modified file 'configure.in' --- configure.in 2012-04-17 01:29:58 +0000 +++ configure.in 2012-04-18 16:40:06 +0000 @@ -686,47 +686,123 @@ test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS" fi -### Use -Wdeclaration-after-statement if the compiler supports it -AC_MSG_CHECKING([whether gcc understands -Wdeclaration-after-statement]) -SAVE_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wdeclaration-after-statement" -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], has_option=yes, has_option=no) -if test $has_option = yes; then - C_WARNINGS_SWITCH="-Wdeclaration-after-statement $C_WARNINGS_SWITCH" -fi -AC_MSG_RESULT($has_option) -CFLAGS="$SAVE_CFLAGS" -unset has_option -unset SAVE_CFLAGS - -### Use -Wold-style-definition if the compiler supports it -# This can be removed when conversion to standard C is finished. -AC_MSG_CHECKING([whether gcc understands -Wold-style-definition]) -SAVE_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wold-style-definition" -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], has_option=yes, has_option=no) -if test $has_option = yes; then - C_WARNINGS_SWITCH="-Wold-style-definition $C_WARNINGS_SWITCH" -fi -AC_MSG_RESULT($has_option) -CFLAGS="$SAVE_CFLAGS" -unset has_option -unset SAVE_CFLAGS - -### Use -Wimplicit-function-declaration if the compiler supports it -AC_MSG_CHECKING([whether gcc understands -Wimplicit-function-declaration]) -SAVE_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wimplicit-function-declaration" -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], has_option=yes, has_option=no) -if test $has_option = yes; then - C_WARNINGS_SWITCH="-Wimplicit-function-declaration $C_WARNINGS_SWITCH" -fi -AC_MSG_RESULT($has_option) -CFLAGS="$SAVE_CFLAGS" -unset has_option -unset SAVE_CFLAGS - -AC_SUBST(C_WARNINGS_SWITCH) +AC_ARG_ENABLE([gcc-warnings], + [AS_HELP_STRING([--enable-gcc-warnings], + [turn on lots of GCC warnings (for developers)])], + [case $enableval in + yes|no) ;; + *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;; + esac + gl_gcc_warnings=$enableval], + [gl_gcc_warnings=no] +) + +# 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. +AC_DEFUN([gl_GCC_VERSION_IFELSE], + [AC_PREPROC_IFELSE( + [AC_LANG_PROGRAM( + [[ +#if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__) +/* ok */ +#else +# error "your version of gcc is older than $1.$2" +#endif + ]]), + ], [$3], [$4]) + ] +) + +# When compiling with GCC, prefer -isystem to -I when including system +# include files, to avoid generating useless diagnostics for the files. +if test "$gl_gcc_warnings" != yes; then + isystem='-I' +else + isystem='-isystem ' + + # This, $nw, is the list of warnings we disable. + nw= + + case $with_x_toolkit in + lucid | athena | motif) + # Old toolkits mishandle 'const'. + nw="$nw -Wwrite-strings" + ;; + *) + gl_WARN_ADD([-Werror], [WERROR_CFLAGS]) + ;; + esac + AC_SUBST([WERROR_CFLAGS]) + + nw="$nw -Waggregate-return" # anachronistic + nw="$nw -Wlong-long" # C90 is anachronistic (lib/gethrxtime.h) + nw="$nw -Wc++-compat" # We don't care about C++ compilers + nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib + nw="$nw -Wtraditional" # Warns on #elif which we use often + nw="$nw -Wcast-qual" # Too many warnings for now + nw="$nw -Wconversion" # Too many warnings for now + nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings + nw="$nw -Wsign-conversion" # Too many warnings for now + nw="$nw -Woverlength-strings" # Not a problem these days + nw="$nw -Wtraditional-conversion" # Too many warnings for now + nw="$nw -Wpadded" # Our structs are not padded + nw="$nw -Wredundant-decls" # We regularly (re)declare getenv etc. + nw="$nw -Wlogical-op" # any use of fwrite provokes this + nw="$nw -Wformat-nonliteral" # Emacs does this a lot + nw="$nw -Wvla" # warnings in gettext.h + nw="$nw -Wnested-externs" # use of XARGMATCH/verify_function__ + nw="$nw -Wswitch-enum" # Too many warnings for now + nw="$nw -Wswitch-default" # Too many warnings for now + nw="$nw -Wfloat-equal" # e.g., ftoastr.c + nw="$nw -Winline" # e.g., dispnew.c's inlining of row_equal_p + + # Emacs doesn't care about shadowing; see + # . + nw="$nw -Wshadow" + + # The following lines should be removable at some point. + nw="$nw -Wstack-protector" + nw="$nw -Wstrict-overflow" + nw="$nw -Wsuggest-attribute=const" + nw="$nw -Wsuggest-attribute=pure" + + gl_MANYWARN_ALL_GCC([ws]) + gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw]) + for w in $ws; do + gl_WARN_ADD([$w]) + done + gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one + gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now + gl_WARN_ADD([-Wno-type-limits]) # Too many warnings for now + gl_WARN_ADD([-Wno-switch]) # Too many warnings for now + gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now + gl_WARN_ADD([-Wno-format-nonliteral]) + + # In spite of excluding -Wlogical-op above, it is enabled, as of + # gcc 4.5.0 20090517. + gl_WARN_ADD([-Wno-logical-op]) + + gl_WARN_ADD([-fdiagnostics-show-option]) + gl_WARN_ADD([-funit-at-a-time]) + + AC_SUBST([WARN_CFLAGS]) + + AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.]) + AC_DEFINE([_FORTIFY_SOURCE], [2], + [enable compile-time and run-time bounds-checking, and some warnings]) + AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks]) + + # We use a slightly smaller set of warning options for lib/. + # Remove the following and save the result in GNULIB_WARN_CFLAGS. + nw= + nw="$nw -Wunused-macros" + + gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw]) + AC_SUBST([GNULIB_WARN_CFLAGS]) +fi + #### Some other nice autoconf tests. @@ -1127,8 +1203,13 @@ if $PKG_CONFIG --exists "$2" 2>&AS_MESSAGE_LOG_FD && $1_CFLAGS=`$PKG_CONFIG --cflags "$2" 2>&AS_MESSAGE_LOG_FD` && $1_LIBS=`$PKG_CONFIG --libs "$2" 2>&AS_MESSAGE_LOG_FD`; then - - $1_CFLAGS=`AS_ECHO(["$$1_CFLAGS"]) | sed -e 's,///*,/,g'` + edit_cflags=" + s,///*,/,g + s/^/ / + s/ -I/ $isystem/g + s/^ // + " + $1_CFLAGS=`AS_ECHO(["$$1_CFLAGS"]) | sed -e "$edit_cflags"` $1_LIBS=`AS_ECHO(["$$1_LIBS"]) | sed -e 's,///*,/,g'` AC_MSG_RESULT([yes CFLAGS='$$1_CFLAGS' LIBS='$$1_LIBS']) succeeded=yes @@ -1454,7 +1535,7 @@ AC_SUBST(LD_SWITCH_X_SITE_AUX_RPATH) if test "${x_includes}" != NONE && test -n "${x_includes}"; then - C_SWITCH_X_SITE=-I`echo ${x_includes} | sed -e "s/:/ -I/g"` + C_SWITCH_X_SITE="$isystem"`echo ${x_includes} | sed -e "s/:/ $isystem/g"` fi if test x"${x_includes}" = x; then === modified file 'etc/NEWS' --- etc/NEWS 2012-04-17 03:08:05 +0000 +++ etc/NEWS 2012-04-17 21:38:34 +0000 @@ -22,6 +22,13 @@ * Installation Changes in Emacs 24.2 + +** New configure option '--enable-gcc-warnings', intended for developers. +If building with GCC, this enables compile-time checks that warn about +possibly-questionable C code. On a recent GNU system there should be +no warnings; on older and on non-GNU systems the generated warnings +may be useful. + * Startup Changes in Emacs 24.2 === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2012-04-16 00:41:01 +0000 +++ lib-src/ChangeLog 2012-04-18 16:45:13 +0000 @@ -1,3 +1,10 @@ +2012-04-18 Paul Eggert + + configure: new option --enable-gcc-warnings (Bug#11207) + * Makefile.in (C_WARNINGS_SWITCH): Remove. + (WARN_CFLAGS, WERROR_CFLAGS): New macros. + (BASE_CFLAGS): Use new macros rather than old. + 2012-04-16 Paul Eggert Assume less-ancient POSIX support. === modified file 'lib-src/Makefile.in' --- lib-src/Makefile.in 2012-01-19 07:21:25 +0000 +++ lib-src/Makefile.in 2012-04-09 07:45:59 +0000 @@ -36,8 +36,9 @@ EXEEXT=@EXEEXT@ C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@ C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ -C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@ PROFILING_CFLAGS = @PROFILING_CFLAGS@ +WARN_CFLAGS = @WARN_CFLAGS@ +WERROR_CFLAGS = @WERROR_CFLAGS@ # Program name transformation. TRANSFORM = @program_transform_name@ @@ -167,7 +168,8 @@ # Those files shared with other GNU utilities need HAVE_CONFIG_H # defined before they know they can take advantage of the information # in ../src/config.h. -BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) ${C_WARNINGS_SWITCH} \ +BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \ + $(WARN_CFLAGS) $(WERROR_CFLAGS) \ -DHAVE_CONFIG_H -I. -I../src -I../lib \ -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib === modified file 'lib/Makefile.am' --- lib/Makefile.am 2011-02-20 10:51:50 +0000 +++ lib/Makefile.am 2012-04-09 07:45:59 +0000 @@ -4,6 +4,7 @@ MOSTLYCLEANFILES = noinst_LIBRARIES = +AM_CFLAGS = $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS) DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src include gnulib.mk === modified file 'lwlib/ChangeLog' --- lwlib/ChangeLog 2012-04-11 01:25:51 +0000 +++ lwlib/ChangeLog 2012-04-18 16:45:13 +0000 @@ -1,3 +1,10 @@ +2012-04-18 Paul Eggert + + configure: new option --enable-gcc-warnings (Bug#11207) + * Makefile.in (C_WARNINGS_SWITCH): Remove. + (WARN_CFLAGS, WERROR_CFLAGS): New macros. + (ALL_CFLAGS): Use new macros rather than old. + 2012-04-11 Glenn Morris * Makefile.in (C_SWITCH_X_SYSTEM): Remove. === modified file 'lwlib/Makefile.in' --- lwlib/Makefile.in 2012-04-11 01:25:51 +0000 +++ lwlib/Makefile.in 2012-04-14 04:37:44 +0000 @@ -28,8 +28,9 @@ C_SWITCH_X_SITE=@C_SWITCH_X_SITE@ C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@ C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ -C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@ PROFILING_CFLAGS = @PROFILING_CFLAGS@ +WARN_CFLAGS = `echo @WARN_CFLAGS@ | sed 's/ -Wwrite-strings//'` +WERROR_CFLAGS = @WERROR_CFLAGS@ CC=@CC@ CFLAGS=@CFLAGS@ @@ -53,7 +54,7 @@ ## There are no generated lwlib files, hence no need for -I. ALL_CFLAGS= $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \ $(C_SWITCH_MACHINE) \ - $(C_WARNINGS_SWITCH) $(PROFILING_CFLAGS) $(CFLAGS) \ + $(WARN_CFLAGS) $(WERROR_CFLAGS) $(PROFILING_CFLAGS) $(CFLAGS) \ -DHAVE_CONFIG_H -Demacs -I../src \ -I$(srcdir) -I$(srcdir)/../src -I../lib -I$(srcdir)/../lib === added file 'm4/manywarnings.m4' --- m4/manywarnings.m4 1970-01-01 00:00:00 +0000 +++ m4/manywarnings.m4 2012-04-09 07:45:59 +0000 @@ -0,0 +1,184 @@ +# manywarnings.m4 serial 3 +dnl Copyright (C) 2008-2012 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Simon Josefsson + +# gl_MANYWARN_COMPLEMENT(OUTVAR, LISTVAR, REMOVEVAR) +# -------------------------------------------------- +# Copy LISTVAR to OUTVAR except for the entries in REMOVEVAR. +# Elements separated by whitespace. In set logic terms, the function +# does OUTVAR = LISTVAR \ REMOVEVAR. +AC_DEFUN([gl_MANYWARN_COMPLEMENT], +[ + gl_warn_set= + set x $2; shift + for gl_warn_item + do + case " $3 " in + *" $gl_warn_item "*) + ;; + *) + gl_warn_set="$gl_warn_set $gl_warn_item" + ;; + esac + done + $1=$gl_warn_set +]) + +# gl_MANYWARN_ALL_GCC(VARIABLE) +# ----------------------------- +# Add all documented GCC warning parameters to variable VARIABLE. +# Note that you need to test them using gl_WARN_ADD if you want to +# make sure your gcc understands it. +AC_DEFUN([gl_MANYWARN_ALL_GCC], +[ + dnl First, check if -Wno-missing-field-initializers is needed. + dnl -Wmissing-field-initializers is implied by -W, but that issues + dnl warnings with GCC version before 4.7, for the common idiom + dnl of initializing types on the stack to zero, using { 0, } + AC_REQUIRE([AC_PROG_CC]) + if test -n "$GCC"; then + + dnl First, check -W -Werror -Wno-missing-field-initializers is supported + dnl with the current $CC $CFLAGS $CPPFLAGS. + AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported]) + AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [ + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -W -Werror -Wno-missing-field-initializers" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[]], [[]])], + [gl_cv_cc_nomfi_supported=yes], + [gl_cv_cc_nomfi_supported=no]) + CFLAGS="$gl_save_CFLAGS"]) + AC_MSG_RESULT([$gl_cv_cc_nomfi_supported]) + + if test "$gl_cv_cc_nomfi_supported" = yes; then + dnl Now check whether -Wno-missing-field-initializers is needed + dnl for the { 0, } construct. + AC_MSG_CHECKING([whether -Wno-missing-field-initializers is needed]) + AC_CACHE_VAL([gl_cv_cc_nomfi_needed], [ + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -W -Werror" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[void f (void) + { + typedef struct { int a; int b; } s_t; + s_t s1 = { 0, }; + } + ]], + [[]])], + [gl_cv_cc_nomfi_needed=no], + [gl_cv_cc_nomfi_needed=yes]) + CFLAGS="$gl_save_CFLAGS" + ]) + AC_MSG_RESULT([$gl_cv_cc_nomfi_needed]) + fi + fi + + gl_manywarn_set= + for gl_manywarn_item in \ + -Wall \ + -W \ + -Wformat-y2k \ + -Wformat-nonliteral \ + -Wformat-security \ + -Winit-self \ + -Wmissing-include-dirs \ + -Wswitch-default \ + -Wswitch-enum \ + -Wunused \ + -Wunknown-pragmas \ + -Wstrict-aliasing \ + -Wstrict-overflow \ + -Wsystem-headers \ + -Wfloat-equal \ + -Wtraditional \ + -Wtraditional-conversion \ + -Wdeclaration-after-statement \ + -Wundef \ + -Wshadow \ + -Wunsafe-loop-optimizations \ + -Wpointer-arith \ + -Wbad-function-cast \ + -Wc++-compat \ + -Wcast-qual \ + -Wcast-align \ + -Wwrite-strings \ + -Wconversion \ + -Wsign-conversion \ + -Wlogical-op \ + -Waggregate-return \ + -Wstrict-prototypes \ + -Wold-style-definition \ + -Wmissing-prototypes \ + -Wmissing-declarations \ + -Wmissing-noreturn \ + -Wmissing-format-attribute \ + -Wpacked \ + -Wpadded \ + -Wredundant-decls \ + -Wnested-externs \ + -Wunreachable-code \ + -Winline \ + -Winvalid-pch \ + -Wlong-long \ + -Wvla \ + -Wvolatile-register-var \ + -Wdisabled-optimization \ + -Wstack-protector \ + -Woverlength-strings \ + -Wbuiltin-macro-redefined \ + -Wmudflap \ + -Wpacked-bitfield-compat \ + -Wsync-nand \ + ; do + gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" + done + # The following are not documented in the manual but are included in + # output from gcc --help=warnings. + for gl_manywarn_item in \ + -Wattributes \ + -Wcoverage-mismatch \ + -Wmultichar \ + -Wunused-macros \ + ; do + gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" + done + # More warnings from gcc 4.6.2 --help=warnings. + for gl_manywarn_item in \ + -Wabi \ + -Wcpp \ + -Wdeprecated \ + -Wdeprecated-declarations \ + -Wdiv-by-zero \ + -Wdouble-promotion \ + -Wendif-labels \ + -Wextra \ + -Wformat-contains-nul \ + -Wformat-extra-args \ + -Wformat-zero-length \ + -Wformat=2 \ + -Wmultichar \ + -Wnormalized=nfc \ + -Woverflow \ + -Wpointer-to-int-cast \ + -Wpragmas \ + -Wsuggest-attribute=const \ + -Wsuggest-attribute=noreturn \ + -Wsuggest-attribute=pure \ + -Wtrampolines \ + ; do + gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" + done + + # Disable the missing-field-initializers warning if needed + if test "$gl_cv_cc_nomfi_needed" = yes; then + gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers" + fi + + $1=$gl_manywarn_set +]) === added file 'm4/warnings.m4' --- m4/warnings.m4 1970-01-01 00:00:00 +0000 +++ m4/warnings.m4 2012-04-09 07:45:59 +0000 @@ -0,0 +1,42 @@ +# warnings.m4 serial 6 +dnl Copyright (C) 2008-2012 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Simon Josefsson + +# gl_AS_VAR_APPEND(VAR, VALUE) +# ---------------------------- +# Provide the functionality of AS_VAR_APPEND if Autoconf does not have it. +m4_ifdef([AS_VAR_APPEND], +[m4_copy([AS_VAR_APPEND], [gl_AS_VAR_APPEND])], +[m4_define([gl_AS_VAR_APPEND], +[AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])]) + + +# gl_WARN_ADD(PARAMETER, [VARIABLE = WARN_CFLAGS]) +# ------------------------------------------------ +# Adds parameter to WARN_CFLAGS if the compiler supports it. For example, +# gl_WARN_ADD([-Wparentheses]). +# +# If VARIABLE is a variable name, AC_SUBST it. +AC_DEFUN([gl_WARN_ADD], +dnl FIXME: gl_Warn must be used unquoted until we can assume +dnl autoconf 2.64 or newer. +[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_[]_AC_LANG_ABBREV[]_$1])dnl +AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl +AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], m4_defn([gl_Warn]), [ + gl_save_compiler_FLAGS="$gl_Flags" + gl_Flags="$gl_Flags $1" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [AS_VAR_SET(gl_Warn, [yes])], + [AS_VAR_SET(gl_Warn, [no])]) + gl_Flags="$gl_save_compiler_FLAGS" +]) +AS_VAR_IF(gl_Warn, [yes], + [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])]) +AS_VAR_POPDEF([gl_Flags])dnl +AS_VAR_POPDEF([gl_Warn])dnl +m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])dnl +]) === modified file 'msdos/ChangeLog' --- msdos/ChangeLog 2012-04-11 01:25:51 +0000 +++ msdos/ChangeLog 2012-04-18 16:45:13 +0000 @@ -1,3 +1,9 @@ +2012-04-18 Paul Eggert + + configure: new option --enable-gcc-warnings (Bug#11207) + * sed1v2.inp, sed3v2.inp, sedlibmk.inp: GNULIB_WARN_CFLAGS, + WARN_CFLAGS, and WERROR_CFLAGS replace C_WARNINGS_SWITCH. + 2012-04-11 Glenn Morris * sedlibmk.inp, sed1v2.inp: GNUSTEP_CFLAGS replaces C_SWITCH_X_SYSTEM. === modified file 'msdos/sed1v2.inp' --- msdos/sed1v2.inp 2012-04-11 01:25:51 +0000 +++ msdos/sed1v2.inp 2012-04-14 05:04:54 +0000 @@ -41,7 +41,8 @@ /^C_SWITCH_SYSTEM *=/s/@C_SWITCH_SYSTEM@// /^GNUSTEP_CFLAGS *=/s/@GNUSTEP_CFLAGS@// /^C_SWITCH_X_SITE *=/s/@C_SWITCH_X_SITE@// -/^C_WARNINGS_SWITCH *=/s/@C_WARNINGS_SWITCH@// +/^WARN_CFLAGS *=/s/@WARN_CFLAGS@// +/^WERROR_CFLAGS *=/s/@WERROR_CFLAGS@// /^PROFILING_CFLAGS *=/s/@PROFILING_CFLAGS@// #/^LD_SWITCH_X_SITE *=/s/@LD_SWITCH_X_SITE@// /^LD_SWITCH_SYSTEM_TEMACS *=/s/@LD_SWITCH_SYSTEM_TEMACS@// === modified file 'msdos/sed3v2.inp' --- msdos/sed3v2.inp 2012-02-04 08:03:49 +0000 +++ msdos/sed3v2.inp 2012-04-14 05:04:54 +0000 @@ -38,7 +38,8 @@ /^CFLAGS *=/s!=.*$!=-O2 -g! /^C_SWITCH_SYSTEM *=/s!=.*$!=-DMSDOS! /^C_SWITCH_MACHINE *=/s/@C_SWITCH_MACHINE@// -/^C_WARNINGS_SWITCH *=/s/@C_WARNINGS_SWITCH@// +/^WARN_CFLAGS *=/s/@WARN_CFLAGS@// +/^WERROR_CFLAGS *=/s/@WERROR_CFLAGS@// /^PROFILING_CFLAGS *=/s/@PROFILING_CFLAGS@// /^ALLOCA *=/s!@ALLOCA@!! /^EXEEXT *=/s!@EXEEXT@!! @@ -51,4 +52,3 @@ } /^insrcdir=/s/^.*$/\#&/ /^ *\$(insrcdir) ||/s,\$(insrcdir) ||,command.com /c if not exist $( + + configure: new option --enable-gcc-warnings (Bug#11207) + * Makefile.in (C_WARNINGS_SWITCH): Remove. + (WARN_CFLAGS, WERROR_CFLAGS): New macros. + (ALL_CFLAGS): Use new macros rather than old. + 2012-04-11 Glenn Morris * Makefile.in (C_SWITCH_X_SYSTEM): Remove. === modified file 'oldXMenu/Makefile.in' --- oldXMenu/Makefile.in 2012-04-11 01:25:51 +0000 +++ oldXMenu/Makefile.in 2012-04-14 04:37:44 +0000 @@ -1,4 +1,4 @@ -## Makefile for oldXMenu +## Makefile for oldXMenu ## Copyright 1985, 1986, 1987 by the Massachusetts Institute of Technology @@ -47,8 +47,9 @@ C_SWITCH_X_SITE=@C_SWITCH_X_SITE@ C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@ C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ -C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@ PROFILING_CFLAGS = @PROFILING_CFLAGS@ +WARN_CFLAGS = @WARN_CFLAGS@ +WERROR_CFLAGS = @WERROR_CFLAGS@ EXTRA=insque.o CC=@CC@ @@ -88,7 +89,7 @@ ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \ $(C_SWITCH_X_SITE) \ - ${C_WARNINGS_SWITCH} ${PROFILING_CFLAGS} \ + $(WARN_CFLAGS) $(WERROR_CFLAGS) ${PROFILING_CFLAGS} \ $(CPPFLAGS) $(CFLAGS) -DEMACS_BITMAP_FILES \ -I../src -I${srcdir} -I${srcdir}/../src === modified file 'src/ChangeLog' --- src/ChangeLog 2012-04-17 22:56:06 +0000 +++ src/ChangeLog 2012-04-18 16:45:13 +0000 @@ -1,3 +1,16 @@ +2012-04-18 Paul Eggert + + configure: new option --enable-gcc-warnings (Bug#11207) + * Makefile.in (C_WARNINGS_SWITCH): Remove. + (WARN_CFLAGS, WERROR_CFLAGS): New macros. + (ALL_CFLAGS): Use new macros rather than old. + * process.c: Ignore -Wstrict-overflow to work around GCC bug 52904. + * 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. + 2012-04-17 Paul Eggert * dired.c (Fsystem_groups): Remove unused local. === modified file 'src/Makefile.in' --- src/Makefile.in 2012-04-11 01:25:51 +0000 +++ src/Makefile.in 2012-04-14 04:37:44 +0000 @@ -68,7 +68,8 @@ PROFILING_CFLAGS = @PROFILING_CFLAGS@ ## Flags to pass to the compiler to enable build warnings -C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@ +WARN_CFLAGS = @WARN_CFLAGS@ +WERROR_CFLAGS = @WERROR_CFLAGS@ ## Machine-specific CFLAGS. C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ @@ -308,7 +309,7 @@ $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \ $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) $(PROFILING_CFLAGS) \ $(LIBGNUTLS_CFLAGS) \ - $(C_WARNINGS_SWITCH) $(CFLAGS) + $(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS) ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS) .SUFFIXES: .m === modified file 'src/process.c' --- src/process.c 2012-04-14 01:46:06 +0000 +++ src/process.c 2012-04-14 04:37:44 +0000 @@ -120,6 +120,13 @@ #include "nsterm.h" #endif +/* Work around GCC 4.7.0 bug with strict overflow checking; see + . + These lines can be removed once the GCC bug is fixed. */ +#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__ +# pragma GCC diagnostic ignored "-Wstrict-overflow" +#endif + Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid; Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime, Qcstime; Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs; === modified file 'src/regex.c' --- src/regex.c 2012-01-19 07:21:25 +0000 +++ src/regex.c 2012-04-09 07:45:59 +0000 @@ -33,6 +33,19 @@ #pragma alloca #endif +/* Ignore some GCC warnings for now. This section should go away + once the Emacs and Gnulib regex code is merged. */ +#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__ +# pragma GCC diagnostic ignored "-Wstrict-overflow" +# ifndef emacs +# pragma GCC diagnostic ignored "-Wunused-but-set-variable" +# pragma GCC diagnostic ignored "-Wunused-function" +# pragma GCC diagnostic ignored "-Wunused-macros" +# pragma GCC diagnostic ignored "-Wunused-result" +# pragma GCC diagnostic ignored "-Wunused-variable" +# endif +#endif + #ifdef HAVE_CONFIG_H # include #endif @@ -198,7 +211,7 @@ /* When used in Emacs's lib-src, we need xmalloc and xrealloc. */ -void * +static void * xmalloc (size_t size) { register void *val; @@ -211,7 +224,7 @@ return val; } -void * +static void * xrealloc (void *block, size_t size) { register void *val; ------------------------------------------------------------ revno: 107960 committer: Leo Liu branch nick: trunk timestamp: Thu 2012-04-19 00:43:23 +0800 message: * lisp/abbrev.el (edit-abbrevs): Move point to the abbrev table of current buffer. (prepare-abbrev-list-buffer): Enter edit-abbrevs-mode only if LOCAL is nil. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-04-18 07:00:52 +0000 +++ lisp/ChangeLog 2012-04-18 16:43:23 +0000 @@ -1,3 +1,10 @@ +2012-04-18 Leo Liu + + * abbrev.el (edit-abbrevs): Move point to the abbrev table of + current buffer. + (prepare-abbrev-list-buffer): Enter edit-abbrevs-mode only if + LOCAL is nil. + 2012-04-18 Chong Yidong * simple.el (line-move): Use forward-line if in batch mode === modified file 'lisp/abbrev.el' --- lisp/abbrev.el 2012-03-04 02:45:04 +0000 +++ lisp/abbrev.el 2012-04-18 16:43:23 +0000 @@ -134,10 +134,13 @@ (push table empty-tables) (insert-abbrev-table-description table t))) (dolist (table (nreverse empty-tables)) - (insert-abbrev-table-description table t)))) + (insert-abbrev-table-description table t))) + ;; Note: `list-abbrevs' can dispaly only local abbrevs, in + ;; which case editing could lose abbrevs of other tables. Thus + ;; enter `edit-abbrevs-mode' only if LOCAL is nil. + (edit-abbrevs-mode)) (goto-char (point-min)) (set-buffer-modified-p nil) - (edit-abbrevs-mode) (current-buffer)))) (defun edit-abbrevs-mode () @@ -152,7 +155,8 @@ (defun edit-abbrevs () "Alter abbrev definitions by editing a list of them. -Selects a buffer containing a list of abbrev definitions. +Selects a buffer containing a list of abbrev definitions with +point located in the abbrev table of current buffer. You can edit them and type \\\\[edit-abbrevs-redefine] to redefine abbrevs according to your editing. Buffer contains a header line for each abbrev table, @@ -163,7 +167,12 @@ USECOUNT is an integer, and HOOK is any valid function or may be omitted (it is usually omitted)." (interactive) - (switch-to-buffer (prepare-abbrev-list-buffer))) + (let ((table-name (abbrev-table-name local-abbrev-table))) + (switch-to-buffer (prepare-abbrev-list-buffer)) + (when (and table-name + (search-forward + (concat "(" (symbol-name table-name) ")\n\n") nil t)) + (goto-char (match-end 0))))) (defun edit-abbrevs-redefine () "Redefine abbrevs according to current buffer contents." ------------------------------------------------------------ revno: 107959 fixes bug(s): http://debbugs.gnu.org/11053 committer: Chong Yidong branch nick: trunk timestamp: Wed 2012-04-18 15:00:52 +0800 message: * simple.el (line-move): Use forward-line if in batch mode. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-04-18 06:24:13 +0000 +++ lisp/ChangeLog 2012-04-18 07:00:52 +0000 @@ -1,3 +1,8 @@ +2012-04-18 Chong Yidong + + * simple.el (line-move): Use forward-line if in batch mode + (Bug#11053). + 2012-04-18 Christopher Schmidt * files.el (after-find-file): Do not try to add a final newline if === modified file 'lisp/simple.el' --- lisp/simple.el 2012-04-15 07:28:01 +0000 +++ lisp/simple.el 2012-04-18 07:00:52 +0000 @@ -4405,23 +4405,25 @@ ;; a cleaner solution to the problem of making C-n do something ;; useful given a tall image. (defun line-move (arg &optional noerror to-end try-vscroll) - (unless (and auto-window-vscroll try-vscroll - ;; Only vscroll for single line moves - (= (abs arg) 1) - ;; But don't vscroll in a keyboard macro. - (not defining-kbd-macro) - (not executing-kbd-macro) - (line-move-partial arg noerror to-end)) - (set-window-vscroll nil 0 t) - (if (and line-move-visual - ;; Display-based column are incompatible with goal-column. - (not goal-column) - ;; When the text in the window is scrolled to the left, - ;; display-based motion doesn't make sense (because each - ;; logical line occupies exactly one screen line). - (not (> (window-hscroll) 0))) - (line-move-visual arg noerror) - (line-move-1 arg noerror to-end)))) + (if noninteractive + (forward-line arg) + (unless (and auto-window-vscroll try-vscroll + ;; Only vscroll for single line moves + (= (abs arg) 1) + ;; But don't vscroll in a keyboard macro. + (not defining-kbd-macro) + (not executing-kbd-macro) + (line-move-partial arg noerror to-end)) + (set-window-vscroll nil 0 t) + (if (and line-move-visual + ;; Display-based column are incompatible with goal-column. + (not goal-column) + ;; When the text in the window is scrolled to the left, + ;; display-based motion doesn't make sense (because each + ;; logical line occupies exactly one screen line). + (not (> (window-hscroll) 0))) + (line-move-visual arg noerror) + (line-move-1 arg noerror to-end))))) ;; Display-based alternative to line-move-1. ;; Arg says how many lines to move. The value is t if we can move the ------------------------------------------------------------ revno: 107958 fixes bug(s): http://debbugs.gnu.org/11156 author: Christopher Schmidt committer: Chong Yidong branch nick: trunk timestamp: Wed 2012-04-18 14:24:13 +0800 message: Fix require-final-newline interaction with read-only buffers. * lisp/files.el (after-find-file): Do not try to add a final newline if the buffer is read-only. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-04-17 23:23:20 +0000 +++ lisp/ChangeLog 2012-04-18 06:24:13 +0000 @@ -1,3 +1,8 @@ +2012-04-18 Christopher Schmidt + + * files.el (after-find-file): Do not try to add a final newline if + the buffer is read-only (Bug#11156). + 2012-04-17 Richard Stallman * mail/rmail.el (rmail-start-mail): @@ -9,7 +14,7 @@ (rmail-forward): Pass the Rmail buffer, not nil, for replybuffer. * mail/sendmail.el (mail-bury): Choose the first rmail-mode - buffer, not the last. Reject temp buffers. Use the rmail-mode + buffer, not the last. Reject temp buffers. Use the rmail-mode buffer, not newbuf. 2012-04-17 Juanma Barranquero === modified file 'lisp/files.el' --- lisp/files.el 2012-04-14 01:46:06 +0000 +++ lisp/files.el 2012-04-18 06:24:13 +0000 @@ -2152,6 +2152,7 @@ (/= (char-after (1- (point-max))) ?\n) (not (and (eq selective-display t) (= (char-after (1- (point-max))) ?\r))) + (not buffer-read-only) (save-excursion (goto-char (point-max)) (insert "\n"))) ------------------------------------------------------------ Use --include-merges or -n0 to see merged revisions.