diff options
author | Eric Blake <ebb9@byu.net> | 2009-04-27 13:53:31 -0600 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2009-05-18 06:31:36 -0600 |
commit | 2f6096389e2047a01618419af3f4471735444520 (patch) | |
tree | 5b680980221a5a8601150484ee8f7dc525a7a054 | |
parent | 260383467b3ae57f2cb3c6821718b99fdf278c4b (diff) | |
download | m4-2f6096389e2047a01618419af3f4471735444520.tar.gz |
Minor cleanups, detected by gnulib's 'make syntax-check'.
* configure.ac (M4_cv_use_stackovf): Avoid redundant parentheses.
* BACKLOG: Delete.
* HACKING: Avoid trailing whitespace.
* TODO: Likewise.
* examples/stackovf.sh: Likewise.
* examples/esyscmd.m4: Likewise.
* examples/file.m4: Avoid space-tab.
* examples/fstab.m4: Likewise.
* examples/patsubst.m4: Likewise.
* src/m4.h (STREQ): New macro.
* src/builtin.c (find_builtin_by_name): Use it.
* src/m4.c (process_file): Likewise.
(main): Mark all strings. Avoid atoi.
(stackovf_handler): Reword string.
(m4_verror_at_line): Use all-lowercase warning.
* src/stackovf.c (includes): Drop unused <assert.h>.
(setup_stackovf_trap): Make it easier to translate errors.
* src/output.c (freeze_diversions): Avoid false positive.
* doc/m4.texinfo: Adjust expected output.
* examples/null.err: Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
-rw-r--r-- | BACKLOG | 60 | ||||
-rw-r--r-- | ChangeLog | 22 | ||||
-rw-r--r-- | HACKING | 2 | ||||
-rw-r--r-- | TODO | 4 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | doc/m4.texinfo | 176 | ||||
-rw-r--r-- | examples/esyscmd.m4 | 2 | ||||
-rw-r--r-- | examples/file.m4 | 2 | ||||
-rw-r--r-- | examples/fstab.m4 | 3 | ||||
-rw-r--r-- | examples/null.err | bin | 3300 -> 3300 bytes | |||
-rw-r--r-- | examples/patsubst.m4 | 2 | ||||
-rw-r--r-- | examples/stackovf.sh | 10 | ||||
-rw-r--r-- | src/builtin.c | 4 | ||||
-rw-r--r-- | src/m4.c | 32 | ||||
-rw-r--r-- | src/m4.h | 5 | ||||
-rw-r--r-- | src/output.c | 2 | ||||
-rw-r--r-- | src/stackovf.c | 17 |
17 files changed, 159 insertions, 188 deletions
diff --git a/BACKLOG b/BACKLOG deleted file mode 100644 index 96562a56..00000000 --- a/BACKLOG +++ /dev/null @@ -1,60 +0,0 @@ -# Summary of pending email for GNU m4 1.4. -# Last updated: Saturday, November 05, 1994. - -rmail/announce - 1. 15 Sep 94 <pinard@IRO.UMontreal.CA> Release: GNU m4 1.3 - 2. 29 Oct 94 <pinard@IRO.UMontreal.CA> Prerelease: GNU m4 1.3.1 - -rmail/changeword - 1. 02 Sep 94 <pinard> Re: Prerelease: GNU m4 1.2.3 - 2. 05 Sep 94 <Pete.Chown@dale.dircon.co.uk> Re: Prerelease: GNU m4 1.2.3 - -rmail/configuration - 1. 03 Nov 94 <Fredrik_Lundh@ivab.se> Re: m4 1.3 on DEC OSF/1 3.0 - 2. 05 Nov 94 <pinard> Re: m4 1.3 on DEC OSF/1 3.0 - -rmail/documentation - 1. 05 Jun 92 <berstel@mipsmath.math.uqam.ca> Re: M4 - 2. 10 Nov 92 <tchrist@convex.COM> Re: Is anyone using m4? - 3. 25 May 94 <schwab@issan.informatik.uni-dortmund.de> Autoconf 1.11: minor bu - 4. 27 Jul 94 <pinard@IRO.UMontreal.CA> Re: 0.95: Spacing details - 5. 28 Jul 94 <pinard@IRO.UMontreal.CA> Re: 0.95: Spacing details - 6. 31 Aug 94 <kb@cs.umb.edu> Re: Frozen file documentation to proofread - -rmail/floating-point - 1. 27 Oct 94 <johnm@vlibs.com> Re: enhancement to m4 eval() - 2. 25 Oct 94 <johnm@vlibs.com> enhancement to m4 - 3. 27 Oct 94 <pinard> Re: enhancement to m4 - 4. 27 Oct 94 <johnm@vlibs.com> Re: enhancement to m4 eval() - 5. 27 Oct 94 <pinard> Re: enhancement to m4 eval() - 6. 27 Oct 94 <johnm@vlibs.com> Re: enhancement to m4 eval() - 7. 28 Oct 94 <pinard> Re: enhancement to m4 eval() - 8. 28 Oct 94 <pinard> Re: enhancement to m4 eval() - 9. 28 Oct 94 <feeley@IRO.UMontreal.CA> Re: enhancement to m4 eval() -10. 28 Oct 94 <pinard> Re: enhancement to m4 eval() -11. 28 Oct 94 <johnm@vlibs.com> Re: enhancement to m4 eval() -12. 28 Oct 94 <johnm@vlibs.com> Re: enhancement to m4 eval() -13. 28 Oct 94 <pinard@IRO.UMontreal.CA> Re: enhancement to m4 eval() - -rmail/format-rewrite - 1. 25 Jun 94 <tmcconne@sedona.intel.com> Re: Prerelease: GNU m4 1.1.3 - -rmail/named-formals - 1. 30 Sep 94 <djm@va.pubnix.com> m4 macros with named formal parameters - -rmail/purify - 1. 06 Dec 93 <vern@horse.ee.lbl.gov> m4 1.1.1 "make realclean" - -rmail/speed - 1. 29 Aug 94 <pinard> Re: diversions and freezing - 2. 05 Sep 94 <djm@va.pubnix.com> slowness - 3. 04 Oct 94 <pinard> Autoconf, m4, and dnl's. - -Copyright (C) 2000, 2006 Free Software Foundation, Inc. - -Permission is granted to copy, distribute and/or modify this document -under the terms of the GNU Free Documentation License, Version 1.2 or -any later version published by the Free Software Foundation; with no -Invariant Sections, with no Front-Cover Texts, and with no Back-Cover -Texts. A copy of the license is included in the ``GNU Free -Documentation License'' file as part of this distribution. @@ -1,5 +1,27 @@ 2009-05-18 Eric Blake <ebb9@byu.net> + Minor cleanups, detected by gnulib's 'make syntax-check'. + * configure.ac (M4_cv_use_stackovf): Avoid redundant parentheses. + * BACKLOG: Delete. + * HACKING: Avoid trailing whitespace. + * TODO: Likewise. + * examples/stackovf.sh: Likewise. + * examples/esyscmd.m4: Likewise. + * examples/file.m4: Avoid space-tab. + * examples/fstab.m4: Likewise. + * examples/patsubst.m4: Likewise. + * src/m4.h (STREQ): New macro. + * src/builtin.c (find_builtin_by_name): Use it. + * src/m4.c (process_file): Likewise. + (main): Mark all strings. Avoid atoi. + (stackovf_handler): Reword string. + (m4_verror_at_line): Use all-lowercase warning. + * src/stackovf.c (includes): Drop unused <assert.h>. + (setup_stackovf_trap): Make it easier to translate errors. + * src/output.c (freeze_diversions): Avoid false positive. + * doc/m4.texinfo: Adjust expected output. + * examples/null.err: Likewise. + Use gnulib maintainer-makefile module. * m4/gnulib-cache.m4: Import maintainer-makefile module. * cfg.mk (local-checks-to-skip): Drop changelog-check; add @@ -289,7 +289,7 @@ yyyy-mm-dd Name of Author <email@address> (tiny change) co directory/m4.txt After making edits, mail the diff to <bug-directory@gnu.org>. --- +----------- Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. @@ -30,14 +30,14 @@ 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 outline-regexp: " *[-+*.] \\|" End: -Copyright (C) 2000, 2006, 2007 Free Software Foundation, Inc. +Copyright (C) 2000, 2006, 2007, 2009 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or diff --git a/configure.ac b/configure.ac index 5f1664fe..f2b42b55 100644 --- a/configure.ac +++ b/configure.ac @@ -82,8 +82,8 @@ if test "$ac_cv_func_sigaction" = yes || test "$ac_cv_func_sigvec" = yes; then #include <sys/resource.h> #include <signal.h> ]], [[struct rlimit r; getrlimit (RLIMIT_STACK, &r); -#if (!defined(HAVE_SIGACTION) || !defined(SA_ONSTACK)) \ - && (!defined(HAVE_SIGVEC) || !defined(SV_ONSTACK)) +#if (!defined HAVE_SIGACTION || !defined SA_ONSTACK) \ + && (!defined HAVE_SIGVEC || !defined SV_ONSTACK) choke me /* SA_ONSTACK and/or SV_ONSTACK are not defined */ #endif ]])], [M4_cv_use_stackovf=yes]) diff --git a/doc/m4.texinfo b/doc/m4.texinfo index c37bc9e7..d18d4b0e 100644 --- a/doc/m4.texinfo +++ b/doc/m4.texinfo @@ -612,7 +612,7 @@ a warning. @example $ @kbd{m4} defn(`oops') -@error{}m4:stdin:1: Warning: defn: undefined macro `oops' +@error{}m4:stdin:1: warning: defn: undefined macro `oops' @result{} ^D @end example @@ -642,7 +642,7 @@ $ @kbd{echo $?} @example $ @kbd{m4 -E -d} defn(`oops') -@error{}m4:stdin:1: Warning: defn: undefined macro `oops' +@error{}m4:stdin:1: warning: defn: undefined macro `oops' @result{} ^D @end example @@ -962,7 +962,7 @@ bar @comment options: -o /dev/null @example $ @kbd{m4 -o /dev/null -@error{}m4: Warning: `-o' is deprecated, use `--debugfile' instead +@error{}m4: warning: `-o' is deprecated, use `--debugfile' instead dumpdef(`divnum') @result{} @end example @@ -1092,7 +1092,7 @@ define(`m4exit')include(`null.m4')dnl @example include(`null.m4') @result{}# This file tests m4 behavior on NUL bytes. -@error{}m4:examples/null.m4:5: Warning: m4exit: non-numeric argument `2\0002' +@error{}m4:examples/null.m4:5: warning: m4exit: non-numeric argument `2\0002' @end example @end ignore @@ -1650,12 +1650,12 @@ defined macros, there is no check of the number of arguments given. @example $ @kbd{m4} index(`abc') -@error{}m4:stdin:1: Warning: index: too few arguments: 1 < 2 +@error{}m4:stdin:1: warning: index: too few arguments: 1 < 2 @result{}0 index(`abc',) @result{}0 index(`abc', `b', `0', `ignored') -@error{}m4:stdin:3: Warning: index: extra arguments ignored: 4 > 3 +@error{}m4:stdin:3: warning: index: extra arguments ignored: 4 > 3 @result{}1 @end example @@ -2034,8 +2034,8 @@ will still be possible to restore older behavior in M4 2.0. @example $ @kbd{m4 --warn-macro-sequence} define(`foo', `$001 $@{1@} $1') -@error{}m4:stdin:1: Warning: definition of `foo' contains sequence `$001' -@error{}m4:stdin:1: Warning: definition of `foo' contains sequence `$@{1@}' +@error{}m4:stdin:1: warning: definition of `foo' contains sequence `$001' +@error{}m4:stdin:1: warning: definition of `foo' contains sequence `$@{1@}' @result{} foo(`bar') @result{}bar $@{1@} bar @@ -2279,7 +2279,7 @@ m4}). @example $ @kbd{m4} undefine(`a') -@error{}m4:stdin:1: Warning: undefine: undefined macro `a' +@error{}m4:stdin:1: warning: undefine: undefined macro `a' @result{} debugmode(`-d') @result{} @@ -2417,7 +2417,7 @@ $ @kbd{m4 -d} defn(`defn') @result{} define(defn(`divnum'), `cannot redefine a builtin token') -@error{}m4:stdin:2: Warning: define: invalid macro name ignored +@error{}m4:stdin:2: warning: define: invalid macro name ignored @result{} divnum @result{}0 @@ -2432,30 +2432,30 @@ mydivnum define(`', `empty-$1') @result{} defn(defn(`divnum')) -@error{}m4:stdin:9: Warning: defn: invalid macro name ignored +@error{}m4:stdin:9: warning: defn: invalid macro name ignored @result{} pushdef(defn(`divnum'), `oops') -@error{}m4:stdin:10: Warning: pushdef: invalid macro name ignored +@error{}m4:stdin:10: warning: pushdef: invalid macro name ignored @result{} traceon(defn(`divnum')) -@error{}m4:stdin:11: Warning: traceon: invalid macro name ignored +@error{}m4:stdin:11: warning: traceon: invalid macro name ignored @result{} indir(defn(`divnum'), `string') -@error{}m4:stdin:12: Warning: indir: invalid macro name ignored +@error{}m4:stdin:12: warning: indir: invalid macro name ignored @result{} indir(`', `string') @result{}empty-string traceoff(defn(`divnum')) -@error{}m4:stdin:14: Warning: traceoff: invalid macro name ignored +@error{}m4:stdin:14: warning: traceoff: invalid macro name ignored @result{} popdef(defn(`divnum')) -@error{}m4:stdin:15: Warning: popdef: invalid macro name ignored +@error{}m4:stdin:15: warning: popdef: invalid macro name ignored @result{} dumpdef(defn(`divnum')) -@error{}m4:stdin:16: Warning: dumpdef: invalid macro name ignored +@error{}m4:stdin:16: warning: dumpdef: invalid macro name ignored @result{} undefine(defn(`divnum')) -@error{}m4:stdin:17: Warning: undefine: invalid macro name ignored +@error{}m4:stdin:17: warning: undefine: invalid macro name ignored @result{} dumpdef(`') @error{}:@tabchar{}`empty-$1' @@ -2479,7 +2479,7 @@ builtin token does not occur in isolation. A future version of @example $ @kbd{m4 -d} defn(`foo') -@error{}m4:stdin:1: Warning: defn: undefined macro `foo' +@error{}m4:stdin:1: warning: defn: undefined macro `foo' @result{} debugmode(`-d') @result{} @@ -2494,25 +2494,25 @@ defn(`a', `divnum', `a') @result{}AA define(`mydivnum', defn(`divnum', `divnum'))mydivnum @error{}m4trace: -2- defn(`divnum', `divnum') -> `<divnum><divnum>' -@error{}m4:stdin:7: Warning: define: cannot concatenate builtins +@error{}m4:stdin:7: warning: define: cannot concatenate builtins @error{}m4trace: -1- define(`mydivnum', `<divnum><divnum>') -> `' @result{} traceoff(`defn', `define')dumpdef(`mydivnum') @error{}mydivnum:@tabchar{}`' @result{} define(`mydivnum', defn(`divnum')defn(`divnum'))mydivnum -@error{}m4:stdin:9: Warning: define: cannot concatenate builtins +@error{}m4:stdin:9: warning: define: cannot concatenate builtins @result{} define(`mydivnum', defn(`divnum')`a')mydivnum -@error{}m4:stdin:10: Warning: define: cannot concatenate builtins +@error{}m4:stdin:10: warning: define: cannot concatenate builtins @result{}A define(`mydivnum', `a'defn(`divnum'))mydivnum -@error{}m4:stdin:11: Warning: define: cannot concatenate builtins +@error{}m4:stdin:11: warning: define: cannot concatenate builtins @result{}A define(`q', ``$@@'') @result{} define(`foo', q(`a', defn(`divnum')))foo -@error{}m4:stdin:13: Warning: define: cannot concatenate builtins +@error{}m4:stdin:13: warning: define: cannot concatenate builtins @result{}a, ifdef(`foo', `yes', `no') @result{}yes @@ -2630,7 +2630,7 @@ define(`a', `1') popdef @result{}popdef popdef(`a', `a') -@error{}m4:stdin:3: Warning: popdef: undefined macro `a' +@error{}m4:stdin:3: warning: popdef: undefined macro `a' @result{} debugmode(`-d') @result{} @@ -2688,7 +2688,7 @@ f(define(`f', `2')) indir(`f', define(`f', `3')) @result{}3 indir(`f', undefine(`f')) -@error{}m4:stdin:4: Warning: indir: undefined macro `f' +@error{}m4:stdin:4: warning: indir: undefined macro `f' @result{} debugmode(`-d') @result{} @@ -2704,17 +2704,17 @@ string. @example $ @kbd{m4 -d} indir(defn(`defn'), `divnum') -@error{}m4:stdin:1: Warning: indir: invalid macro name ignored +@error{}m4:stdin:1: warning: indir: invalid macro name ignored @result{} indir(`define', defn(`defn'), `divnum') -@error{}m4:stdin:2: Warning: define: invalid macro name ignored +@error{}m4:stdin:2: warning: define: invalid macro name ignored @result{} indir(`define', `foo', defn(`divnum')) @result{} foo @result{}0 indir(`divert', defn(`foo')) -@error{}m4:stdin:5: Warning: divert: empty string treated as 0 +@error{}m4:stdin:5: warning: divert: empty string treated as 0 @result{} @end example @@ -2728,7 +2728,7 @@ odd', defn(`divnum')) @result{} indir(`%%:\ odd', `extra') -@error{}m4:stdin:3: Warning: %%\:\\\nodd: extra arguments ignored: 1 > 0 +@error{}m4:stdin:3: warning: %%\:\\\nodd: extra arguments ignored: 1 > 0 @result{}0 @end example @@ -2792,10 +2792,10 @@ $ @kbd{m4 -P} m4_builtin(`divnum') @result{}0 m4_builtin(`m4_divnum') -@error{}m4:stdin:2: Warning: m4_builtin: undefined builtin `m4_divnum' +@error{}m4:stdin:2: warning: m4_builtin: undefined builtin `m4_divnum' @result{} m4_indir(`divnum') -@error{}m4:stdin:3: Warning: m4_indir: undefined macro `divnum' +@error{}m4:stdin:3: warning: m4_indir: undefined macro `divnum' @result{} m4_indir(`m4_divnum') @result{}0 @@ -2813,20 +2813,20 @@ recognized; but it will provoke a warning, and result in a void expansion. builtin @result{}builtin builtin() -@error{}m4:stdin:2: Warning: builtin: undefined builtin `' +@error{}m4:stdin:2: warning: builtin: undefined builtin `' @result{} builtin(`builtin') -@error{}m4:stdin:3: Warning: builtin: too few arguments: 0 < 1 +@error{}m4:stdin:3: warning: builtin: too few arguments: 0 < 1 @result{} builtin(`builtin',) -@error{}m4:stdin:4: Warning: builtin: undefined builtin `' +@error{}m4:stdin:4: warning: builtin: undefined builtin `' @result{} builtin(`builtin', ``' ') -@error{}m4:stdin:5: Warning: builtin: undefined builtin ``\'\n' +@error{}m4:stdin:5: warning: builtin: undefined builtin ``\'\n' @result{} indir(`index') -@error{}m4:stdin:7: Warning: index: too few arguments: 0 < 2 +@error{}m4:stdin:7: warning: index: too few arguments: 0 < 2 @result{} @end example @@ -2901,7 +2901,7 @@ define(`foo', `') ifdef(`foo', ``foo' is defined', ``foo' is not defined') @result{}foo is defined ifdef(`no_such_macro', `yes', `no', `extra argument') -@error{}m4:stdin:4: Warning: ifdef: extra arguments ignored: 4 > 3 +@error{}m4:stdin:4: warning: ifdef: extra arguments ignored: 4 > 3 @result{}no @end example @@ -2913,7 +2913,7 @@ generated by @code{defn} (@pxref{Defn}) that occur in either define(`', `empty') @result{} ifdef(defn(`defn'), `yes', `no') -@error{}m4:stdin:2: Warning: ifdef: invalid macro name ignored +@error{}m4:stdin:2: warning: ifdef: invalid macro name ignored @result{}no define(`foo', ifdef(`divnum', defn(`divnum'), `undefined')) @result{} @@ -2961,7 +2961,7 @@ case, the warning about missing arguments is never triggered. ifelse(`some comments') @result{} ifelse(`foo', `bar') -@error{}m4:stdin:2: Warning: ifelse: too few arguments: 2 < 3 +@error{}m4:stdin:2: warning: ifelse: too few arguments: 2 < 3 @result{} @end example @@ -3013,14 +3013,14 @@ calls for an example: @example ifelse(`foo', `bar', `third', `gnu', `gnats') -@error{}m4:stdin:1: Warning: ifelse: extra arguments ignored: 5 > 4 +@error{}m4:stdin:1: warning: ifelse: extra arguments ignored: 5 > 4 @result{}gnu ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth') @result{} ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth', `seventh') @result{}seventh ifelse(`foo', `bar', `3', `gnu', `gnats', `6', `7', `8') -@error{}m4:stdin:4: Warning: ifelse: extra arguments ignored: 8 > 7 +@error{}m4:stdin:4: warning: ifelse: extra arguments ignored: 8 > 7 @result{}7 @end example @@ -4045,7 +4045,7 @@ f(popdef(`f')dumpdef(`f')) @error{}f:@tabchar{}``$0'1' @result{}f2 f(popdef(`f')dumpdef(`f')) -@error{}m4:stdin:3: Warning: dumpdef: undefined macro `f' +@error{}m4:stdin:3: warning: dumpdef: undefined macro `f' @result{}f1 debugmode(`-d') @result{} @@ -4138,17 +4138,17 @@ traceon(`foo') foo @result{}foo defn(`foo') -@error{}m4:stdin:4: Warning: defn: undefined macro `foo' +@error{}m4:stdin:4: warning: defn: undefined macro `foo' @result{} undefine(`foo') -@error{}m4:stdin:5: Warning: undefine: undefined macro `foo' +@error{}m4:stdin:5: warning: undefine: undefined macro `foo' @result{} pushdef(`foo') @result{} popdef(`foo') @result{} popdef(`foo') -@error{}m4:stdin:8: Warning: popdef: undefined macro `foo' +@error{}m4:stdin:8: warning: popdef: undefined macro `foo' @result{} define(`foo', `bar') @result{} @@ -4160,7 +4160,7 @@ undefine(`foo') ifdef(`foo', `yes', `no') @result{}no indir(`foo') -@error{}m4:stdin:13: Warning: indir: undefined macro `foo' +@error{}m4:stdin:13: warning: indir: undefined macro `foo' @result{} define(`foo', `blah') @result{} @@ -4487,13 +4487,13 @@ $ @kbd{m4 -d} traceon(`divnum') @result{} divnum(`extra') -@error{}m4:stdin:2: Warning: divnum: extra arguments ignored: 1 > 0 +@error{}m4:stdin:2: warning: divnum: extra arguments ignored: 1 > 0 @error{}m4trace: -1- divnum(`extra') -> `0' @result{}0 debugfile() @result{} divnum(`extra') -@error{}m4:stdin:4: Warning: divnum: extra arguments ignored: 1 > 0 +@error{}m4:stdin:4: warning: divnum: extra arguments ignored: 1 > 0 @result{}0 debugfile @result{} @@ -4588,7 +4588,7 @@ next newline, on whatever line containing it, will still be discarded. @example dnl(`args are ignored, but side effects occur', define(`foo', `like this')) while this text is ignored: undefine(`foo') -@error{}m4:stdin:1: Warning: dnl: extra arguments ignored: 2 > 0 +@error{}m4:stdin:1: warning: dnl: extra arguments ignored: 2 > 0 See how `foo' was defined, foo? @result{}See how foo was defined, like this? @end example @@ -4603,7 +4603,7 @@ m4wrap(`m4wrap(`2 hi define(`hi', `HI') @result{} ^D -@error{}m4:stdin:1: Warning: dnl: end of file treated as newline +@error{}m4:stdin:1: warning: dnl: end of file treated as newline @result{}0 HI 2 HI @end example @@ -6175,7 +6175,7 @@ contrast this with an empty @var{substring}. @example index(`abc') -@error{}m4:stdin:1: Warning: index: too few arguments: 1 < 2 +@error{}m4:stdin:1: warning: index: too few arguments: 1 < 2 @result{}0 index(`abc', `') @result{}0 @@ -6260,13 +6260,13 @@ Here are some more examples on the handling of backslash: regexp(`abc', `\(b\)', `\\\10\a') @result{}\b0a regexp(`abc', `b', `\1\') -@error{}m4:stdin:2: Warning: regexp: sub-expression 1 not present -@error{}m4:stdin:2: Warning: regexp: trailing \ ignored in replacement +@error{}m4:stdin:2: warning: regexp: sub-expression 1 not present +@error{}m4:stdin:2: warning: regexp: trailing \ ignored in replacement @result{} regexp(`abc', `\(\(d\)?\)\(c\)', `\1\2\3\4\5\6') -@error{}m4:stdin:3: Warning: regexp: sub-expression 4 not present -@error{}m4:stdin:3: Warning: regexp: sub-expression 5 not present -@error{}m4:stdin:3: Warning: regexp: sub-expression 6 not present +@error{}m4:stdin:3: warning: regexp: sub-expression 4 not present +@error{}m4:stdin:3: warning: regexp: sub-expression 5 not present +@error{}m4:stdin:3: warning: regexp: sub-expression 6 not present @result{}c @end example @@ -6275,7 +6275,7 @@ contrast this with an empty @var{regexp} argument. @example regexp(`abc') -@error{}m4:stdin:1: Warning: regexp: too few arguments: 1 < 2 +@error{}m4:stdin:1: warning: regexp: too few arguments: 1 < 2 @result{}0 regexp(`abc', `') @result{}0 @@ -6334,7 +6334,7 @@ other hand, selecting a @var{from} or @var{length} that lies beyond @example substr(`abc') -@error{}m4:stdin:1: Warning: substr: too few arguments: 1 < 2 +@error{}m4:stdin:1: warning: substr: too few arguments: 1 < 2 @result{}abc substr(`abc', `') @result{}abc @@ -6391,10 +6391,10 @@ substr(`abcde', `-3', `-4', `f') substr(`abcde', `-6', `1', `f') @result{}fabcde substr(`abcde', `-7', `1', `f') -@error{}m4:stdin:5: Warning: substr: substring out of range +@error{}m4:stdin:5: warning: substr: substring out of range @result{} substr(`abcde', `6', `', `f') -@error{}m4:stdin:6: Warning: substr: substring out of range +@error{}m4:stdin:6: warning: substr: substring out of range @result{} @end example @@ -6584,7 +6584,7 @@ Omitting @var{chars} evokes a warning, but still produces output. @example translit(`abc') -@error{}m4:stdin:1: Warning: translit: too few arguments: 1 < 2 +@error{}m4:stdin:1: warning: translit: too few arguments: 1 < 2 @result{}abc @end example @@ -6638,7 +6638,7 @@ patsubst(`GNUs not Unix', `\w+', `(\&)') patsubst(`GNUs not Unix', `[A-Z][a-z]+') @result{}GN not@w{ } patsubst(`GNUs not Unix', `not', `NOT\') -@error{}m4:stdin:6: Warning: patsubst: trailing \ ignored in replacement +@error{}m4:stdin:6: warning: patsubst: trailing \ ignored in replacement @result{}GNUs NOT Unix @end example @@ -6717,7 +6717,7 @@ contrast this with an empty @var{regexp} argument. @example patsubst(`abc') -@error{}m4:stdin:1: Warning: patsubst: too few arguments: 1 < 2 +@error{}m4:stdin:1: warning: patsubst: too few arguments: 1 < 2 @result{}abc patsubst(`abc', `') @result{}abc @@ -6817,14 +6817,14 @@ Likewise, escape sequences are not yet recognized. @example format(`%p', `0') -@error{}m4:stdin:1: Warning: format: unrecognized specifier in `%p' +@error{}m4:stdin:1: warning: format: unrecognized specifier in `%p' @result{}p format(`%*d', `') -@error{}m4:stdin:2: Warning: format: empty string treated as 0 -@error{}m4:stdin:2: Warning: format: too few arguments: 2 < 3 +@error{}m4:stdin:2: warning: format: empty string treated as 0 +@error{}m4:stdin:2: warning: format: too few arguments: 2 < 3 @result{}0 format(`%.1f', `2a') -@error{}m4:stdin:3: Warning: format: non-numeric argument `2a' +@error{}m4:stdin:3: warning: format: non-numeric argument `2a' @result{}2.0 @end example @@ -6866,10 +6866,10 @@ incr(`4') decr(`7') @result{}6 incr() -@error{}m4:stdin:3: Warning: incr: empty string treated as 0 +@error{}m4:stdin:3: warning: incr: empty string treated as 0 @result{}1 decr() -@error{}m4:stdin:4: Warning: decr: empty string treated as 0 +@error{}m4:stdin:4: warning: decr: empty string treated as 0 @result{}-1 @end example @@ -6940,13 +6940,13 @@ extension when @acronym{POSIX} mode is not requested, and that using @example eval(`2 = 2') -@error{}m4:stdin:1: Warning: eval: recommend ==, not =, for equality +@error{}m4:stdin:1: warning: eval: recommend ==, not =, for equality @result{}1 eval(`++0') -@error{}m4:stdin:2: Warning: eval: invalid operator: `++0' +@error{}m4:stdin:2: warning: eval: invalid operator: `++0' @result{} eval(`0 |= 1') -@error{}m4:stdin:3: Warning: eval: invalid operator: `0 |= 1' +@error{}m4:stdin:3: warning: eval: invalid operator: `0 |= 1' @result{} @end example @@ -6989,12 +6989,12 @@ eval(`+ + - ~ ! ~ 0') eval(`2 || 1 / 0') @result{}1 eval(`0 || 1 / 0') -@error{}m4:stdin:9: Warning: eval: divide by zero: `0 || 1 / 0' +@error{}m4:stdin:9: warning: eval: divide by zero: `0 || 1 / 0' @result{} eval(`0 && 1 % 0') @result{}0 eval(`2 && 1 % 0') -@error{}m4:stdin:11: Warning: eval: modulo by zero: `2 && 1 % 0' +@error{}m4:stdin:11: warning: eval: modulo by zero: `2 && 1 % 0' @result{} @end example @@ -7016,9 +7016,9 @@ eval(`2 ** 0') @result{}1 eval(`0 ** 0') @result{} -@error{}m4:stdin:5: Warning: eval: divide by zero: `0 ** 0' +@error{}m4:stdin:5: warning: eval: divide by zero: `0 ** 0' eval(`4 ** -2') -@error{}m4:stdin:6: Warning: eval: negative exponent: `4 ** -2' +@error{}m4:stdin:6: warning: eval: negative exponent: `4 ** -2' @result{} eval(`0 ? 2 : 3') @result{}3 @@ -7069,7 +7069,7 @@ square(square(`5')` + 1') define(`foo', `666') @result{} eval(`foo / 6') -@error{}m4:stdin:11: Warning: eval: bad expression: `foo / 6' +@error{}m4:stdin:11: warning: eval: bad expression: `foo / 6' @result{} eval(foo / 6) @result{}111 @@ -7139,16 +7139,16 @@ eval(`10', `', `0') eval(`10', `16') @result{}a eval(`1', `37') -@error{}m4:stdin:9: Warning: eval: radix out of range: 37 +@error{}m4:stdin:9: warning: eval: radix out of range: 37 @result{} eval(`1', , `-1') -@error{}m4:stdin:10: Warning: eval: negative width: -1 +@error{}m4:stdin:10: warning: eval: negative width: -1 @result{} eval() -@error{}m4:stdin:11: Warning: eval: empty string treated as 0 +@error{}m4:stdin:11: warning: eval: empty string treated as 0 @result{}0 eval(` ') -@error{}m4:stdin:12: Warning: eval: empty string treated as 0 +@error{}m4:stdin:12: warning: eval: empty string treated as 0 @result{}0 define(`a', `hi')eval(` 10 ', `16') @result{}hi @@ -7559,12 +7559,12 @@ define(`foo', `errprint(`oops')') syscmd(`rm -f foo-??????')sysval @result{}0 define(`file1', maketemp(`foo-XXXXXX'))dnl -@error{}m4:stdin:3: Warning: maketemp: recommend using mkstemp instead +@error{}m4:stdin:3: warning: maketemp: recommend using mkstemp instead ifelse(esyscmd(`echo \` foo-?????? \''), ` foo-?????? ', `no file', `created') @result{}created define(`file2', maketemp(`foo-XX'))dnl -@error{}m4:stdin:6: Warning: maketemp: recommend using mkstemp instead +@error{}m4:stdin:6: warning: maketemp: recommend using mkstemp instead define(`file3', mkstemp(`foo-XXXXXX'))dnl ifelse(len(defn(`file1')), len(defn(`file2')), `same length', `different') @@ -7604,13 +7604,13 @@ syscmd(`rm -r foodir')sysval syscmd(`rm -f foo-*')sysval @result{}0 len(maketemp(`foo-XXXXX')) -@error{}m4:stdin:2: Warning: maketemp: recommend using mkstemp instead +@error{}m4:stdin:2: warning: maketemp: recommend using mkstemp instead @result{}9 define(`abc', `def') @result{} maketemp(`foo-abc') @result{}foo-def -@error{}m4:stdin:4: Warning: maketemp: recommend using mkstemp instead +@error{}m4:stdin:4: warning: maketemp: recommend using mkstemp instead syscmd(`test -f foo-*')ifelse(sysval, `0', `0', `1') @result{}1 @end example @@ -8552,7 +8552,7 @@ forloop(`', `1', `2', ` odd iterator name') forloop(`i', `5 + 5', `0xc', ` 0x`'eval(i, `16')') @result{} 0xa 0xb 0xc forloop(`i', `a', `b', `non-numeric bounds') -@error{}m4:stdin:6: Warning: eval: bad input: `(a) <= (b)' +@error{}m4:stdin:6: warning: eval: bad input: `(a) <= (b)' @result{} @end example @@ -9457,7 +9457,7 @@ m4wrap(`divnum(`demo of internal message') fatal_error(`inside wrapped text')') @result{} ^D -@error{}m4:stdin:6: Warning: divnum: extra arguments ignored: 1 > 0 +@error{}m4:stdin:6: warning: divnum: extra arguments ignored: 1 > 0 @result{}0 @error{}m4:stdin:6: fatal error: inside wrapped text @end example diff --git a/examples/esyscmd.m4 b/examples/esyscmd.m4 index b839148c..0e8634d4 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 e7db5f13..ff56153b 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 dbf538ae..8d10e176 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/null.err b/examples/null.err Binary files differindex 930d9174..dbe52bc8 100644 --- a/examples/null.err +++ b/examples/null.err diff --git a/examples/patsubst.m4 b/examples/patsubst.m4 index 3b390ae0..8569066a 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/examples/stackovf.sh b/examples/stackovf.sh index 8916afc3..43fd68ea 100644 --- a/examples/stackovf.sh +++ b/examples/stackovf.sh @@ -7,8 +7,8 @@ # On some systems the ulimit command is available in ksh or bash but not sh (exec 2>/dev/null; ulimit -HSs 300) || { for altshell in bash bsh ksh ; do - if (exec >/dev/null 2>&1; $altshell -c 'ulimit -HSs 300') && - test -z "$1" + if (exec >/dev/null 2>&1; $altshell -c 'ulimit -HSs 300') && + test -z "$1" then echo "Using $altshell because it supports ulimit" exec $altshell $0 running-with-$altshell @@ -45,7 +45,7 @@ then #test -n "$ulimitdashv" && ulimit -HSv 8000 echo "Stack limit is `ulimit -s`K"; echo "Heap limit is `ulimit -d`K"; - test -n "$ulimitdashv" && + test -n "$ulimitdashv" && echo "VMem limit is `ulimit -v`K"; else echo "Can't reset stack limit - this may take a while..." @@ -61,11 +61,11 @@ else # See if stack overflow was diagnosed case "`cat $tmpfile`" in *overflow*) - echo "Test succeeded."; + echo "Test succeeded."; exitcode=0 ;; *ut*of*emory*) - echo "*** Test is INCONCLUSIVE (ran out of heap before stack overflow)"; + echo "*** Test is INCONCLUSIVE (ran out of heap before stack overflow)"; ;; *) echo "*** Test FAILED. $M4 aborted unexpectedly. Output:"; ;; diff --git a/src/builtin.c b/src/builtin.c index a28535b0..191e05de 100644 --- a/src/builtin.c +++ b/src/builtin.c @@ -196,8 +196,8 @@ 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) + for (bp = &builtin_tab[0]; bp->name; bp++) + if (STREQ (bp->name, name)) return bp; return bp + 1; } @@ -84,7 +84,7 @@ typedef struct macro_definition macro_definition; | behalf of CALLER (if any), otherwise at the global current | | location. If ERRNUM, decode the errno value that caused the | | error. If STATUS, exit immediately with that status. If WARN, | -| prepend 'Warning: '. | +| prepend 'warning: '. | `------------------------------------------------------------------*/ static void @@ -123,9 +123,9 @@ m4_verror_at_line (bool warn, int status, int errnum, const call_info *caller, for non-memory reasons (unlikely), then still use the original format. */ if (warn && macro) - full = xasprintf (_("Warning: %s: %s"), macro, format); + full = xasprintf (_("warning: %s: %s"), macro, format); else if (warn) - full = xasprintf (_("Warning: %s"), format); + full = xasprintf (_("warning: %s"), format); else if (macro) full = xasprintf (_("%s: %s"), macro, format); verror_at_line (status, errnum, line ? file : NULL, line, @@ -184,7 +184,7 @@ static void stackovf_handler (void) { m4_error (EXIT_FAILURE, 0, NULL, - _("ERROR: stack overflow. (Infinite define recursion?)")); + _("FATAL: stack overflow. (Infinite define recursion?)")); } #endif /* USE_STACKOVF */ @@ -350,7 +350,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, @@ -366,7 +366,7 @@ process_file (const char *name) FILE *fp = m4_path_search (name, &full_name); if (fp == NULL) { - error (0, errno, "cannot open %s", + error (0, errno, _("cannot open %s"), quotearg_style (locale_quoting_style, name)); /* Set the status to EXIT_FAILURE, even though we continue to process files after a missing file. */ @@ -451,7 +451,7 @@ 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; @@ -496,7 +496,10 @@ main (int argc, char *const *argv, char *const *envp) break; case 'H': - hash_table_size = atol (optarg); + { + long tmp = strtol (optarg, NULL, 10); + hash_table_size = tmp; + } if (hash_table_size == 0) hash_table_size = HASHMAX; break; @@ -506,7 +509,10 @@ main (int argc, char *const *argv, char *const *envp) break; case 'L': - nesting_limit = atoi (optarg); + { + long tmp = strtol (optarg, NULL, 10); + nesting_limit = tmp; + } break; case 'P': @@ -531,12 +537,12 @@ main (int argc, char *const *argv, char *const *envp) if (seen_file) goto defer; if (debug_decode (optarg, SIZE_MAX) < 0) - error (0, 0, "bad debug flags: %s", + error (0, 0, _("bad debug flags: %s"), quotearg_style (locale_quoting_style, optarg)); break; case 'e': - error (0, 0, _("Warning: `%s' is deprecated, use `%s' instead"), + error (0, 0, _("warning: `%s' is deprecated, use `%s' instead"), "-e", "-i"); /* fall through */ case 'i': @@ -558,7 +564,7 @@ main (int argc, char *const *argv, char *const *envp) /* -o/--error-output are deprecated synonyms of --debugfile, so issue a warning. Don't call debug_set_output here, as it has side effects. */ - error (0, 0, _("Warning: `%s' is deprecated, use `%s' instead"), + error (0, 0, _("warning: `%s' is deprecated, use `%s' instead"), optchar == 'o' ? "-o" : "--error-output", "--debugfile"); debugfile = optarg; break; @@ -633,7 +639,7 @@ main (int argc, char *const *argv, char *const *envp) case 'd': if (debug_decode (arg, SIZE_MAX) < 0) - error (0, 0, "bad debug flags: %s", + error (0, 0, _("bad debug flags: %s"), quotearg_style (locale_quoting_style, optarg)); break; @@ -581,6 +581,8 @@ void reload_frozen_state (const char *); # define DEBUG_SYM 1 #endif +/* Generic utilties. */ + /* Convert a possibly-signed character to an unsigned character. This is a bit safer than casting to unsigned char, since it catches some type errors that the cast doesn't. */ @@ -589,3 +591,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/output.c b/src/output.c index 99a9f0a4..e31f94bb 100644 --- a/src/output.c +++ b/src/output.c @@ -1018,7 +1018,7 @@ freeze_diversions (FILE *file) if (file_stat.st_size < 0 || file_stat.st_size != (unsigned long int) file_stat.st_size) m4_error (EXIT_FAILURE, 0, NULL, _("diversion too large")); - xfprintf (file, "D%d,%lu\n", diversion->divnum, + xfprintf (file, "%c%d,%lu\n", 'D', diversion->divnum, (unsigned long int) file_stat.st_size); } diff --git a/src/stackovf.c b/src/stackovf.c index 514e8067..47164a87 100644 --- a/src/stackovf.c +++ b/src/stackovf.c @@ -1,6 +1,6 @@ /* Detect stack overflow (when getrlimit and sigaction or sigvec are available) - Copyright (C) 1993, 1994, 2006, 2007, 2008 Free Software + Copyright (C) 1993, 1994, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. Jim Avera <jima@netcom.com>, October 1993. @@ -79,7 +79,6 @@ #include "m4.h" /* stdlib.h, xmalloc() */ -#include <assert.h> #include <sys/time.h> #include <sys/resource.h> #include <signal.h> @@ -156,8 +155,8 @@ process_sigsegv (int signo, const char *p) char buf[140]; snprintf (buf, sizeof buf, - "process_sigsegv: p=%#lx stackend=%#lx diff=%ld bot=%#lx\n", - (long) p, (long) stackend, (long) diff, (long) stackbot); + "process_sigsegv: p=%#lx stackend=%#lx diff=%ld bot=%#lx\n", + (long) p, (long) stackend, (long) diff, (long) stackbot); write (2, buf, strlen (buf)); } #endif @@ -292,7 +291,7 @@ Error - Do not know how to set up stack-ovf trap handler... /* Calculate the approximate expected addr for a stack-ovf trap. */ if (getrlimit (RLIMIT_STACK, &rl) < 0) - error (EXIT_FAILURE, errno, "getrlimit"); + error (EXIT_FAILURE, errno, _("getrlimit")); stack_len = (rl.rlim_cur < rl.rlim_max ? rl.rlim_cur : rl.rlim_max); stackbot = (char *) argv; grows_upward = ((char *) &stack_len > stackbot); @@ -363,7 +362,7 @@ Error - Do not know how to set up stack-ovf trap handler... free (ss.ss_sp); if (errno == ENOSYS) return; - error (EXIT_FAILURE, errno, "sigaltstack"); + error (EXIT_FAILURE, errno, _("sigaltstack")); } } @@ -385,7 +384,7 @@ Error - Do not know how to set up stack-ovf trap handler... free (stackbuf); if (errno == ENOSYS) return; - error (EXIT_FAILURE, errno, "sigstack"); + error (EXIT_FAILURE, errno, _("sigstack")); } } @@ -408,7 +407,7 @@ Error - Do not know how to set up stack-ovf trap handler... sigemptyset (&act.sa_mask); act.sa_flags = (SA_ONSTACK | SA_RESETHAND | SA_SIGINFO); if (sigaction (SIGSEGV, &act, NULL) < 0) - error (EXIT_FAILURE, errno, "sigaction"); + error (EXIT_FAILURE, errno, _("sigaction")); #else /* ! HAVE_SIGACTION */ @@ -416,7 +415,7 @@ Error - Do not know how to set up stack-ovf trap handler... vec.sv_mask = 0; vec.sv_flags = (SV_ONSTACK | SV_RESETHAND); if (sigvec (SIGSEGV, &vec, NULL) < 0) - error (EXIT_FAILURE, errno, "sigvec"); + error (EXIT_FAILURE, errno, _("sigvec")); #endif /* ! HAVE_SIGACTION */ |