Refactor error messages to avoid macros.
[m4/ericb.git] / NEWS
blob1762571910439832adb15d146013ff45d4427139
1 GNU M4 NEWS - User visible changes.
2 Copyright (C) 1992, 1993, 1994, 2004, 2005, 2006, 2007 Free Software
3 Foundation, Inc.
5 Version 1.4.11 - ?? ??? 2007, by ????  (git version 1.4.10a-*)
7 * Security fixes for the -F option, for bugs present since -F was
8   introduced in 1.3: Avoid core dump with 'm4 -F file -t undefined', and
9   avoid arbitrary code execution with certain file names.
10 * Fix regression introduced in 1.4.9b in the `divert' builtin when more
11   than 512 kibibytes are saved in diversions on platforms like NetBSD where
12   fopen(name,"a+") seeks to the end of the file.
13 * Enhance the `defn' builtin to support concatenation of multiple text
14   arguments, as required by POSIX.  However, at this time, it is not
15   possible to concatenate a builtin macro with anything else; a warning is
16   now issued if this is attempted, although a future version of M4 may lift
17   this restriction to match other implementations.
18 * Several improvements in `index', `regexp', and `patsubst' builtins to
19   speed up typical Autoconf usage.
20 * Memory usage is greatly reduced in recursive macros.
21 * A number of portability improvements inherited from gnulib.
23 Version 1.4.10 - 09 Jul 2007, by Eric Blake  (CVS version 1.4.9c)
25 * Upgrade from GPL version 2 to GPL version 3 or later.
26 * A number of portability improvements inherited from gnulib.
27 * Avoid undefined behavior introduced in 1.4.9b in the `format' builtin
28   when handling %c.  However, this area of code has never been documented,
29   and currently does not match the POSIX behavior of printf(1), so it may
30   have further changes in the next version.
32 Version 1.4.9b - 29 May 2007, by Eric Blake  (CVS version 1.4.9a)
34 * Fix regression introduced in 1.4.9 in the `eval' builtin when performing
35   division.
36 * Fix regression introduced in 1.4.8 in the `-F' option that made it
37   impossible to freeze more than 512 kibibytes of diverted text.
38 * The synclines option `-s' no longer generates sync lines in the middle of
39   multiline comments or quoted strings.
40 * Work around a number of corner-case POSIX compliance bugs in various
41   broken stdio libraries.  In particular, the `syscmd' builtin behaves
42   more predictably when stdin is seekable.
43 * The `format' builtin now understands formats such as %a, %A, and %'hhd,
44   and works around a number of platform printf bugs.  Furthermore, the
45   sequence format(%*.*d,-1,-1,1) no longer outputs random data.  However,
46   some non-compliant platforms such as mingw still have known bugs in
47   strtod that may cause testsuite failures.
48 * The testsuite is improved to also run gnulib portability tests for the
49   features that M4 imports from gnulib.
51 Version 1.4.9 - 23 Mar 2007, by Eric Blake  (CVS version 1.4.8c)
53 * Minor documentation and portability cleanups.
55 Version 1.4.8b - 24 Feb 2007, by Eric Blake  (CVS version 1.4.8a)
57 * Fix a regression introduced in 1.4.8 that made m4 unable to process
58   files larger than 2GiB on some platforms.
59 * Fix a regression introduced in 1.4.8 that made m4 dump core when
60   invoked as 'm4 -- file'.
61 * The `eval' builtin now follows C precedence rules.  Additionally, the
62   short-circuit operators correctly short-circuit division by zero.  The
63   previously undocumented alias of '=' meaning '==' in eval now triggers a
64   deprecation warning, so that a future version of M4 can implement a form
65   of variable assignment as an extension.
66 * The `include' builtin now affects exit status on failure, as required by
67   POSIX.  Use `sinclude' if you need a successful exit status.
68 * The `-E'/`--fatal-warnings' command-line option now has two levels.  When
69   specified only once, warnings affect exit status, but execution
70   continues, so that you can see all warnings instead of fixing them one
71   at a time.  To acheive 1.4.8 behavior, where the first warning
72   immediately exits, specify -E twice on the command line.
73 * A new `--warn-macro-sequence' command-line option allows detection of
74   sequences in `define' and `pushdef' definitions that match an optional
75   regular expression.  The default regular expression is
76   `\$\({[^}]*}\|[0-9][0-9]+\)', corresponding to the sequences that might
77   not behave correctly when upgrading to the eventual M4 2.0.  By default,
78   M4 2.0 will follow the POSIX requirement that a macro definition
79   containing `$11' must expand to the first argument concatenated with 1,
80   rather than the eleventh argument; and will take advantage of the POSIX
81   wording that allows implementations to treat `${11}' as the eleventh
82   argument instead of literal text.  Be aware that Autoconf 2.61 will not
83   work with this option enabled with the default regular expression; but
84   Autoconf 2.62 will be compatible with this option.
85 * Improved portability to platforms such as BSD/OS and AIX.
87 Version 1.4.8 - 20 November 2006, by Eric Blake  (CVS version 1.4.7a)
89 * The `divert' macro and `-H'/`--hashsize' command line option no longer
90   cause a core dump when handed extra large values.  Also, `divert' now
91   uses memory proportional to the number of diversions in use, rather than
92   to the maximum diversion number encountered, so that large diversion
93   numbers are less likely to exhaust system memory; and is no longer
94   limited by the maximum number of file descriptors.
95 * The `--help' and `--version' command line options now consistently
96   override all earlier options.  For example, `m4 --debugfile=trace
97   --help' now no longer accidentally creates an empty file `trace'.
98 * The `-L'/`--nesting-limit' command line option can now be set to 0
99   to remove the default limit of 1024.  However, it is still possible that
100   heavily nested input can cause abrupt program termination due to stack
101   overflow.
102 * Problems encountered when writing to standard error, such as with the
103   `errprint' macro, now always cause a non-zero exit status.
104 * Warnings and errors issued during macro expansion are now consistently
105   reported at the line where the macro name was detected, rather than
106   where the close parenthesis resides.  Text wrapped by `m4wrap' now
107   remembers the location that was in effect when m4wrap was invoked,
108   rather than changing to line 0 and the empty string for a file.  The
109   macros `__line__' and `__file__' now work correctly even as the last
110   token in an included file.
111 * The `builtin' and `indir' macros now transparently handle builtin
112   tokens generated by `defn'.
113 * When diversions created by the `divert' macro collect enough text that
114   M4 must use temporary files, the environment variable $TMPDIR is now
115   consulted, and a better effort is made to clean up those files in the
116   event of a fatal signal.
117 * The `mkstemp' builtin is added with the same GNU semantics as `maketemp',
118   based on the recommendation of POSIX to deprecate the POSIX semantics of
119   `maketemp' as inherently insecure.  In GNU mode (no -G supplied on the
120   command line), `maketemp' silently retains the secure GNU semantics, but
121   a future release of M4 will change this to emit a warning.  In
122   traditional mode (m4 -G), `maketemp' now uses the POSIX-mandated insecure
123   semantics, and issues a warning that you should convert your script to
124   use `mkstemp' instead.  Additionally, `mkstemp' and `maketemp' are now
125   well-defined even if the template argument does not end in six `X'
126   characters.
127 * The manual has been improved, including a new section on a composite
128   macro `foreach'.
129 * The `changecom' and `changequote' macros now treat an empty second
130   argument the same as if it were missing, rather than using the empty
131   string and making it impossible to end a comment or quote.
132 * The `translit' macro now operates in linear instead of quadratic time,
133   and is now eight-bit clean.
134 * The `-D', `-U', `-s', and `-t' command line options now take effect
135   after any files encountered earlier on the command line, rather than up
136   front, as is done in traditional implementations and required by POSIX.
138 Version 1.4.7 - 25 September 2006, by Eric Blake  (CVS version 1.4.6a)
140 * Fix regression from 1.4.5 in handling a file that ends in a macro
141   expansion without arguments instead of a newline.
142 * The define and pushdef macros now warn when the first argument is not
143   a string, rather than silently doing nothing.
144 * Standard input can now be read more than once, as in 'm4 - file -', and
145   is not closed until all wrapped text is handled.  This makes a
146   difference when stdin is not a regular file, and also fixes bugs when
147   using the syscmd or esyscmd macros from wrapped text.
148 * When standard input is a seekable file, the m4exit, syscmd, and esyscmd
149   macros now restore the current position to the next unread byte rather
150   than discarding an arbitrary amount of buffered data.
151 * SysV command-line compatibility is no longer a goal of GNU M4; the
152   focus will be instead on POSIX compatibility.  This release continues to
153   support previous usage, but adds warnings in areas which will allow a
154   future version of GNU M4 to use its own extensions without being tied to
155   the SysV command line interface.
156 * The no-op compatibility command line options -B, -N, -S, -T, and
157   --diversions may be withdrawn or assigned new meanings in future
158   releases, so they now issue a warning if used.
159 * A new command line option -i replaces the compatibility -e as the
160   short spelling of --interactive, for consistency with other GNU tools; a
161   warning is issued if the old spelling is used, and it may be assigned new
162   meaning in future releases.
163 * A new command line option --debugfile replaces the options -o and
164   --error-output as the preferred spelling.  The old options were
165   misleading in their names and inconsistent with other GNU tools; they are
166   still silently accepted, but no longer documented in --help, and may be
167   assigned new meanings in future releases.
169 Version 1.4.6 - 25 August 2006, by Eric Blake  (CVS version 1.4.5a)
171 * Fix buffer overruns in regexp and patsubst macros when handed a trailing
172   backslash in the replacement text, or when handling \n substitutions
173   beyond the number of \(\) groups.
174 * Fix memory leak in regexp, patsubst, and changeword macros.
175 * The format macro now understands %F, %g, and %G.
176 * When loading frozen files, m4 now exits with status 63 if version
177   mismatch is detected.
178 * Fix bugs that occurred when invoked with stdout or stderr closed,
179   and detect write failures to stdout or to the target of the
180   debugfile macro.  In particular, the syscmd and esyscmd macros can
181   no longer interfere with the debug stream or diversions.
182 * The m4exit macro now converts values outside the range 0-255 to 1.
183 * It is now an error if a command-line input file ends in the middle of a
184   comment, matching the behavior of mid-string and mid-argument
185   collection.
186 * The dnl macro now warns if end of file is encountered instead of a
187   newline.
188 * The error message when end of file is encountered now uses the file and
189   line where the dangling construct started, rather than `NONE:0:'.
190 * The debugmode and __file__ macros, and the -s/--synclines option, now
191   show what directory a file was found in when the -I/--include option or
192   M4PATH variable had an effect.
193 * The changequote and changecom macros now work with 8-bit characters, and
194   quotes and comments that begin with `(' are properly recognized
195   following a word.
196 * The new macro __program__ is added, which allows the input file to issue
197   an error message that resembles messages from m4.  Warning and error
198   messages have been reformatted to comply with GNU Coding Standards.
199 * The errprint, m4wrap, and shift macros are now recognized only with
200   arguments.
201 * The index, substr, translit, regexp, and patsubst macros now produce
202   output when given only one argument, but still warn about a missing
203   second argument.
204 * The patsubst macro now reliably finds zero-length matches at the end
205   of a string.
207 Version 1.4.5 - 15 July 2006, by Eric Blake  (CVS version 1.4.4c)
209 * Fix sysval on BeOS, OS/2, and other systems that store exit status
210   in the low-order byte.  Additionally, on Unix platforms, if syscmd was
211   terminated by a signal, sysval now displays the signal number shifted
212   left by eight bits, to match traditional m4 implementations.
213 * The maketemp macro is no longer subject to platform limitations (such as
214   26 or 32 max files from a given template).
215 * Frozen files now require that the first directive be V (version), to
216   better diagnose version mismatch.  Additionally, if the F directive
217   (builtin function) names an unknown builtin that existed in the m4 that
218   froze the file but not in the current m4 (for example, changeword), the
219   warning is deferred until an attempt is made to actually use the
220   builtin.  This allows downgrading from beta m4-1.4o to stable m4-1.4.5
221   without breaking autoconf.
222 * The format and indir macros are now recognized only with arguments.
223 * The eval macro no longer crashes on x86 architectures when dividing the
224   minimum integer by -1.
225 * On systems with ecvt and fcvt, format no longer truncates trailing
226   zeroes on integers printed with %.0f.  On systems without these
227   functions, format is no longer subject to a buffer overflow that
228   permitted arbitrary code execution.
229 * On native Windows builds, the macro __windows__ is provided instead of
230   __unix__.  Likewise, on OS/2 builds, the macro __os2__ is provided.  This
231   allows input files to determine when syscmd might behave differently.
232 * Fix bug in 1.4.3 patch to use \n line-endings that did not work for
233   cygwin.
234 * When given the empty string or 0, undivert is now documented as a no-op
235   rather than closing stdout, warning about a non-existent file, or trying
236   to read a directory as a file.
237 * Many documentation improvements.  Also, the manual is now distributed
238   under FDL 1.2, rather than a stricter verbatim-only license.
239 * Raise the -L (--nesting-limit) command line option limit from 250 to
240   1024.
241 * The decr, incr, divert, m4exit, and substr macros treat an empty number
242   as 0, issue a warning, and expand as normal; rather than issuing an error
243   and expanding to the empty string.
244 * The eval macro now treats an empty radix argument as 10, handles radix 1,
245   and treats the width argument as number of digits excluding the sign,
246   for compatibility with other m4 implementations.
247 * The ifdef, divert, m4exit, substr, and translit macros now correctly
248   ignore extra arguments.
249 * The popdef and undefine macros now correctly accept multiple arguments.
250 * Although changeword is on its last leg, if enabled, it now reverts to the
251   default (faster) regexp when passed the empty string.
252 * The regexp and substr macros now warn and ignore a trailing backslash in
253   the replacement, and warn on \n for n larger than the number of
254   sub-expressions in the regexp.
256 Version 1.4.4b - 17 June 2006, by Eric Blake  (CVS version 1.4.4a)
258 * Fix a recursive push_string crashing bug, which affected changequote of
259   three or more characters on some compilers.
260 * Use automake to fix build portability issues.
261 * Fix a recursive m4wrap crashing bug.
262 * Fix a 1 in 2**32 hash crashing bug.
263 * Tracing a macro by name is now persistent, even if the macro is
264   subsequently undefined or redefined.  The traceon and traceoff macros no
265   longer warn about undefined symbols.  This solves a crash when using
266   indir on an undefined macro traced with the -t option, as well as an
267   incorrect result of ifdef.  Furthermore, tracing is no longer transferred
268   with builtins, solving the bug of "m4 -tm4_eval" failing to give trace
269   output on the input "define(`m4_eval',defn(`eval'))m4_eval(1)".
270 * Fix a crash when a macro is undefined while collecting its arguments, by
271   always using the definition that was in effect before argument
272   collection.  This behavior matches the C pre-processor, and means that
273   the sequence "define(`f',`1')f(define(`f',`2'))f" is now documented to
274   result in "12", rather than the previously undocumented "22".
275 * Update the regex engine to fix several bugs.
276 * Fix a potential crash on machines where char is signed.
278 Version 1.4.4 - October 2005, by Gary V. Vaughan
280 * ./configure --infodir=/usr/share/info now works correctly.
281 * When any file named on the command line is missing exit with status 1.
283 Version 1.4.3 - March 2005, by Gary V. Vaughan
285 * DESTDIR installs now work correctly.
286 * Don't segfault with uncompilable regexps to changeword().
287 * Always use \n line-endings for frozen files (fixes a Windows bug).
288 * Portability fix for systems lacking mkstemp(3).
289 * Approximately 20% speed up in the common case of usage with autoconf.
290 * Supported on QNX 6.3.
292 Version 1.4.2 - August 2004, by Paul Eggert
294 * No user visible changes; portability bug fixes only.
296 Version 1.4.1 - June 2004, by Paul Eggert
298 * maketemp now creates an empty file with the given name, instead of merely
299   returning the name of a nonexistent file.  This closes a security hole.
301 Version 1.4 - October 1994, by Franc,ois Pinard
303 (No user visible changes)
305 Version 1.3 - September 1994, by Franc,ois Pinard
307 * Diversions are created as needed.  Option `-N' is still accepted, but
308 otherwise ignored.  Users should use only negative diversion numbers,
309 instead of high positive numbers, for diverting to nowhere.
311 * Diversions should also work faster.  No temporary files will be needed
312 at all if all diversions taken altogether do not use more than 512K.
314 * Frozen state files may be produced with the `--freeze-state' (-F)
315 option and later brought back through the `--reload-state' (-R) option.
317 Version 1.2 - July 1994, by Franc,ois Pinard
319 * In patsubst(STRING, REGEXP, REPLACEMENT), \& in REPLACEMENT has been
320 changed to represent this part of STRING matched by the whole REGEXP,
321 instead of the whole STRING as before.  \0 does the same, but emits a
322 diagnostic saying it will disappear in some subsequent release.
324 * eval(EXPR) emits a diagnostic if EXPR has suffixed crumb.  The same for
325 other numeric conversions in incr(), decr(), divert(), etc.
327 * `--fatal-warnings' (-E) stops execution at first warning.
329 * `--nesting-limit=LEVEL' (-L LEVEL) sets a limit to macro nesting.
330 It is initially fixed at 250.
332 * `--word-regexp=REGEXP' (-W REGEXP) modifies macro name syntax, like
333 does the new `changeword(REGEXP)' macro.  This feature is experimental,
334 tell me your opinions about it.  You do need --enable-changeword at
335 configure time to get these things.  Do *not* depend on them yet.
337 * Trace output format is scannable by GNU Emacs' next-error function.
339 * Stack overflow is detected and diagnosed on some capable systems.
341 * Various bugs have been corrected, m4 should be more portable.  See the
342 ChangeLog for details.
344 Version 1.1 - November 1993, by Franc,ois Pinard
346 Changes which might affect existing GNU m4 scripts:
348 * Option `-V' has been removed, use `--version' instead.  `--version'
349 writes on standard output instead of standard error, and inhibits any
350 script execution.
352 * `--no-gnu-extensions' has been renamed `--traditional'.
354 * In `eval', `^' used to indicate exponentiation, use `**' instead.
356 * The automatic undiversion which takes place at end of all input is
357 forced into the main output stream.
359 Changes which are unlikely to affect existing scripts:
361 * `--help' prints an usage summary on standard output.  Script execution
362 is then inhibited.
364 * `--prefix-builtins' (-P) prefixes all builtin macros by `m4_'.
366 * Most builtin macros for which arguments are mandatory, called without
367 any arguments, are no more recognized as builtin macros: they are
368 consequently copied verbatim to the output stream.
370 * `define' and `pushdef' are usable with only one argument, they give
371 this argument an empty definition.
373 * `eval' new operators for binary representation handling: `^' for
374 exclusive-or, `~' for the bitwise negation, `<<' and `>>' for shifts.
376 * `eval' recognizes the notation 0bDIGITS for binary numbers and the
377 notation 0rRADIX:DIGITS for numbers in any radix from 1 to 36.
379 Version 1.0.3 - December 1992, by Franc,ois Pinard
381 Changes for the user:
383 * `dnl' outputs a diagnostic if immediately followed by `('.  Usually,
384 `dnl' is followed by newline or whitespace.
386 * `ifelse' accepts without complaining the common idiom of having only
387 one argument.  This is useful for introducing long comments.
389 * `eval' always expresses values as signed, whatever the radix.
391 * M4OPTS environment variable is no longer obeyed.
393 * `--no-warnings' option is renamed `--silent'.
395 * Debug lines use a new format more compatible with GNU standards.
397 * Various bugs have been corrected.  See the ChangeLog for details.
399 Changes for the installer:
401 * GNU m4 now uses an Autoconf-generated configure script, and should be
402 more easily portable in many ways.  (Cray is not supported yet).
404 * `make check' has been made more portable, expect no errors.
406 Changes for the programmer:
408 * Sources have been fully reindented to comply with GNU standards, and
409 cleaned up in many ways.
411 * Sources have been protoized.  Non-ANSI compilers are automatically
412 detected, then sources are unprotoized on the fly before compilation.
414 * GNU m4 uses newer versions of obstack, regex, getopt, etc.
416 Version 1.0 - October 1991, by Rene' Seindal
418 * Uses GNU configure, taken from the gdb distribution.
420 * Uses GNU getopt(), with long option names.
422 * The -Q/+quiet option is added, which suppresses warnings about missing
423 or superflous arguments to built-in macros.
425 * Added default options via the M4OPTS environment variable.
427 * Several minor bugs have been fixed.
429 Version 0.99 - July 1991, by Rene' Seindal
431 * The builtins `incr' and `decr' are now implemented without use of
432 `eval'.
434 * The builtin `indir' is added, to allow for indirect macro calls
435 (allows use of "illegal" macro names).
437 * The debugging and tracing facilities has been enhanced considerably.
438 See the manual for details.
440 * The -tMACRO option is added, marks MACRO for tracing as soon as it
441 is defined.
443 * Builtins are traced after renaming iff they were before.
445 * Named files can now be undiverted.
447 * The -Nnum option can be used to increase the number of divertions
448 available.
450 * Calling changecom without arguments now disables all comment handling.
452 * A bug in `dnl' is fixed.
454 * A bug in the multi-character quoting code is fixed.
456 * Several typos in the manual has been corrected.  More probably persist.
458 Version 0.75 - November 1990, by Rene' Seindal
460 * Implemented search path for include files (-I option and M4PATH
461 environment variable).
463 * Implemented builtin `format' for printf-like formatting.
465 * Implemented builtin `regexp' for searching for regular expressions.
467 * Implemented builtin `patsubst' for substitution with regular
468 expressions.
470 * Implemented builtin `esyscmd', which expands to a shell commands output.
472 * Implemented `__file__' and `__line__' for use in error messages.
474 * Implemented character ranges in `translit'.
476 * Implemented control over debugging output.
478 * Implemented multi-character quotes.
480 * Implemented multi-character comment delimiters.
482 * Changed predefined macro `gnu' to `__gnu__'.
484 * Changed predefined macro `unix' to `__unix__', when the -G option is
485 not used.  With -G, `unix' is still defined.
487 * Added program name to error messages.
489 * Fixed two missing null bytes bugs.
491 Version 0.50 - January 1990, by Rene' Seindal
493 * Initial beta release.
495 Local Variables:
496 mode: outline
497 fill-column: 75
498 End: