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