m4-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU M4 source repository branch, branch-1.4, updated. v1.4.13-21-g


From: Eric Blake
Subject: [SCM] GNU M4 source repository branch, branch-1.4, updated. v1.4.13-21-g30cd206
Date: Thu, 26 Nov 2009 20:22:50 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU M4 source repository".

http://git.sv.gnu.org/gitweb/?p=m4.git;a=commitdiff;h=30cd2068dcb8b51f9fe29741732027bb00b522a5

The branch, branch-1.4 has been updated
       via  30cd2068dcb8b51f9fe29741732027bb00b522a5 (commit)
       via  324f56e49ed43de04cf6e648fea9d89739788f24 (commit)
       via  268b47589e681e3fe46650e3b1b6f36d8557097b (commit)
       via  f1cf39048ffda00d41d1f60add63f3b6591b5d07 (commit)
       via  48873014007f6a22b77ed3b3fd8b01705e231715 (commit)
      from  48a143743c5dea904819a426f3fb687a18dd737e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 30cd2068dcb8b51f9fe29741732027bb00b522a5
Author: Eric Blake <address@hidden>
Date:   Thu Nov 26 06:29:06 2009 -0700

    Ignore write failures before stack overflow exit.
    
    * m4/gnulib-cache.m4: Import ignore-value module.
    * src/m4.c (fault_handler): Use it to avoid compiler warning.
    
    Signed-off-by: Eric Blake <address@hidden>

commit 324f56e49ed43de04cf6e648fea9d89739788f24
Author: Eric Blake <address@hidden>
Date:   Fri Nov 6 15:28:08 2009 -0700

    Allow use of compiler warnings.
    
    * m4/gnulib-cache.m4: Import manywarnings module.
    * configure.ac (WERROR_CFLAGS, WARN_CFLAGS): New variables.
    * src/Makefile.am (AM_CFLAGS): Use them.
    * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): Turn on warnings during
    distcheck.
    * src/m4.h (M4_GNUC_NORETURN): New macro.
    (trace_post): Delete unused parameter.
    * src/m4.c (usage): Mark as noreturn.
    (main): Remove unused parameter.
    * src/debug.c (trace_post): Likewise.
    (trace_pre): Cover all enum values.
    * src/symtab.c (lookup_symbol): Likewise.
    * src/builtin.c (define_macro, m4_dumpdef): Likewise.
    (m4_define, m4_undefine, m4_pushdef, m4_popdef, m4_sysval)
    (m4_divert, m4_undivert, m4_dnl, m4_changequote, m4_changecom)
    (m4_changeword, m4_syscmd, m4_include, m4_sinclude, m4_m4exit)
    (m4_debugmode, m4_debugfile, m4_placeholder): Mark unused
    parameters.
    (mkstemp_helper): Use parameter.
    (substitute): Avoid signed vs. unsigned comparison.
    * src/format.c (arg_int, arg_long, arg_double): Likewise.
    * src/input.c (next_token): Likewise.
    * src/output.c (freeze_diversions): Likewise.
    (m4_tmpname): Allow C++ compilation.
    * src/freeze.c (produce_frozen_state, GET_NUMBER): Use correct
    type.
    * src/macro.c (call_macro): Cover all enum values.
    (expand_macro): Update caller.
    * src/path.c (m4_fopen): Remove unused parameter.
    (m4_path_search): Update caller.
    
    Signed-off-by: Eric Blake <address@hidden>

commit 268b47589e681e3fe46650e3b1b6f36d8557097b
Author: Eric Blake <address@hidden>
Date:   Thu Nov 26 05:28:53 2009 -0700

    Silence syntax-check warnings.
    
    * src/m4.h (STREQ): New macro.
    * src/builtin.c (find_builtin_by_name): Use it.
    * src/input.c (set_word_regexp): Likewise.
    * src/m4.c (process_file): Likewise.
    (main): Consistently spell warning, and mark output strings.
    Avoid unsafe parsing functions.
    (process_file): Mark output strings.
    * src/output.c (make_diversion): Likewise.
    * src/format.c (arg_int, arg_long, arg_double): New helpers.
    (ARG_INT, ARG_LONG, ARG_DOUBLE): Use them to detect parse errors.
    * BACKLOG: Avoid whitespace problems.
    * TODO: Likewise.
    * HACKING: Likewise.
    * examples/esyscmd.m4: Likewise.
    * examples/file.m4: Likewise.
    * examples/fstab.m4: Likewise.
    * examples/patsubst.m4: Likewise.

commit f1cf39048ffda00d41d1f60add63f3b6591b5d07
Author: Eric Blake <address@hidden>
Date:   Fri Nov 20 08:51:20 2009 -0700

    Use gnulib maintainer-makefile module.
    
    * m4/gnulib-cache.m4: Import maintainer-makefile module.
    * cfg.mk (local-checks-to-skip): Drop changelog-check; add
    sc_cast_of_x_alloc_return_value.
    (gnulib_dir, gnu_rel_host, url_dir_list): Delete; provided by
    maint.mk.
    (config_h_header, old_NEWS_hash): New macros.
    * .prev-version: New file.
    * maint.mk: Remove from version control; use gnulib instead.
    * .gitignore: Update.
    * HACKING: Update.
    
    Signed-off-by: Eric Blake <address@hidden>
    (cherry picked from commit 260383467b3ae57f2cb3c6821718b99fdf278c4b)

commit 48873014007f6a22b77ed3b3fd8b01705e231715
Author: Eric Blake <address@hidden>
Date:   Fri Nov 20 08:33:24 2009 -0700

    Update from gnulib.
    
    * gnulib: Update.
    * m4/gnulib-cache.m4: Use --makefile-name.
    * lib/Makefile.am: Wrap the gnulib-generated file.
    * tests/Makefile.am: Likewise.
    * .gitignore: Track our wrappers.
    * doc/m4.texinfo (Improved capitalize): Fix typo.
    
    Signed-off-by: Eric Blake <address@hidden>

-----------------------------------------------------------------------

Summary of changes:
 .cvsignore                 |    1 +
 .gitignore                 |    7 +-
 .prev-version              |    1 +
 BACKLOG                    |    4 +-
 ChangeLog                  |   79 +++++++++++++++
 HACKING                    |    8 +-
 Makefile.am                |    3 +-
 TODO                       |    4 +-
 build-aux/.cvsignore       |    1 +
 build-aux/.gitignore       |    1 +
 cfg.mk                     |   30 ++----
 configure.ac               |   47 +++++++++
 doc/m4.texinfo             |    2 +-
 examples/esyscmd.m4        |    2 +-
 examples/file.m4           |    2 +-
 examples/fstab.m4          |    3 +-
 examples/patsubst.m4       |    2 +-
 gnulib                     |    2 +-
 {src => lib}/Makefile.am   |   20 ++--
 m4/gnulib-cache.m4         |    7 +-
 maint.mk                   |  225 --------------------------------------------
 src/Makefile.am            |    1 +
 src/builtin.c              |   61 +++++++-----
 src/debug.c                |    4 +-
 src/format.c               |   78 +++++++++++++++-
 src/freeze.c               |    6 +-
 src/input.c                |    6 +-
 src/m4.c                   |   42 +++++----
 src/m4.h                   |   14 ++-
 src/macro.c                |    3 +-
 src/output.c               |    8 +-
 src/path.c                 |    6 +-
 src/symtab.c               |    1 +
 {src => tests}/Makefile.am |   11 +--
 34 files changed, 342 insertions(+), 350 deletions(-)
 create mode 100644 .prev-version
 copy {src => lib}/Makefile.am (65%)
 delete mode 100644 maint.mk
 copy {src => tests}/Makefile.am (65%)

diff --git a/.cvsignore b/.cvsignore
index 89903ca..1e719de 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -28,3 +28,4 @@ stamp-h
 stamp-h1
 stamp-h.in
 tests
+maint.mk
diff --git a/.gitignore b/.gitignore
index b6e029c..7f5b72e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,13 +22,16 @@ gendocs.sh
 GNUmakefile
 gnupload
 /install-sh
