[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
deprecate -o
From: |
Eric Blake |
Subject: |
deprecate -o |
Date: |
Wed, 20 Sep 2006 03:57:24 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Well, on the branch, I didn't actually add a deprecation warning, because I
discovered that m4 1.4.6a + autoconf 2.60 led to warnings if --error-output
wasn't a silent synonym. But I did remove it from the --help output, and
added --debugfile in its place, so m4 1.4.6a + autoconf 2.61 (thanks to my
patch today to autoconf) will use --debugfile, leading to a smooth transition
to m4 2.0 which does warn when using --error-output. This does mean that m4
2.0 can't be released until after autoconf 2.61 (but no big surprise there; we
are also waiting on automake 1.10, libtool 2.0, and gettext 0.15.1, and a lot
of remaining bug fixes to port from the branch).
branch:
2006-09-19 Eric Blake <address@hidden>
* src/m4.c (usage, long_options, main, DEBUGFILE_OPTION): Rename
-o/--error-output to --debugfile, and deprecate the former. This
will allow a future release to be more consistent with other GNU
tools, with -o/--output affecting stdout, not debug.
* doc/m4.texinfo (Invoking m4, Debug Output): Document this.
* NEWS: Document this.
Index: NEWS
===================================================================
RCS file: /sources/m4/m4/NEWS,v
retrieving revision 1.1.1.1.2.62
diff -u -r1.1.1.1.2.62 NEWS
--- NEWS 14 Sep 2006 14:55:54 -0000 1.1.1.1.2.62
+++ NEWS 19 Sep 2006 23:20:50 -0000
@@ -16,8 +16,13 @@
macros now restore the current position to the next unread byte rather
than discarding an arbitrary amount of buffered data.
* The no-op compatibility command line options -B, -N, -S, -T, and
- --diversions may be withdrawn or assigned new meanings in M4 2.0, so
- they now issue a warning.
+ --diversions may be withdrawn or assigned new meanings in future
+ releases, so they now issue a warning if used.
+* A new command line option --debugfile replaces the options -o and
+ --error-output as the preferred spelling. The old options were
+ misleading in their names and inconsistent with other GNU tools; they are
+ still silently accepted, but no longer documented in --help, and may
+ assigned new meanings in future releases.
Version 1.4.6 - 25 August 2006, by Eric Blake (CVS version 1.4.5a)
Index: doc/m4.texinfo
===================================================================
RCS file: /sources/m4/m4/doc/m4.texinfo,v
retrieving revision 1.1.1.1.2.76
diff -u -r1.1.1.1.2.76 m4.texinfo
--- doc/m4.texinfo 14 Sep 2006 14:55:54 -0000 1.1.1.1.2.76
+++ doc/m4.texinfo 19 Sep 2006 23:20:50 -0000
@@ -561,19 +561,24 @@
functions. @xref{Debug Levels}, for more details on the format and
meaning of @var{FLAGS}. If omitted, @var{FLAGS} defaults to @samp{aeq}.
address@hidden -l @var{NUM}
address@hidden address@hidden
-Restrict the size of the output generated by macro tracing to @var{NUM}
-characters per trace line. If unspecified or zero, output is
-unlimited. @xref{Debug Levels}, for more details.
-
address@hidden -o @var{FILE}
address@hidden address@hidden
address@hidden -o @var{FILE}
@itemx address@hidden
Redirect @code{dumpdef} output, debug messages, and trace output to the
named @var{FILE}. Warnings, error messages, and @code{errprint} output
are still printed to standard error. If unspecified, debug output goes
to standard error; if empty, debug output is discarded. @xref{Debug
-Output}, for more details.
+Output}, for more details. The spellings @option{-o} and
address@hidden are misleading and inconsistent with other
address@hidden tools; for now they are silently accepted as synonyms of
address@hidden, but in a future version of M4, using them will
+cause a warning to be issued.
+
address@hidden -l @var{NUM}
address@hidden address@hidden
+Restrict the size of the output generated by macro tracing to @var{NUM}
+characters per trace line. If unspecified or zero, output is
+unlimited. @xref{Debug Levels}, for more details.
@item -t @var{NAME}
@itemx address@hidden
@@ -2337,7 +2342,7 @@
@cindex output, saving debugging
@cindex @acronym{GNU} extensions
Debug and tracing output can be redirected to files using either the
address@hidden option to @code{m4} (@pxref{Invoking m4}), or with the
address@hidden option to @code{m4} (@pxref{Invoking m4}), or with the
builtin macro @code{debugfile}:
@deffn Builtin debugfile (@ovar{file})
@@ -4761,7 +4766,7 @@
In addition to the above extensions, @acronym{GNU} @code{m4} implements the
following command line options: @option{-F}, @option{-G}, @option{-I},
@option{-L}, @option{-R}, @option{-V}, @option{-W}, @option{-d},
address@hidden, @option{-o} and @option{-t}. @xref{Invoking m4}, for a
address@hidden, @option{--debugfile} and @option{-t}. @xref{Invoking m4}, for a
description of these options.
Also, the debugging and tracing facilities in @acronym{GNU} @code{m4} are much
Index: src/m4.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/m4.c,v
retrieving revision 1.1.1.1.2.29
diff -u -r1.1.1.1.2.29 m4.c
--- src/m4.c 14 Sep 2006 14:55:54 -0000 1.1.1.1.2.29
+++ src/m4.c 19 Sep 2006 23:20:50 -0000
@@ -151,7 +151,7 @@
fputs ("\
\n\
Preprocessor features:\n\
- -D, --define=NAME[=VALUE] define NAME has having VALUE, or empty\n\
+ -D, --define=NAME[=VALUE] define NAME as having VALUE, or empty\n\
-I, --include=DIRECTORY append DIRECTORY to include path\n\
-s, --synclines generate `#line NUM \"FILE\"' lines\n\
-U, --undefine=NAME undefine NAME\n\
@@ -173,8 +173,8 @@
\n\
Debugging:\n\
-d, --debug[=FLAGS] set debug level (no FLAGS implies `aeq')\n\
+ --debugfile=FILE redirect debug and trace output\n\
-l, --arglength=NUM restrict macro tracing size\n\
- -o, --error-output=FILE redirect debug and trace output\n\
-t, --trace=NAME trace NAME when it will be defined\n\
", stdout);
fputs ("\
@@ -218,7 +218,8 @@
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
enum
{
- DIVERSIONS_OPTION = CHAR_MAX + 1, /* not quite -N, because of message */
+ DEBUGFILE_OPTION = CHAR_MAX + 1, /* no short opt */
+ DIVERSIONS_OPTION, /* not quite -N, because of message */
HELP_OPTION, /* no short opt */
VERSION_OPTION /* no short opt */
@@ -229,7 +230,7 @@
{"arglength", required_argument, NULL, 'l'},
{"debug", optional_argument, NULL, 'd'},
{"define", required_argument, NULL, 'D'},
- {"error-output", required_argument, NULL, 'o'},
+ {"error-output", required_argument, NULL, 'o'}, /* FIXME: deprecate in 2.0 */
{"fatal-warnings", no_argument, NULL, 'E'},
{"freeze-state", required_argument, NULL, 'F'},
{"hashsize", required_argument, NULL, 'H'},
@@ -246,6 +247,7 @@
{"undefine", required_argument, NULL, 'U'},
{"word-regexp", required_argument, NULL, 'W'},
+ {"debugfile", required_argument, NULL, DEBUGFILE_OPTION},
{"diversions", required_argument, NULL, DIVERSIONS_OPTION},
{"help", no_argument, NULL, HELP_OPTION},
@@ -312,7 +314,7 @@
case 'N':
case DIVERSIONS_OPTION:
- /* -N became an obsolete no-op in 1.4.x. */
+ /* -N became an obsolete no-op in 1.4.x. */
error (0, 0, "Warning: `m4 %s' is deprecated",
optchar == 'N' ? "-N" : "--diversions");
@@ -399,6 +401,11 @@
break;
case 'o':
+ /* -o/--error-output are deprecated synonyms of --debugfile,
+ but don't issue a deprecation warning until autoconf 2.61
+ or later is more widely established, as such a warning
+ would interfere with all earlier versions of autoconf. */
+ case DEBUGFILE_OPTION:
if (!debug_set_output (optarg))
error (0, errno, "%s", optarg);
break;
@@ -408,8 +415,8 @@
break;
case VERSION_OPTION:
- printf ("%s\n", PACKAGE_STRING);
- fputs ("\
+ printf ("%s\n", PACKAGE_STRING);
+ fputs ("\
Copyright (C) 2006 Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
@@ -417,9 +424,9 @@
Written by Rene' Seindal.\n\
", stdout);
- if (close_stream (stdout) != 0)
- M4ERROR ((EXIT_FAILURE, errno, "write error"));
- exit (EXIT_SUCCESS);
+ if (close_stream (stdout) != 0)
+ M4ERROR ((EXIT_FAILURE, errno, "write error"));
+ exit (EXIT_SUCCESS);
break;
case HELP_OPTION:
head:
2006-09-19 Eric Blake <address@hidden>
* src/main.c (usage, main, DEBUGFILE_OPTION): Deprecate -o as
well as --error-output; the goal is to add -o/--output in some
future version with semantics like gcc or autom4te.
* doc/m4.texinfo (Invoking m4, Dumpdef, Debug Output, Errprint):
(Extensions): Reflect this update.
(Renamesyms): Add another test.
(Defn): Xfail for now, so that `make check' is happy.
* NEWS: Document this change.
* tests/generate.awk: Mark dynamic loading tests as such. Allow
xfailing tests.
* tests/macros.at (Renamesyms collisions): New test, exposing
renamesyms' coredump.
* tests/options.at (--debugfile, --safer): Update to match
change.
Index: NEWS
===================================================================
RCS file: /sources/m4/m4/NEWS,v
retrieving revision 1.16
diff -u -r1.16 NEWS
--- NEWS 19 Sep 2006 13:16:08 -0000 1.16
+++ NEWS 19 Sep 2006 23:20:55 -0000
@@ -68,13 +68,14 @@
representation and to catch any more missing state; once 2.0 is released,
any further changes would introduce format 3.
-* New `--debugfile' option is a synonym for the misnamed `--error-output',
- using the old spelling will print a warning and may break in future
- versions.
+* The `-o' and `--error-output' options, which were replaced by
+ `--debugfile' in M4 1.4.7, now issue a deprecation warning. This warning
+ interferes with all versions of Autoconf prior to 2.61, so plan on
+ installing an updated Autoconf when installing M4 2.0.
* The `dumpdef' macro now always outputs to standard error, rather than
- the debug file specified by the `-o'/`--debugfile' option or
- `debugfile' macro.
+ the debug file specified by the `--debugfile' option or `debugfile'
+ macro.
* The builtins `modules' and `symbols', introduced in previous betas,
have been renamed `m4modules' and `m4symbols', in order to minimize
Index: doc/m4.texinfo
===================================================================
RCS file: /sources/m4/m4/doc/m4.texinfo,v
retrieving revision 1.47
diff -u -r1.47 m4.texinfo
--- doc/m4.texinfo 19 Sep 2006 13:16:08 -0000 1.47
+++ doc/m4.texinfo 19 Sep 2006 23:20:55 -0000
@@ -649,22 +649,25 @@
@var{FLAGS} starts with @samp{-} or @samp{+}, they are cumulative,
otherwise the later flags override all earlier occurrences.
address@hidden address@hidden
address@hidden -o @var{FILE}
address@hidden address@hidden
+Redirect debug and trace output to the named @var{FILE}. Warnings,
+error messages, and the output of @code{errprint} and @code{dumpdef},
+are still printed to standard error. If this option is not given, debug
+output goes to standard error; if @var{FILE} is the empty string, debug
+output is discarded. @xref{Debug Output}, for more details. The
+spellings @option{-o} and @option{--error-output} are misleading and
+inconsistent with other @acronym{GNU} tools; using those spellings will
+evoke a warning, and they may be withdrawn or change semantics in a
+future release.
+
@item -l @var{NUM}
@itemx address@hidden
Restrict the size of the output generated by macro tracing to @var{NUM}
characters per trace line. If unspecified or zero, output is
unlimited. @xref{Debug Levels}, for more details.
address@hidden -o @var{FILE}
address@hidden address@hidden
address@hidden address@hidden
-Redirect debug and trace output to the named @var{FILE}. Warnings,
-error messages, and the output of @code{errprint} and @code{dumpdef},
-are still printed to standard error. @xref{Debug Output}, for more
-details. The name @option{--error-output} is misleading; using it
-instead of the other spellings will evoke a warning, and it may be
-withdrawn in a future release.
-
@item -t @var{NAME}
@itemx address@hidden
This enables tracing for the macro @var{NAME}, at any point where it is
@@ -1813,6 +1816,7 @@
@comment FIXME - we don't yet handle mixing text and builtins. This
@comment example passes under Solaris (minus the warning).
address@hidden xfail
@example
defn(`foo')
@error{}m4:stdin:1: Warning: defn: undefined macro `foo'
@@ -1988,6 +1992,22 @@
@result{}
@end example
+When a symbol has multiple definitions, thanks to @code{pushdef}, the
+entire stack is renamed.
+
address@hidden
+pushdef(`foo', `1')pushdef(`foo', `2')
address@hidden
+renamesyms(`^foo$', `bar')
address@hidden
+bar
address@hidden
+popdef(`bar')bar
address@hidden
+popdef(`bar')bar
address@hidden
address@hidden example
+
@node Indir
@section Indirect call of macros
@@ -2554,7 +2574,7 @@
it displays the definitions of all known names, otherwise it displays
the definitions of the @var{names} given. The output is printed
directly to standard error, independently of the @option{--debugfile}
-option (or @option{-o}, @pxref{Invoking m4}), or @code{debugfile} macro.
+option (@pxref{Invoking m4}), or @code{debugfile} macro.
The output is sorted by name. If an unknown name is encountered, a
warning is printed.
@@ -2917,8 +2937,8 @@
@cindex output, saving debugging
@cindex @acronym{GNU} extensions
Debug and tracing output can be redirected to files using either the
address@hidden option to @code{m4} (or @option{-o},
address@hidden m4}), or with the builtin macro @code{debugfile}:
address@hidden option to @code{m4} (@pxref{Invoking m4}), or with
+the builtin macro @code{debugfile}:
@deffn {Builtin (gnu)} debugfile (@ovar{file})
Send all further debug and trace output to @var{file}, opened in append
@@ -2957,13 +2977,13 @@
@end example
Although the @option{--safer} option cripples @code{debugfile} to a
-limited subset of capabilities, you may still use the @option{-o}
+limited subset of capabilities, you may still use the @option{--debugfile}
option from the command line with no restrictions.
address@hidden options: --safer -otrace -tfoo -Dfoo=bar -d+l
address@hidden options: --safer --debugfile=trace -tfoo -Dfoo=bar -d+l
@comment status: 1
@example
-$ @kbd{m4 --safer -o trace -t foo -D foo=bar -daelq}
+$ @kbd{m4 --safer --debugfile trace -t foo -D foo=bar -daelq}
foo # traced to `trace'
@result{}bar # traced to `trace'
debugfile(`file')
@@ -4876,8 +4896,7 @@
@deffn {Builtin (m4)} errprint (@var{message}, @dots{})
You can print error messages using @code{errprint}, which simply prints
@var{message} and the rest of the arguments on standard error,
-independently of the @option{--debugfile} option (or @option{-o},
address@hidden m4}).
+independently of the @option{--debugfile} option (@pxref{Invoking m4}).
The expansion of @code{errprint} is void.
@end deffn
@@ -5253,10 +5272,9 @@
@code{debugfile} (@pxref{Debug Output}).
@end itemize
-In addition to the above extensions, GNU @code{m4} implements the
-following command line options: @samp{-F}, @samp{-G}, @samp{-I},
address@hidden, @samp{-R}, @samp{-V}, @samp{-W}, @samp{-d},
address@hidden, @samp{-o}, @samp{-r} and @samp{-t}. @xref{Invoking m4},
+Additionally, @acronym{POSIX} only requires support for the command line
+options @samp{-s}, @samp{-D}, and @samp{-U}, so all other options
+accepted by @acronym{GNU} M4 are extensions. @xref{Invoking m4},
for a description of these options.
Also, the debugging and tracing facilities in GNU @code{m4} are much
Index: src/main.c
===================================================================
RCS file: /sources/m4/m4/src/main.c,v
retrieving revision 1.84
diff -u -r1.84 main.c
--- src/main.c 19 Sep 2006 13:16:08 -0000 1.84
+++ src/main.c 19 Sep 2006 23:20:55 -0000
@@ -108,7 +108,7 @@
Preprocessor features:\n\
--import-environment import all environment variables as macros\n\
-B, --prepend-include=DIR add DIR to include path before `.'\n\
- -D, --define=NAME[=VALUE] define NAME has having VALUE, or empty\n\
+ -D, --define=NAME[=VALUE] define NAME as having VALUE, or empty\n\
-I, --include=DIR add DIR to include path after `.'\n\
-s, --synclines generate `#line NUM \"FILE\"' lines\n\
-U, --undefine=NAME undefine NAME\n\
@@ -129,8 +129,8 @@
\n\
Debugging:\n\
-d, --debug[=FLAGS] set debug level (no FLAGS implies `aeq')\n\
+ --debugfile=FILE redirect debug and trace output\n\
-l, --arglength=NUM restrict macro tracing size\n\
- -o, --debugfile=FILE redirect debug and trace output\n\
-t, --trace=NAME trace NAME when it will be defined\n\
"), stdout);
fputs (_("\
@@ -172,8 +172,9 @@
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
enum
{
- DIVERSIONS_OPTION = CHAR_MAX + 1, /* not quite -N, because of message */
- ERROR_OUTPUT_OPTION, /* deprecated form of -o */
+ DEBUGFILE_OPTION = CHAR_MAX + 1, /* no short opt */
+ DIVERSIONS_OPTION, /* not quite -N, because of message */
+ ERROR_OUTPUT_OPTION, /* not quite -o, because of message */
IMPORT_ENVIRONMENT_OPTION, /* no short opt */
PREPEND_INCLUDE_OPTION, /* not quite -B, because of message */
SAFER_OPTION, /* -S still has old no-op
semantics */
@@ -188,7 +189,6 @@
{"arglength", required_argument, NULL, 'l'},
{"batch", no_argument, NULL, 'b'},
{"debug", optional_argument, NULL, 'd'},
- {"debugfile", required_argument, NULL, 'o'},
{"define", required_argument, NULL, 'D'},
{"discard-comments", no_argument, NULL, 'c'},
{"fatal-warnings", no_argument, NULL, 'E'},
@@ -210,6 +210,7 @@
{"undefine", required_argument, NULL, 'U'},
{"word-regexp", required_argument, NULL, 'W'},
+ {"debugfile", required_argument, NULL, DEBUGFILE_OPTION},
{"diversions", required_argument, NULL, DIVERSIONS_OPTION},
{"error-output", required_argument, NULL, ERROR_OUTPUT_OPTION},
{"import-environment", no_argument, NULL, IMPORT_ENVIRONMENT_OPTION},
@@ -418,11 +419,17 @@
m4_set_max_debug_arg_length_opt (context, 0);
break;
+ case 'o':
case ERROR_OUTPUT_OPTION:
- error (0, 0, _("\
-Warning: --error-output is deprecated, use --debugfile instead"));
+ /* FIXME: -o is inconsistent with other tools' use of
+ -o/--output for creating an output file instead of using
+ stdout, and --error-output is misnamed since it does not
+ affect error messages to stderr. Change the meaning of -o
+ after 2.1. */
+ error (0, 0, _("Warning: %s is deprecated, use --debugfile instead"),
+ optchar == 'o' ? "-o" : "--error-output");
/* fall through */
- case 'o':
+ case DEBUGFILE_OPTION:
if (!m4_debug_set_output (context, optarg))
error (0, errno, "%s", optarg);
break;
Index: tests/generate.awk
===================================================================
RCS file: /sources/m4/m4/tests/generate.awk,v
retrieving revision 1.18
diff -u -r1.18 generate.awk
--- tests/generate.awk 31 Aug 2006 03:21:35 -0000 1.18
+++ tests/generate.awk 19 Sep 2006 23:20:55 -0000
@@ -22,7 +22,7 @@
BEGIN {
seq = -1;
- status = 0;
+ status = xfail = 0;
file = options = "";
print "# This file is part of the GNU m4 test suite. -*- Autotest -*-";
# I don't know how to get this file's name, so it's hard coded :(
@@ -53,9 +53,13 @@
gsub ("@comment options:", "", options);
}
+/address@hidden xfail$/ {
+ xfail = 1;
+}
+
/address@hidden ignore$/ {
getline;
- status = 0;
+ status = xfail = 0;
options = file = "";
next;
}
@@ -93,9 +97,9 @@
}
else
{
- new_test(input, status, output, error, options);
+ new_test(input, status, output, error, options, xfail);
}
- status = 0;
+ status = xfail = 0;
file = input = output = error = options = "";
next;
}
@@ -158,11 +162,16 @@
printf ("AT_KEYWORDS([[documentation]])\n\n");
}
-function new_test(input, status, output, error, options) {
+function new_test(input, status, output, error, options, xfail) {
input = normalize(input);
output = normalize(output);
error = normalize(error);
+ if (options ~ /-m/)
+ printf ("AT_CHECK_DYNAMIC_MODULE\n");
+ if (xfail == 1)
+ printf ("AT_XFAIL_IF([:])\n");
+
printf ("AT_DATA([[input.m4]],\n[[%s]])\n\n", input);
# Some of these tests `include' files from tests/.
printf ("AT_CHECK_M4([[%s input.m4]], %s,", options, status);
Index: tests/macros.at
===================================================================
RCS file: /sources/m4/m4/tests/macros.at,v
retrieving revision 1.8
diff -u -r1.8 macros.at
--- tests/macros.at 31 Aug 2006 03:21:36 -0000 1.8
+++ tests/macros.at 19 Sep 2006 23:20:55 -0000
@@ -403,3 +403,23 @@
AT_CHECK_M4([-t define -daeq trace3.m4], 0, expout, experr)
AT_CLEANUP
+
+
+## --------------------- ##
+## Renamesyms collisions ##
+## --------------------- ##
+
+AT_SETUP([Renamesyms collisions])
+
+dnl FIXME - We should gracefully detect rename collisions, rather than
+dnl violating the invariants of the symbol table.
+AT_XFAIL_IF([:])
+
+AT_DATA([in], [[define(`bar', `1')define(`baz', `2')dnl
+renamesyms(`^ba.$', `baa')
+]])
+
+AT_CHECK_M4([in], [0], [[
+]], [ignore])
+
+AT_CLEANUP
Index: tests/options.at
===================================================================
RCS file: /sources/m4/m4/tests/options.at,v
retrieving revision 1.9
diff -u -r1.9 options.at
--- tests/options.at 19 Sep 2006 13:16:08 -0000 1.9
+++ tests/options.at 19 Sep 2006 23:20:55 -0000
@@ -161,6 +161,12 @@
]])
AT_CHECK([rm trace])
+dnl -o will change meaning in the future
+AT_CHECK_M4([-otrace], [0], [],
+[[m4: Warning: -o is deprecated, use --debugfile instead
+]])
+AT_CHECK([rm trace])
+
AT_CLEANUP
@@ -244,14 +250,14 @@
AT_SETUP([--safer])
-dnl with --safer, debugfile is crippled, but -o is not
+dnl with --safer, the debugfile macro is crippled, but --debugfile is not
AT_DATA([[in]],
[[define(`foo', `1')foo
debugfile(`trace2')
define(`foo', `2')foo
]])
-AT_CHECK_M4([--safer -o trace1 -t foo in], [1],
+AT_CHECK_M4([--safer --debugfile trace1 -t foo in], [1],
[[1
2
@@ -294,7 +300,7 @@
AT_DATA([[in]], [[foo
]])
-AT_CHECK_M4([-otrace1 -tfoo -Dfoo=bar in 2>&1], [0], [[bar
+AT_CHECK_M4([--debugfile=trace1 -tfoo -Dfoo=bar in 2>&1], [0], [[bar
]])
AT_CHECK_M4([--debugfile=trace2 -tfoo -Dfoo=bar in], [0], [[bar
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- deprecate -o,
Eric Blake <=