-lib
+/lib/*
+!/lib/Makefile.am
 link-warning.h
 m4-*
+/maint.mk
 Makefile.in
 Makefile
 /missing
 stamp-h
 stamp-h1
 stamp-h.in
-tests
+/tests/*
+!/tests/Makefile.am
diff --git a/.prev-version b/.prev-version
new file mode 100644
index 0000000..acd81d7
--- /dev/null
+++ b/.prev-version
@@ -0,0 +1 @@
+1.4.13
diff --git a/BACKLOG b/BACKLOG
index 6cd9a92..557831f 100644
--- a/BACKLOG
+++ b/BACKLOG
@@ -7,7 +7,7 @@ rmail/announce
 
 rmail/changeword
  1. 02 Sep 94 <pinard> Re: Prerelease: GNU m4 1.2.3
- 2. 05 Sep 94 <address@hidden> Re: Prerelease: GNU m4 1.2.3 
+ 2. 05 Sep 94 <address@hidden> Re: Prerelease: GNU m4 1.2.3
 
 rmail/configuration
  1. 03 Nov 94 <address@hidden> Re: m4 1.3 on DEC OSF/1 3.0
@@ -37,7 +37,7 @@ rmail/floating-point
 13. 28 Oct 94 <address@hidden> Re: enhancement to m4 eval()
 
 rmail/format-rewrite
- 1. 25 Jun 94 <address@hidden> Re: Prerelease: GNU m4 1.1.3 
+ 1. 25 Jun 94 <address@hidden> Re: Prerelease: GNU m4 1.1.3
 
 rmail/named-formals
  1. 30 Sep 94 <address@hidden> m4 macros with named formal parameters
diff --git a/ChangeLog b/ChangeLog
index b22db9e..19cf20d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,82 @@
+2009-11-26  Eric Blake  <address@hidden>
+
+       Ignore write failures before stack overflow exit.
+       * m4/gnulib-cache.m4: Import ignore-value module.
+       * src/m4.c (fault_handler): Use it to avoid compiler warning.
+
+2009-11-25  Eric Blake  <address@hidden>
+
+       Allow use of compiler warnings.
+       * m4/gnulib-cache.m4: Import manywarnings module.
+       * configure.ac (WERROR_CFLAGS, WARN_CFLAGS): New variables.
+       * src/Makefile.am (AM_CFLAGS): Use them.
+       * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): Turn on warnings during
+       distcheck.
+       * src/m4.h (M4_GNUC_NORETURN): New macro.
+       (trace_post): Delete unused parameter.
+       * src/m4.c (usage): Mark as noreturn.
+       (main): Remove unused parameter.
+       * src/debug.c (trace_post): Likewise.
+       (trace_pre): Cover all enum values.
+       * src/symtab.c (lookup_symbol): Likewise.
+       * src/builtin.c (define_macro, m4_dumpdef): Likewise.
+       (m4_define, m4_undefine, m4_pushdef, m4_popdef, m4_sysval)
+       (m4_divert, m4_undivert, m4_dnl, m4_changequote, m4_changecom)
+       (m4_changeword, m4_syscmd, m4_include, m4_sinclude, m4_m4exit)
+       (m4_debugmode, m4_debugfile, m4_placeholder): Mark unused
+       parameters.
+       (mkstemp_helper): Use parameter.
+       (substitute): Avoid signed vs. unsigned comparison.
+       * src/format.c (arg_int, arg_long, arg_double): Likewise.
+       * src/input.c (next_token): Likewise.
+       * src/output.c (freeze_diversions): Likewise.
+       (m4_tmpname): Allow C++ compilation.
+       * src/freeze.c (produce_frozen_state, GET_NUMBER): Use correct
+       type.
+       * src/macro.c (call_macro): Cover all enum values.
+       (expand_macro): Update caller.
+       * src/path.c (m4_fopen): Remove unused parameter.
+       (m4_path_search): Update caller.
+
+       Silence syntax-check warnings.
+       * src/m4.h (STREQ): New macro.
+       * src/builtin.c (find_builtin_by_name): Use it.
+       * src/input.c (set_word_regexp): Likewise.
+       * src/m4.c (process_file): Likewise.
+       (main): Consistently spell warning, and mark output strings.
+       Avoid unsafe parsing functions.
+       (process_file): Mark output strings.
+       * src/output.c (make_diversion): Likewise.
+       * src/format.c (arg_int, arg_long, arg_double): New helpers.
+       (ARG_INT, ARG_LONG, ARG_DOUBLE): Use them to detect parse errors.
+       * BACKLOG: Avoid whitespace problems.
+       * TODO: Likewise.
+       * HACKING: Likewise.
+       * examples/esyscmd.m4: Likewise.
+       * examples/file.m4: Likewise.
+       * examples/fstab.m4: Likewise.
+       * examples/patsubst.m4: Likewise.
+
+       Use gnulib maintainer-makefile module.
+       * m4/gnulib-cache.m4: Import maintainer-makefile module.
+       * cfg.mk (local-checks-to-skip): Drop changelog-check; add
+       sc_cast_of_x_alloc_return_value.
+       (gnulib_dir, gnu_rel_host, url_dir_list): Delete; provided by
+       maint.mk.
+       (config_h_header, old_NEWS_hash): New macros.
+       * .prev-version: New file.
+       * maint.mk: Remove from version control; use gnulib instead.
+       * .gitignore: Update.
+       * HACKING: Update.
+
+       Update from gnulib.
+       * gnulib: Update.
+       * m4/gnulib-cache.m4: Use --makefile-name.
+       * lib/Makefile.am: Wrap the gnulib-generated file.
+       * tests/Makefile.am: Likewise.
+       * .gitignore: Track our wrappers.
+       * doc/m4.texinfo (Improved capitalize): Fix typo.
+
 2009-10-05  Eric Blake  <address@hidden>
 
        Update from gnulib.
diff --git a/HACKING b/HACKING
index 09a79df..8f5088f 100644
--- a/HACKING
+++ b/HACKING
@@ -255,9 +255,9 @@ yyyy-mm-dd  Name of Author  <address@hidden>  (tiny change)
 * Run `make maintainer-distcheck'.  If there are any problems, fix them,
   run `git tag -d v<version>' and start again from the `git commit' step.
 
-* Run `make <target> PREV_VERSION=maj.min[.mic[alpha]]', with target set
-  to `major', `alpha', or `beta' as appropriate.  This will run various
-  additional checks and create diff files from the previous version.
+* Run `make <target>', with target set to `stable', `alpha', or `beta'
+  as appropriate.  This will run various additional checks and create
+  diff files from the previous version.
 
 * Run './build-aux/gnupload --to [dest].gnu.org:m4 [files]' to create
   detached gpg signature and clear signed directive files, and upload
@@ -290,7 +290,7 @@ yyyy-mm-dd  Name of Author  <address@hidden>  (tiny change)
       co directory/m4.txt
   After making edits, mail the diff to <address@hidden>.
 
--- 
+
 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Free Software
 Foundation, Inc.
 
diff --git a/Makefile.am b/Makefile.am
index a579c86..875750f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,7 +34,8 @@ MAINTAINERCLEANFILES = INSTALL Makefile.in aclocal.m4 \
 ACLOCAL_AMFLAGS = -I m4
 ## Enough users install GNU M4 as gm4 that we make sure 'make installcheck'
 ## will handle that, prior to making a release.
-DISTCHECK_CONFIGURE_FLAGS = --enable-changeword --program-prefix=g
+DISTCHECK_CONFIGURE_FLAGS = --enable-changeword --program-prefix=g \
+       --enable-gcc-warnings
 
 BUILT_SOURCES = $(top_srcdir)/.version
 $(top_srcdir)/.version:
diff --git a/TODO b/TODO
index 81e1b89..d10dfaa 100644
--- a/TODO
+++ b/TODO
@@ -5,7 +5,7 @@ of these ideas, listed more or less in decreasing order of 
priority.
 
 * Features or problems
   - Fix format() builtin to handle %c more like printf(1) in the shell
-        http://lists.gnu.org/archive/html/bug-m4/2007-05/msg00047.html
+       http://lists.gnu.org/archive/html/bug-m4/2007-05/msg00047.html
     Also, gnulib needs help to overcome mingw bugs related to format().
   - Update documentation from accumulated mail about it
   - Study synclines at the very beginning of each diverted sequence
@@ -30,7 +30,7 @@ of these ideas, listed more or less in decreasing order of 
priority.
 
        GNU m4 is lousy regarding NULs in streams (this would require
        maintaining the string lengths, and avoiding strlen, strcpy,
-       etc.). 
+       etc.).
 
 Local Variables:
 mode: outline
diff --git a/build-aux/.cvsignore b/build-aux/.cvsignore
index 17512d0..16ef012 100644
--- a/build-aux/.cvsignore
+++ b/build-aux/.cvsignore
@@ -7,3 +7,4 @@ gnupload
 link-warning.h
 update-copyright
 vc-list-files
+useless-if-before-free
diff --git a/build-aux/.gitignore b/build-aux/.gitignore
index 7587f4b..e7a0cfc 100644
--- a/build-aux/.gitignore
+++ b/build-aux/.gitignore
@@ -7,3 +7,4 @@
 /link-warning.h
 /update-copyright
 /vc-list-files
+/useless-if-before-free
diff --git a/cfg.mk b/cfg.mk
index c63b953..00a9e56 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -15,31 +15,21 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Use alpha.gnu.org for alpha and beta releases.
-# Use ftp.gnu.org for major releases.
-gnu_ftp_host-alpha = alpha.gnu.org
-gnu_ftp_host-beta = alpha.gnu.org
-gnu_ftp_host-major = ftp.gnu.org
-gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE))
-
 # Used in maint.mk's web-manual rule
 manual_title = GNU macro processor
 
-url_dir_list = \
-  ftp://$(gnu_rel_host)/gnu/m4
-
 # The GnuPG ID of the key used to sign the tarballs.
 gpg_key_ID = F4850180
 
-# Tests not to run as part of "make distcheck".
-# Exclude changelog-check here so that there's less churn in ChangeLog
-# files -- otherwise, you'd need to have the upcoming version number
-# at the top of the file for each `make distcheck' run.
-local-checks-to-skip = changelog-check
-
-# The local directory containing the checked-out copy of gnulib used in this
-# release.  Used solely to get gnulib's SHA1 for the "announcement" target.
-gnulib_dir = $(srcdir)/gnulib
-
 # Always use longhand copyrights.
 update-copyright-env = UPDATE_COPYRIGHT_USE_INTERVALS=0
+
+# Tests not to run as part of "make syntax-check".
+# M4 intentionally uses a coding style that compiles under C++.
+local-checks-to-skip = sc_cast_of_x_alloc_return_value
+
+# Our files include "m4.h", which in turn includes <config.h> first.
+config_h_header = "m4\.h"
+
+# Hash of NEWS contents, to ensure we don't add entries to wrong section.
+old_NEWS_hash = 0330971054cd4fb4e94b85fe367980f2
diff --git a/configure.ac b/configure.ac
index 1a3acae..8697c8c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,6 +35,53 @@ M4_EARLY
 # M4 is single-threaded; so we can optimize gnulib code by using this:
 gl_DISABLE_THREADS
 
+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]
+)
+
+if test "$gl_gcc_warnings" = yes; then
+  gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
+  AC_SUBST([WERROR_CFLAGS])
+
+  nw=
+  nw="$nw -Waggregate-return"       # C90 is anachronistic
+  nw="$nw -Wlong-long"              # C90 is anachronistic
+  nw="$nw -Wundef"                  # Warns on '#if GNULIB_FOO' etc in gnulib
+  nw="$nw -Wtraditional"            # Warns on #elif which we use often
+  nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
+  nw="$nw -Wpadded"                 # Our structs are not packed
+  nw="$nw -Wredundant-decls"        # Gnulib has multiple decls
+  nw="$nw -Wformat-nonliteral"      # Needed in builtin.c
+  nw="$nw -Wunreachable-code"       # Needed in output.c
+  nw="$nw -Wconversion"             # Too many warnings for now
+  nw="$nw -Wsign-conversion"        # Too many warnings for now
+  nw="$nw -Wtraditional-conversion" # Too many warnings for now
+  nw="$nw -Wcast-qual"              # Too many warnings for now
+  nw="$nw -Wswitch-enum"            # Too many warnings for now
+  # This, $nw, is the list of warnings we disable.
+
+  gl_MANYWARN_ALL_GCC([ws])
+  gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
+  for w in $ws; do
+    gl_WARN_ADD([$w])
+  done
+
+  gl_WARN_ADD([-fdiagnostics-show-option])
+  gl_WARN_ADD([-funit-at-a-time])
+
+  AC_SUBST([WARN_CFLAGS])
+
+  AC_DEFINE([_FORTIFY_SOURCE], [2],
+    [enable compile-time and run-time bounds-checking, and some warnings])
+fi
+
 # Tandem/NSK is broken - it has 'long long int' but not
 # 'unsigned long long int', which confuses assumptions made by gnulib.
 # Simply pretend that neither type exists if both do not work.
diff --git a/doc/m4.texinfo b/doc/m4.texinfo
index 89a80a7..2cf86d4 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -8529,7 +8529,7 @@ string.  In turn, that means the replacement text has 
unbalanced quotes,
 necessitating another round of @code{changequote}.
 
 In the fixed version below, (also shipped as
address@hidden@value{VERSION}/@/examples/@/capitalize.m4}), @code{capitalize}
address@hidden@value{VERSION}/@/examples/@/capitalize2.m4}), @code{capitalize}
 uses the alternate quotes of @samp{<<[} and @samp{]>>} (the longer
 strings are chosen so as to be less likely to appear in the text being
 converted).  The helpers @code{_to_alt} and @code{_from_alt} merely
diff --git a/examples/esyscmd.m4 b/examples/esyscmd.m4
index b839148..0e8634d 100644
--- a/examples/esyscmd.m4
+++ b/examples/esyscmd.m4
@@ -1,5 +1,5 @@
 define(`hostname', esyscmd(`hostname'))dnl
 `hostname = >>'hostname`<<'
-define(`hostname', 
+define(`hostname',
 pushdef(`_tmp', `$1')_tmp(translit(esyscmd(`hostname'), `.', 
`,'))`'popdef(`_tmp'))dnl
 `hostname = >>'hostname`<<'
diff --git a/examples/file.m4 b/examples/file.m4
index e7db5f1..ff56153 100644
--- a/examples/file.m4
+++ b/examples/file.m4
@@ -1,5 +1,5 @@
 changequote([[,]])dnl
-define([[quoteall]], [[patsubst([[[[$*]]]], [[,[       ]+]], [[,]])]])dnl
+define([[quoteall]], [[patsubst([[[[$*]]]], [[,[        ]+]], [[,]])]])dnl
 define([[group]], quoteall(include([[/etc/group]])))dnl
 dnl
 group()dnl
diff --git a/examples/fstab.m4 b/examples/fstab.m4
index dbf538a..8d10e17 100644
--- a/examples/fstab.m4
+++ b/examples/fstab.m4
@@ -1,7 +1,6 @@
-define(`concat', `translit(``$*'', `   ')')
+define(`concat', `translit(``$*'', `    ')')
 define(`fsent', `format(`%-25s %-16s nfs    %-16s 0 0', `$1:$2', `$3', 
concat$4)')
 
 fsent(freja, /home/gevn, /home/gevn, (rw, soft, bg, grpid))
 fsent(freja, /home/freja, /home/freja, (rw, soft, grpid))
 fsent(rimfaxe, /home/rimfaxe, /home/rimfaxe, (rw, soft, bg))
-
diff --git a/examples/patsubst.m4 b/examples/patsubst.m4
index 3b390ae..8569066 100644
--- a/examples/patsubst.m4
+++ b/examples/patsubst.m4
@@ -5,4 +5,4 @@ patsubst(`GNUs not Unix', `\<\w', `\0=')
 patsubst(`GNUs not Unix', `\w*', `(\0)')
 patsubst(`GNUs not Unix', `\w+', `(\0)')
 patsubst(`GNUs not Unix', `\w+')
-patsubst(`GNUs  not     Unix', `[      ]+', ` ')
+patsubst(`GNUs  not  '`         Unix', `[       ]+', ` ')
diff --git a/gnulib b/gnulib
index c844d0c..23cd741 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit c844d0cacce3176e8ca09d890bfb21a77819243b
+Subproject commit 23cd74133c81b80d335c701848b71d85a53402c6
diff --git a/src/Makefile.am b/lib/Makefile.am
similarity index 65%
copy from src/Makefile.am
copy to lib/Makefile.am
index 58a5ac6..eb04128 100644
--- a/src/Makefile.am
+++ b/lib/Makefile.am
@@ -1,6 +1,6 @@
 ## Makefile.am - template for generating Makefile via Automake
 ##
-## Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+## Copyright (C) 2009 Free Software Foundation, Inc.
 ##
 ## This file is part of GNU M4.
 ##
@@ -16,12 +16,14 @@
 ##
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
-##
-## This file written by Eric Blake <address@hidden>
 
-AUTOMAKE_OPTIONS = nostdinc
-AM_CPPFLAGS = -I$(top_srcdir)/lib -I../lib
-bin_PROGRAMS = m4
-m4_SOURCES = m4.h m4.c builtin.c debug.c eval.c format.c freeze.c input.c \
-macro.c output.c path.c symtab.c
-m4_LDADD = ../lib/libm4.a $(LIBM4_LIBDEPS) $(POW_LIB) $(LIBCSTACK)
+BUILT_SOURCES =
+CLEANFILES =
+EXTRA_DIST =
+MOSTLYCLEANDIRS =
+MOSTLYCLEANFILES =
+SUFFIXES =
+
+noinst_LIBRARIES = libm4.a
+
+include gnulib.mk
diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4
index a2dade3..2440df0 100644
--- a/m4/gnulib-cache.m4
+++ b/m4/gnulib-cache.m4
@@ -15,7 +15,7 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --local-dir=local --lib=libm4 
--source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests 
--aux-dir=build-aux --with-tests --avoid=lock-tests --avoid=tls-tests 
--no-libtool --macro-prefix=M4 announce-gen assert autobuild avltree-oset 
binary-io c-stack clean-temp cloexec close-stream closein config-h dirname 
error execute fdl-1.3 fflush filenamecat fopen fopen-safer fseeko gendocs 
getopt-gnu git-version-gen gnu-web-doc-update gnumakefile gnupload gpl-3.0 
intprops memchr2 mkstemp obstack pipe progname regex sigaction stdbool stdint 
stdlib-safer strsignal strstr strtod strtol unlocked-io update-copyright 
vc-list-files verror version-etc version-etc-fsf wait-process xalloc xprintf 
xvasprintf-posix
+#   gnulib-tool --import --dir=. --local-dir=local --lib=libm4 
--source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests 
--aux-dir=build-aux --with-tests --avoid=lock-tests --avoid=tls-tests 
--makefile-name=gnulib.mk --no-libtool --macro-prefix=M4 announce-gen assert 
autobuild avltree-oset binary-io c-stack clean-temp cloexec close-stream 
closein config-h dirname error execute fdl-1.3 fflush filenamecat fopen 
fopen-safer fseeko gendocs getopt-gnu git-version-gen gnu-web-doc-update 
gnumakefile gnupload gpl-3.0 ignore-value intprops maintainer-makefile 
manywarnings memchr2 mkstemp obstack pipe progname regex sigaction stdbool 
stdint stdlib-safer strsignal strstr strtod strtol unlocked-io update-copyright 
vc-list-files verror version-etc version-etc-fsf wait-process xalloc xprintf 
xvasprintf-posix
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([local])
@@ -47,7 +47,10 @@ gl_MODULES([
   gnumakefile
   gnupload
   gpl-3.0
+  ignore-value
   intprops
+  maintainer-makefile
+  manywarnings
   memchr2
   mkstemp
   obstack
@@ -81,6 +84,6 @@ gl_DOC_BASE([doc])
 gl_TESTS_BASE([tests])
 gl_WITH_TESTS
 gl_LIB([libm4])
-gl_MAKEFILE_NAME([])
+gl_MAKEFILE_NAME([gnulib.mk])
 gl_MACRO_PREFIX([M4])
 gl_PO_DOMAIN([])
diff --git a/maint.mk b/maint.mk
deleted file mode 100644
index a50c727..0000000
--- a/maint.mk
+++ /dev/null
@@ -1,225 +0,0 @@
-## maint.mk -- Makefile rules for m4 maintainers -*-Makefile-*-
-##
-## Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Free Software
-## Foundation, Inc.
-##
-## This file is part of GNU M4.
-##
-## GNU M4 is free software: you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## GNU M4 is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# This is reported not to work with make-3.79.1
-# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
-ME := maint.mk
-
-# Override this in cfg.mk if you use a non-standard build-aux directory.
-build_aux ?= $(srcdir)/build-aux
-
-# Do not save the original name or timestamp in the .tar.gz file.
-# Use --rsyncable if available.
-gzip_rsyncable := \
-  $(shell gzip --help 2>/dev/null|grep rsyncable >/dev/null && echo 
--rsyncable)
-GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
-
-GIT = git
-VC = $(GIT)
-VC-tag = git tag -s -m '$(VERSION)' -u $(gpg_key_ID)
-
-VC_LIST = $(build_aux)/vc-list-files -C $(srcdir)
-
-VC_LIST_EXCEPT = \
-  $(VC_LIST) | if test -f $(srcdir)/.x-$@; then grep -vEf $(srcdir)/.x-$@; 
else grep -v ChangeLog; fi
-
-VERSION_REGEXP = $(subst .,\.,$(VERSION))
-my_distdir = $(PACKAGE)-$(VERSION)
-
-# Ensure that we use only the standard $(VAR) notation,
-# not @...@ in Makefile.am, now that we can rely on automake
-# to emit a definition for each substituted variable.
-makefile-check:
-       grep -nE '@[A-Z_0-9]+@' `find $(srcdir) -name Makefile.am` \
-         && { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || :
-
-news-date-check: NEWS version-check
-       today=`date +%Y-%m-%d`;                                         \
-       if head $(srcdir)/NEWS | grep '^\*.* $(VERSION_REGEXP) ('$$today')' \
-           >/dev/null; then                                            \
-         :;                                                            \
-       else                                                            \
-         echo "version or today's date is not in NEWS" 1>&2;           \
-         exit 1;                                                       \
-       fi
-
-changelog-check:
-       if head $(srcdir)/ChangeLog | grep 'Version $(VERSION_REGEXP)\.$$' \
-           >/dev/null; then                                            \
-         :;                                                            \
-       else                                                            \
-         echo "$(VERSION) not in ChangeLog" 1>&2;                      \
-         exit 1;                                                       \
-       fi
-
-m4-check:
-       @grep -n 'AC_DEFUN([^[]' $(srcdir)/m4/*.m4 \
-         && { echo '$(ME): quote the first arg to AC_DEFUN' 1>&2; \
-              exit 1; } || :
-
-vc-diff-check:
-       (CDPATH=; cd $(srcdir) && $(VC) diff) > vc-diffs || :
-       if test -s vc-diffs; then                               \
-         cat vc-diffs;                                         \
-         echo "Some files are locally modified:" 1>&2;         \
-         exit 1;                                               \
-       else                                                    \
-         rm vc-diffs;                                          \
-       fi
-
-maintainer-distcheck:
-       $(MAKE) distcheck
-       $(MAKE) my-distcheck
-
-# Don't make a distribution if checks fail.
-# Also, make sure the NEWS file is up-to-date.
-vc-dist: $(local-check) vc-diff-check maintainer-distcheck
-       $(MAKE) dist
-
-# Use this to make sure we don't run these programs when building
-# from a virgin tgz file, below.
-null_AM_MAKEFLAGS = \
-  ACLOCAL=false \
-  AUTOCONF=false \
-  AUTOMAKE=false \
-  AUTOHEADER=false \
-  MAKEINFO=false
-
-# Use -Wformat -Werror to detect format-string/arg-list mismatches.
-# Also, check for shadowing problems with -Wshadow, and for pointer
-# arithmetic problems with -Wpointer-arith.
-# These CFLAGS are pretty strict.  If you build this target, you probably
-# have to have a recent version of gcc and glibc headers.
-TMPDIR ?= /tmp
-t=$(TMPDIR)/$(PACKAGE)/test
-my-distcheck: $(local-check) check
-       -rm -rf $(t)
-       mkdir -p $(t)
-       GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
-       cd $(t)/$(distdir)                              \
-         && ./configure                                \
-         && $(MAKE) CFLAGS='$(warn_cflags)'            \
-             AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)'       \
-         && $(MAKE) dvi                                \
-         && $(MAKE) check                              \
-         && $(MAKE) distclean
-       (cd $(t) && mv $(distdir) $(distdir).old        \
-         && $(AMTAR) -zxf - ) < $(distdir).tar.gz
-       diff -ur $(t)/$(distdir).old $(t)/$(distdir)
-       -rm -rf $(t)
-       @echo "========================"; \
-       echo "$(distdir).tar.gz is ready for distribution"; \
-       echo "========================"
-
-gnulib-version = $$(cd $(gnulib_dir) && git describe)
-
-announcement: NEWS ChangeLog $(rel-files)
-       @$(srcdir)/build-aux/announce-gen                               \
-           --release-type=$(RELEASE_TYPE)                              \
-           --package=$(PACKAGE)                                        \
-           --prev=$(PREV_VERSION)                                      \
-           --curr=$(VERSION)                                           \
-           --gpg-key-id=$(gpg_key_ID)                                  \
-           --news=$(srcdir)/NEWS                                       \
-           --bootstrap-tools=autoconf,automake,gnulib                  \
-           --gnulib-version=$(gnulib-version)                          \
-           $(addprefix --url-dir=, $(url_dir_list))
-
-.PHONY: alpha beta major
-alpha beta major: $(local-check) version-check
-       test $@ = major                                         \
-         && { echo $(VERSION) | grep -E '^[0-9]+(\.[0-9]+)+$$' \
-              || { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\
-         || :
-       $(MAKE) vc-dist
-       $(MAKE) news-date-check changelog-check
-       $(MAKE) deltas
-       $(MAKE) -s announcement RELEASE_TYPE=$@ > /tmp/announce-$(my_distdir)
-
-.PHONY: version-check
-version-check:
-       @case $(VERSION) in \
-       *[acegikmoqsuwy]) \
-         echo "Version \`$(VERSION)' is not a releasable version, please 
read:"; \
-         echo "    http://www.gnu.org/software/libtool/contribute.html";; \
-         exit 1; \
-         ;; \
-       esac
-       @if test -z "$(PREV_VERSION)"; \
-               then echo "PREV_VERSION is not set"; exit 1; fi
-
-.PHONY: prev-tarball
-prev-tarball: version-check
-## Make sure we have the previous release tarball in the tree.
-       @ofile="$(PACKAGE)-$(PREV_VERSION).tar.gz"; \
-       if test -f $$ofile; then :; \
-       else echo "Cannot make deltas without $$ofile"; exit 1; fi
-
-.PHONY: new-tarball
-new-tarball:
-## Make sure we have the new release tarball in the tree.
-       @ofile="$(PACKAGE)-$(VERSION).tar.gz"; \
-       if test -f $$ofile; then :; \
-       else echo "Cannot make deltas without $$ofile"; exit 1; fi
-
-.PHONY: deltas
-deltas: delta-diff
-
-DIFF = diff
-DIFF_OPTIONS = -ruNp
-
-.PHONY: delta-diff
-delta-diff: prev-tarball new-tarball
-## Unpack the tarballs somewhere to diff them
-       rm -rf delta-diff
-       mkdir delta-diff
-       ofile="../$(PACKAGE)-$(PREV_VERSION)-$(VERSION).diff.gz"; \
-       cd delta-diff \
-       && tar xzf "../$(PACKAGE)-$(PREV_VERSION).tar.gz" \
-       && tar xzf "../$(PACKAGE)-$(VERSION).tar.gz" \
-       && $(DIFF) $(DIFF_OPTIONS) \
-               $(PACKAGE)-$(PREV_VERSION) $(PACKAGE)-$(VERSION) \
-               | GZIP=$(GZIP_ENV) gzip -c > $$ofile
-       rm -rf delta-diff
-
-.PHONY: web-manual
-web-manual:
-       @cd '$(srcdir)/doc' ; \
-         $(SHELL) ../build-aux/gendocs.sh -o '$(abs_builddir)/doc/manual' \
-           --email $(PACKAGE_BUGREPORT) $(PACKAGE) \
-           "$(PACKAGE_NAME) - $(manual_title)"
-       @echo " *** Upload the doc/manual directory to web-cvs."
-
-# If you want to set UPDATE_COPYRIGHT_* environment variables,
-# put the assignments in this variable.
-update-copyright-env ?=
-
-# Run this rule once per year (usually early in January)
-# to update all FSF copyright year lists in your project.
-# If you have an additional project-specific rule,
-# add it in cfg.mk along with a line 'update-copyright: prereq'.
-# By default, exclude all variants of COPYING; you can also
-# add exemptions (such as ChangeLog..* for rotated change logs)
-# in the file .x-update-copyright.
-.PHONY: update-copyright
-update-copyright:
-       grep -l -w Copyright $$($(VC_LIST_EXCEPT))              \
-               $(srcdir)/ChangeLog | grep -v COPYING           \
-         | $(update-copyright-env) xargs $(build_aux)/$@
diff --git a/src/Makefile.am b/src/Makefile.am
index 58a5ac6..bdf52de 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,6 +21,7 @@
 
 AUTOMAKE_OPTIONS = nostdinc
 AM_CPPFLAGS = -I$(top_srcdir)/lib -I../lib
+AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
 bin_PROGRAMS = m4
 m4_SOURCES = m4.h m4.c builtin.c debug.c eval.c format.c freeze.c input.c \
 macro.c output.c path.c symtab.c
diff --git a/src/builtin.c b/src/builtin.c
index 5a097f3..3dcca8a 100644
--- a/src/builtin.c
+++ b/src/builtin.c
@@ -197,7 +197,7 @@ find_builtin_by_name (const char *name)
   const builtin *bp;
 
   for (bp = &builtin_tab[0]; bp->name != NULL; bp++)
-    if (strcmp (bp->name, name) == 0)
+    if (STREQ (bp->name, name))
       return bp;
   return bp + 1;
 }
@@ -576,6 +576,7 @@ define_macro (int argc, token_data **argv, symbol_lookup 
mode)
        define_builtin (ARG (1), bp, mode);
       break;
 
+    case TOKEN_VOID:
     default:
       M4ERROR ((warning_status, 0,
                "INTERNAL ERROR: bad token data type in define_macro ()"));
@@ -584,13 +585,13 @@ define_macro (int argc, token_data **argv, symbol_lookup 
mode)
 }
 
 static void
-m4_define (struct obstack *obs, int argc, token_data **argv)
+m4_define (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
 {
   define_macro (argc, argv, SYMBOL_INSERT);
 }
 
 static void
-m4_undefine (struct obstack *obs, int argc, token_data **argv)
+m4_undefine (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
 {
   int i;
   if (bad_argc (argv[0], argc, 2, -1))
@@ -600,13 +601,13 @@ m4_undefine (struct obstack *obs, int argc, token_data 
**argv)
 }
 
 static void
-m4_pushdef (struct obstack *obs, int argc, token_data **argv)
+m4_pushdef (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
 {
   define_macro (argc, argv,  SYMBOL_PUSHDEF);
 }
 
 static void
-m4_popdef (struct obstack *obs, int argc, token_data **argv)
+m4_popdef (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
 {
   int i;
   if (bad_argc (argv[0], argc, 2, -1))
@@ -786,6 +787,7 @@ INTERNAL ERROR: builtin not found in builtin table"));
          DEBUG_PRINT1 ("<%s>\n", bp->name);
          break;
 
+       case TOKEN_VOID:
        default:
          M4ERROR ((warning_status, 0,
                    "INTERNAL ERROR: bad token data type in m4_dumpdef ()"));
@@ -941,7 +943,7 @@ builtin `%s' requested by frozen file is not supported", 
ARG (i)));
 static int sysval;
 
 static void
-m4_syscmd (struct obstack *obs, int argc, token_data **argv)
+m4_syscmd (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
 {
   const char *cmd = ARG (1);
   int status;
@@ -1059,7 +1061,8 @@ m4_esyscmd (struct obstack *obs, int argc, token_data 
**argv)
 }
 
 static void
-m4_sysval (struct obstack *obs, int argc, token_data **argv)
+m4_sysval (struct obstack *obs, int argc M4_GNUC_UNUSED,
+          token_data **argv M4_GNUC_UNUSED)
 {
   shipout_int (obs, sysval);
 }
@@ -1172,7 +1175,7 @@ m4_decr (struct obstack *obs, int argc, token_data **argv)
 `-----------------------------------------------------------------------*/
 
 static void
-m4_divert (struct obstack *obs, int argc, token_data **argv)
+m4_divert (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
 {
   int i = 0;
 
@@ -1205,7 +1208,7 @@ m4_divnum (struct obstack *obs, int argc, token_data 
**argv)
 `-----------------------------------------------------------------------*/
 
 static void
-m4_undivert (struct obstack *obs, int argc, token_data **argv)
+m4_undivert (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
 {
   int i, file;
   FILE *fp;
@@ -1249,7 +1252,7 @@ m4_undivert (struct obstack *obs, int argc, token_data 
**argv)
 `------------------------------------------------------------------------*/
 
 static void
-m4_dnl (struct obstack *obs, int argc, token_data **argv)
+m4_dnl (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
 {
   if (bad_argc (argv[0], argc, 1, 1))
     return;
@@ -1275,7 +1278,8 @@ m4_shift (struct obstack *obs, int argc, token_data 
**argv)
 `--------------------------------------------------------------------------*/
 
 static void
-m4_changequote (struct obstack *obs, int argc, token_data **argv)
+m4_changequote (struct obstack *obs M4_GNUC_UNUSED, int argc,
+               token_data **argv)
 {
   if (bad_argc (argv[0], argc, 1, 3))
     return;
@@ -1291,7 +1295,7 @@ m4_changequote (struct obstack *obs, int argc, token_data 
**argv)
 `--------------------------------------------------------------------*/
 
 static void
-m4_changecom (struct obstack *obs, int argc, token_data **argv)
+m4_changecom (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
 {
   if (bad_argc (argv[0], argc, 1, 3))
     return;
@@ -1309,7 +1313,7 @@ m4_changecom (struct obstack *obs, int argc, token_data 
**argv)
 `-----------------------------------------------------------------------*/
 
 static void
-m4_changeword (struct obstack *obs, int argc, token_data **argv)
+m4_changeword (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
 {
   if (bad_argc (argv[0], argc, 2, 2))
     return;
@@ -1357,7 +1361,7 @@ include (int argc, token_data **argv, bool silent)
 `------------------------------------------------*/
 
 static void
-m4_include (struct obstack *obs, int argc, token_data **argv)
+m4_include (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
 {
   include (argc, argv, false);
 }
@@ -1367,7 +1371,7 @@ m4_include (struct obstack *obs, int argc, token_data 
**argv)
 `----------------------------------*/
 
 static void
-m4_sinclude (struct obstack *obs, int argc, token_data **argv)
+m4_sinclude (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
 {
   include (argc, argv, true);
 }
@@ -1387,7 +1391,7 @@ mkstemp_helper (struct obstack *obs, const char *me, 
const char *pattern,
                size_t len)
 {
   int fd;
-  int i;
+  size_t i;
   char *name;
 
   /* Guarantee that there are six trailing 'X' characters, even if the
@@ -1405,7 +1409,7 @@ mkstemp_helper (struct obstack *obs, const char *me, 
const char *pattern,
   fd = mkstemp (name);
   if (fd < 0)
     {
-      M4ERROR ((0, errno, "cannot create tempfile `%s'", pattern));
+      M4ERROR ((0, errno, "%s: cannot create tempfile `%s'", me, pattern));
       obstack_free (obs, obstack_finish (obs));
     }
   else
@@ -1521,8 +1525,8 @@ m4___program__ (struct obstack *obs, int argc, token_data 
**argv)
 | arguments are present.                                                  |
 `-------------------------------------------------------------------------*/
 
-static void
-m4_m4exit (struct obstack *obs, int argc, token_data **argv)
+static void M4_GNUC_NORETURN
+m4_m4exit (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
 {
   int exit_code = EXIT_SUCCESS;
 
@@ -1609,7 +1613,7 @@ m4_traceon (struct obstack *obs, int argc, token_data 
**argv)
 `------------------------------------------------------------------------*/
 
 static void
-m4_traceoff (struct obstack *obs, int argc, token_data **argv)
+m4_traceoff (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
 {
   symbol *s;
   int i;
@@ -1632,7 +1636,7 @@ m4_traceoff (struct obstack *obs, int argc, token_data 
**argv)
 `----------------------------------------------------------------------*/
 
 static void
-m4_debugmode (struct obstack *obs, int argc, token_data **argv)
+m4_debugmode (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
 {
   int new_debug_level;
   int change_flag;
@@ -1673,6 +1677,11 @@ m4_debugmode (struct obstack *obs, int argc, token_data 
**argv)
            case '-':
              debug_level &= ~new_debug_level;
              break;
+
+           default:
+             M4ERROR ((warning_status, 0,
+                       "INTERNAL ERROR: bad flag in m4_debugmode ()"));
+             abort ();
            }
        }
     }
@@ -1684,7 +1693,7 @@ m4_debugmode (struct obstack *obs, int argc, token_data 
**argv)
 `-------------------------------------------------------------------------*/
 
 static void
-m4_debugfile (struct obstack *obs, int argc, token_data **argv)
+m4_debugfile (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv)
 {
   if (bad_argc (argv[0], argc, 1, 2))
     return;
@@ -1940,6 +1949,7 @@ substitute (struct obstack *obs, const char *victim, 
const char *repl,
            struct re_registers *regs)
 {
   int ch;
+  __re_size_t ind;
   while (1)
     {
       const char *backslash = strchr (repl, '\\');
@@ -1970,8 +1980,8 @@ Warning: \\0 will disappear, use \\& instead in 
replacements"));
 
        case '1': case '2': case '3': case '4': case '5': case '6':
        case '7': case '8': case '9':
-         ch -= '0';
-         if (regs->num_regs - 1 <= ch)
+         ind = ch -= '0';
+         if (regs->num_regs - 1 <= ind)
            M4ERROR ((warning_status, 0,
                      "Warning: sub-expression %d not present", ch));
          else if (regs->end[ch] > 0)
@@ -2175,7 +2185,8 @@ m4_patsubst (struct obstack *obs, int argc, token_data 
**argv)
 `--------------------------------------------------------------------*/
 
 void
-m4_placeholder (struct obstack *obs, int argc, token_data **argv)
+m4_placeholder (struct obstack *obs M4_GNUC_UNUSED, int argc,
+               token_data **argv)
 {
   M4ERROR ((warning_status, 0, "\
 builtin `%s' requested by frozen file is not supported", ARG (0)));
diff --git a/src/debug.c b/src/debug.c
index 0c9ee37..c13786c 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -405,6 +405,7 @@ INTERNAL ERROR: builtin not found in builtin table! 
(trace_pre ())"));
              trace_format ("<%s>", bp->name);
              break;
 
+           case TOKEN_VOID:
            default:
              M4ERROR ((warning_status, 0,
                        "INTERNAL ERROR: bad token data type (trace_pre ())"));
@@ -428,8 +429,7 @@ INTERNAL ERROR: builtin not found in builtin table! 
(trace_pre ())"));
 `-------------------------------------------------------------------*/
 
 void
-trace_post (const char *name, int id, int argc, token_data **argv,
-           const char *expanded)
+trace_post (const char *name, int id, int argc, const char *expanded)
 {
   if (debug_level & DEBUG_TRACE_CALL)
     {
diff --git a/src/format.c b/src/format.c
index a0519a0..d38f2d4 100644
--- a/src/format.c
+++ b/src/format.c
@@ -27,13 +27,85 @@
 /* Simple varargs substitute.  We assume int and unsigned int are the
    same size; likewise for long and unsigned long.  */
 
+/* Parse STR as an integer, reporting warnings.  */
+static int
+arg_int (const char *str)
+{
+  char *endp;
+  long value;
+  size_t len = strlen (str);
+
+  if (!len)
+    {
+      M4ERROR ((warning_status, 0, _("empty string treated as 0")));
+      return 0;
+    }
+  errno = 0;
+  value = strtol (str, &endp, 10);
+  if (endp - str - len)
+    M4ERROR ((warning_status, 0, _("non-numeric argument %s"), str));
+  else if (isspace (to_uchar (*str)))
+    M4ERROR ((warning_status, 0, _("leading whitespace ignored")));
+  else if (errno == ERANGE || (int) value != value)
+    M4ERROR ((warning_status, 0, _("numeric overflow detected")));
+  return value;
+}
+
+/* Parse STR as a long, reporting warnings.  */
+static long
+arg_long (const char *str)
+{
+  char *endp;
+  long value;
+  size_t len = strlen (str);
+
+  if (!len)
+    {
+      M4ERROR ((warning_status, 0, _("empty string treated as 0")));
+      return 0L;
+    }
+  errno = 0;
+  value = strtol (str, &endp, 10);
+  if (endp - str - len)
+    M4ERROR ((warning_status, 0, _("non-numeric argument %s"), str));
+  else if (isspace (to_uchar (*str)))
+    M4ERROR ((warning_status, 0, _("leading whitespace ignored")));
+  else if (errno == ERANGE)
+    M4ERROR ((warning_status, 0, _("numeric overflow detected")));
+  return value;
+}
+
+/* Parse STR as a double, reporting warnings.  */
+static double
+arg_double (const char *str)
+{
+  char *endp;
+  double value;
+  size_t len = strlen (str);
+
+  if (!len)
+    {
+      M4ERROR ((warning_status, 0, _("empty string treated as 0")));
+      return 0.0;
+    }
+  errno = 0;
+  value = strtod (str, &endp);
+  if (endp - str - len)
+    M4ERROR ((warning_status, 0, _("non-numeric argument %s"), str));
+  else if (isspace (to_uchar (*str)))
+    M4ERROR ((warning_status, 0, _("leading whitespace ignored")));
+  else if (errno == ERANGE)
+    M4ERROR ((warning_status, 0, _("numeric overflow detected")));
+  return value;
+}
+
 #define ARG_INT(argc, argv) \
        ((argc == 0) ? 0 : \
-        (--argc, argv++, atoi (TOKEN_DATA_TEXT (argv[-1]))))
+        (--argc, argv++, arg_int (TOKEN_DATA_TEXT (argv[-1]))))
 
 #define ARG_LONG(argc, argv) \
        ((argc == 0) ? 0 : \
-        (--argc, argv++, atol (TOKEN_DATA_TEXT (argv[-1]))))
+        (--argc, argv++, arg_long (TOKEN_DATA_TEXT (argv[-1]))))
 
 #define ARG_STR(argc, argv) \
        ((argc == 0) ? "" : \
@@ -41,7 +113,7 @@
 
 #define ARG_DOUBLE(argc, argv) \
        ((argc == 0) ? 0 : \
-        (--argc, argv++, strtod (TOKEN_DATA_TEXT (argv[-1]), NULL)))
+        (--argc, argv++, arg_double (TOKEN_DATA_TEXT (argv[-1]))))
 
 
 /*------------------------------------------------------------------.
diff --git a/src/freeze.c b/src/freeze.c
index 041bed4..518f1cb 100644
--- a/src/freeze.c
+++ b/src/freeze.c
@@ -52,7 +52,7 @@ void
 produce_frozen_state (const char *name)
 {
   FILE *file;
-  int h;
+  size_t h;
   symbol *sym;
   const builtin *bp;
 
@@ -207,12 +207,12 @@ reload_frozen_state (const char *name)
   do                                                           \
     {                                                          \
       unsigned int n = 0;                                      \
-      while (isdigit (character) && n <= INT_MAX / 10)         \
+      while (isdigit (character) && n <= INT_MAX / 10U)                \
        {                                                       \
          n = 10 * n + character - '0';                         \
          GET_CHARACTER;                                        \
        }                                                       \
-      if (((AllowNeg) ? INT_MIN : INT_MAX) < n                 \
+      if (((AllowNeg) ? INT_MIN : INT_MAX) + 0U < n            \
          || isdigit (character))                               \
        m4_error (EXIT_FAILURE, 0,                              \
                  _("integer overflow in frozen file"));        \
diff --git a/src/input.c b/src/input.c
index 63480be..740df78 100644
--- a/src/input.c
+++ b/src/input.c
@@ -767,7 +767,7 @@ set_word_regexp (const char *regexp)
   const char *msg;
   struct re_pattern_buffer new_word_regexp;
 
-  if (!*regexp || !strcmp (regexp, DEFAULT_WORD_REGEXP))
+  if (!*regexp || STREQ (regexp, DEFAULT_WORD_REGEXP))
     {
       default_word_regexp = true;
       return;
@@ -913,8 +913,8 @@ next_token (token_data *td, int *line)
                                (char *) obstack_base (&token_stack),
                                obstack_object_size (&token_stack), 0, 0,
                                &regs);
-         if (startpos != 0 ||
-             regs.end [0] != obstack_object_size (&token_stack))
+         if (startpos ||
+             regs.end [0] != (regoff_t) obstack_object_size (&token_stack))
            {
              *(((char *) obstack_base (&token_stack)
                 + obstack_object_size (&token_stack)) - 1) = '\0';
diff --git a/src/m4.c b/src/m4.c
index 914655a..496b6e0 100644
--- a/src/m4.c
+++ b/src/m4.c
@@ -26,6 +26,7 @@
 #include <signal.h>
 
 #include "c-stack.h"
+#include "ignore-value.h"
 #include "progname.h"
 #include "version-etc.h"
 
@@ -35,7 +36,7 @@
 
 #define AUTHORS "Rene' Seindal"
 
-static void usage (int);
+static void usage (int) M4_GNUC_NORETURN;
 
 /* Enable sync output for /lib/cpp (-s).  */
 int sync_output = 0;
@@ -147,18 +148,21 @@ fault_handler (int signo)
         async-safe.  However, the static variables that we read are
         never modified once this handler is installed, so this
         particular usage is safe.  And it seems an oversight that
-        POSIX claims strlen is not async-safe.  */
-      write (STDERR_FILENO, program_name, strlen (program_name));
-      write (STDERR_FILENO, ": ", 2);
-      write (STDERR_FILENO, program_error_message,
+        POSIX claims strlen is not async-safe.  Ignore write
+        failures, since we will exit with non-zero status anyway.  */
+#define WRITE(f, b, l) ignore_value (write (f, b, l))
+      WRITE (STDERR_FILENO, program_name, strlen (program_name));
+      WRITE (STDERR_FILENO, ": ", 2);
+      WRITE (STDERR_FILENO, program_error_message,
             strlen (program_error_message));
       if (signal_message[signo])
        {
-         write (STDERR_FILENO, ": ", 2);
-         write (STDERR_FILENO, signal_message[signo],
+         WRITE (STDERR_FILENO, ": ", 2);
+         WRITE (STDERR_FILENO, signal_message[signo],
                 strlen (signal_message[signo]));
        }
-      write (STDERR_FILENO, "\n", 1);
+      WRITE (STDERR_FILENO, "\n", 1);
+#undef WRITE
       _exit (EXIT_INTERNAL_ERROR);
     }
 }
@@ -319,7 +323,7 @@ static const struct option long_options[] =
 static void
 process_file (const char *name)
 {
-  if (strcmp (name, "-") == 0)
+  if (STREQ (name, "-"))
     {
       /* If stdin is a terminal, we want to allow 'm4 - file -'
         to read input from stdin twice, like GNU cat.  Besides,
@@ -333,7 +337,7 @@ process_file (const char *name)
       FILE *fp = m4_path_search (name, &full_name);
       if (fp == NULL)
        {
-         error (0, errno, "cannot open `%s'", name);
+         error (0, errno, _("cannot open `%s'"), name);
          /* Set the status to EXIT_FAILURE, even though we
             continue to process files after a missing file.  */
          retcode = EXIT_FAILURE;
@@ -357,7 +361,7 @@ process_file (const char *name)
 #endif
 
 int
-main (int argc, char *const *argv, char *const *envp)
+main (int argc, char *const *argv)
 {
   struct sigaction act;
   macro_definition *head;      /* head of deferred argument list */
@@ -416,7 +420,7 @@ main (int argc, char *const *argv, char *const *envp)
     char *crash = getenv ("M4_CRASH");
     if (crash)
       {
-       if (!atoi (crash))
+       if (!strtol (crash, NULL, 10))
          ++*(int *) 8;
        assert (false);
        abort ();
@@ -440,14 +444,14 @@ main (int argc, char *const *argv, char *const *envp)
        /* Compatibility junk: options that other implementations
           support, but which we ignore as no-ops and don't list in
           --help.  */
-       error (0, 0, "Warning: `m4 -%c' may be removed in a future release",
+       error (0, 0, _("warning: `m4 -%c' may be removed in a future release"),
               optchar);
        break;
 
       case 'N':
       case DIVERSIONS_OPTION:
        /* -N became an obsolete no-op in 1.4.x.  */
-       error (0, 0, "Warning: `m4 %s' is deprecated",
+       error (0, 0, _("warning: `m4 %s' is deprecated"),
               optchar == 'N' ? "-N" : "--diversions");
        break;
 
@@ -488,7 +492,7 @@ main (int argc, char *const *argv, char *const *envp)
        break;
 
       case 'H':
-       hash_table_size = atol (optarg);
+       hash_table_size = strtol (optarg, NULL, 10);
        if (hash_table_size == 0)
          hash_table_size = HASHMAX;
        break;
@@ -498,7 +502,7 @@ main (int argc, char *const *argv, char *const *envp)
        break;
 
       case 'L':
-       nesting_limit = atoi (optarg);
+       nesting_limit = strtol (optarg, NULL, 10);
        break;
 
       case 'P':
@@ -523,13 +527,13 @@ main (int argc, char *const *argv, char *const *envp)
        debug_level = debug_decode (optarg);
        if (debug_level < 0)
          {
-           error (0, 0, "bad debug flags: `%s'", optarg);
+           error (0, 0, _("bad debug flags: `%s'"), optarg);
            debug_level = 0;
          }
        break;
 
       case 'e':
-       error (0, 0, "Warning: `m4 -e' is deprecated, use `-i' instead");
+       error (0, 0, _("warning: `m4 -e' is deprecated, use `-i' instead"));
        /* fall through */
       case 'i':
        interactive = true;
@@ -540,7 +544,7 @@ main (int argc, char *const *argv, char *const *envp)
        break;
 
       case 'l':
-       max_debug_argument_length = atoi (optarg);
+       max_debug_argument_length = strtol (optarg, NULL, 10);
        if (max_debug_argument_length <= 0)
          max_debug_argument_length = 0;
        break;
diff --git a/src/m4.h b/src/m4.h
index b82fb37..4f524ec 100644
--- a/src/m4.h
+++ b/src/m4.h
@@ -109,14 +109,15 @@ typedef unsigned int bool_bitfield;
 /* Take advantage of GNU C compiler source level optimization hints,
    using portable macros.  */
 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 6)
-#  define M4_GNUC_ATTRIBUTE(args)      __attribute__(args)
+# define M4_GNUC_ATTRIBUTE(args)       __attribute__ (args)
 #else
-#  define M4_GNUC_ATTRIBUTE(args)
+# define M4_GNUC_ATTRIBUTE(args)
 #endif  /* __GNUC__ */
 
-#define M4_GNUC_UNUSED         M4_GNUC_ATTRIBUTE((__unused__))
+#define M4_GNUC_UNUSED         M4_GNUC_ATTRIBUTE ((__unused__))
 #define M4_GNUC_PRINTF(fmt, arg)                       \
-  M4_GNUC_ATTRIBUTE((__format__ (__printf__, fmt, arg)))
+  M4_GNUC_ATTRIBUTE ((__format__ (__printf__, fmt, arg)))
+#define M4_GNUC_NORETURN       M4_GNUC_ATTRIBUTE ((__noreturn__))
 
 /* File: m4.c  --- global definitions.  */
 
@@ -238,7 +239,7 @@ void debug_message_prefix (void);
 
 void trace_prepre (const char *, int);
 void trace_pre (const char *, int, int, token_data **);
-void trace_post (const char *, int, int, token_data **, const char *);
+void trace_post (const char *, int, int, const char *);
 
 /* File: input.c  --- lexical definitions.  */
 
@@ -481,3 +482,6 @@ static inline unsigned char to_uchar (char ch) { return ch; 
}
 #else
 # define to_uchar(C) ((unsigned char) (C))
 #endif
+
+/* Avoid negative logic when comparing two strings.  */
+#define STREQ(a, b) (strcmp (a, b) == 0)
diff --git a/src/macro.c b/src/macro.c
index 73547ea..04079cf 100644
--- a/src/macro.c
+++ b/src/macro.c
@@ -282,6 +282,7 @@ call_macro (symbol *sym, int argc, token_data **argv,
       expand_user_macro (expansion, sym, argc, argv);
       break;
 
+    case TOKEN_VOID:
     default:
       M4ERROR ((warning_status, 0,
                "INTERNAL ERROR: bad symbol type in call_macro ()"));
@@ -368,7 +369,7 @@ expand_macro (symbol *sym)
   expanded = push_string_finish ();
 
   if (traced)
-    trace_post (SYMBOL_NAME (sym), my_call_id, argc, argv, expanded);
+    trace_post (SYMBOL_NAME (sym), my_call_id, argc, expanded);
 
   current_file = loc_close_file;
   current_line = loc_close_line;
diff --git a/src/output.c b/src/output.c
index a39d1e5..4070baa 100644
--- a/src/output.c
+++ b/src/output.c
@@ -191,7 +191,8 @@ m4_tmpname (int divnum)
   if (buffer == NULL)
     {
       tail = xasprintf ("%s/m4-%d", output_temp_dir->dir_name, INT_MAX);
-      buffer = obstack_copy0 (&diversion_storage, tail, strlen (tail));
+      buffer = (char *) obstack_copy0 (&diversion_storage, tail,
+                                      strlen (tail));
       free (tail);
       tail = strrchr (buffer, '-') + 1;
     }
@@ -729,7 +730,7 @@ make_diversion (int divnum)
        {
          assert (!output_diversion->used);
          if (!gl_oset_remove (diversion_table, output_diversion))
-           error (EXIT_FAILURE, 0, "INTERNAL ERROR: make_diversion failed");
+           assert (false);
          output_diversion->u.next = free_list;
          free_list = output_diversion;
        }
@@ -992,7 +993,8 @@ freeze_diversions (FILE *file)
              if (fstat (fileno (diversion->u.file), &file_stat) < 0)
                M4ERROR ((EXIT_FAILURE, errno, "cannot stat diversion"));
              if (file_stat.st_size < 0
-                 || file_stat.st_size != (unsigned long int) file_stat.st_size)
+                 || (file_stat.st_size + 0UL
+                     != (unsigned long int) file_stat.st_size))
                M4ERROR ((EXIT_FAILURE, 0, "diversion too large"));
              xfprintf (file, "D%d,%lu\n", diversion->divnum,
                        (unsigned long int) file_stat.st_size);
diff --git a/src/path.c b/src/path.c
index b846161..49e624e 100644
--- a/src/path.c
+++ b/src/path.c
@@ -108,7 +108,7 @@ add_include_directory (const char *dir)
 /* Attempt to open FILE; if it opens, verify that it is not a
    directory, and ensure it does not leak across execs.  */
 static FILE *
-m4_fopen (const char *file, const char *mode)
+m4_fopen (const char *file)
 {
   FILE *fp = fopen (file, "r");
   if (fp)
@@ -152,7 +152,7 @@ m4_path_search (const char *file, char **result)
     }
 
   /* Look in current working directory first.  */
-  fp = m4_fopen (file, "r");
+  fp = m4_fopen (file);
   if (fp != NULL)
     {
       if (result)
@@ -173,7 +173,7 @@ m4_path_search (const char *file, char **result)
       xfprintf (stderr, "m4_path_search (%s) -- trying %s\n", file, name);
 #endif
 
-      fp = m4_fopen (name, "r");
+      fp = m4_fopen (name);
       if (fp != NULL)
        {
          if (debug_level & DEBUG_TRACE_PATH)
diff --git a/src/symtab.c b/src/symtab.c
index 56e8703..eb37872 100644
--- a/src/symtab.c
+++ b/src/symtab.c
@@ -306,6 +306,7 @@ lookup_symbol (const char *name, symbol_lookup mode)
       }
       return NULL;
 
+    case SYMBOL_LOOKUP:
     default:
       M4ERROR ((warning_status, 0,
                "INTERNAL ERROR: invalid mode to symbol_lookup ()"));
diff --git a/src/Makefile.am b/tests/Makefile.am
similarity index 65%
copy from src/Makefile.am
copy to tests/Makefile.am
index 58a5ac6..2cdfaf0 100644
--- a/src/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,6 @@
 ## Makefile.am - template for generating Makefile via Automake
 ##
-## Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+## Copyright (C) 2009 Free Software Foundation, Inc.
 ##
 ## This file is part of GNU M4.
 ##
@@ -16,12 +16,5 @@
 ##
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
-##
-## This file written by Eric Blake <address@hidden>
 
-AUTOMAKE_OPTIONS = nostdinc
-AM_CPPFLAGS = -I$(top_srcdir)/lib -I../lib
-bin_PROGRAMS = m4
-m4_SOURCES = m4.h m4.c builtin.c debug.c eval.c format.c freeze.c input.c \
-macro.c output.c path.c symtab.c
-m4_LDADD = ../lib/libm4.a $(LIBM4_LIBDEPS) $(POW_LIB) $(LIBCSTACK)
+include gnulib.mk


hooks/post-receive
-- 
GNU M4 source repository




reply via email to

[Prev in Thread] Current Thread [Next in Thread]