Re: --debugfile behavior

Eric Blake <[email protected]>
Newsgroups gmane.comp.gnu.m4.patches
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 12/22/2008 7:00 AM:
> While working on adding debugmode(`+o') for branch-1.6, I noticed that
> there is no command-line way to change the current debug file to stderr if
> it has been changed elsewhere (at least, not without OS support for
> /dev/stderr or /proc/self/fd/2...).  I introduced --debugfile in m4 1.4.7
> with a mandatory argument 2 years ago, but think that an optional argument
> would serve us better; the only drawback is that anyone using the
> non-canonical form 'm4 --debugfile trace' instead of following the
> recommended 'm4 --debugfile=trace' will be broken.  But since --debugfile
> isn't that old, and the primary user that I am aware of (autoconf) uses
> the correct form, I'm okay with making this change.

I've gone ahead and pushed this change.

>  The older spellings
> of --error-output and -o options do not change in behavior for branch-1.4,
> although I'm thinking that 2 years has been long enough with --debugfile
> available that I can make branch-1.6 issue a deprecation warning for those
> (and thus open the door for m4 2.0 to use -o to specify where output goes,
> rather than where traces are dumped, consistent with other GNU programs
> like gcc).

Here's what I'm thinking of applying on branch-1.6:

- --
Don't work too hard, make some time for fun as well!

Eric Blake             [email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklRq70ACgkQ84KuGfSFAYDryQCcD8gycKcPGbZ1LhEqaShYFg+K
9vUAn0gbycLCbMOuK2FXizPwjqe8IDqb
=Pi7o
-----END PGP SIGNATURE-----

_______________________________________________
M4-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/m4-patches
m4.patch390 (text/plain, 4.2 KB)
From 9c4e3e51d29d2aaf218f5b835bbd72232976950f Mon Sep 17 00:00:00 2001
From: Eric Blake <[email protected]>
Date: Tue, 23 Dec 2008 17:07:47 -0700
Subject: [PATCH] Issue deprecation warning for -o/--error-output.

* src/m4.c (main): Add warning for deprecated option.
* doc/m4.texinfo (Debugging options): Document the change.
* NEWS: Likewise.

Signed-off-by: Eric Blake <[email protected]>
---
 ChangeLog      |    5 +++++
 NEWS           |    6 ++++++
 doc/m4.texinfo |   17 ++++++++++++-----
 src/m4.c       |   11 ++++++-----
 4 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ef11ce4..7f3bde2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2008-12-23  Eric Blake  <[email protected]>
 
+	Issue deprecation warning for -o/--error-output.
+	* src/m4.c (main): Add warning for deprecated option.
+	* doc/m4.texinfo (Debugging options): Document the change.
+	* NEWS: Likewise.
+
 	Add debugmode(o) to control dumpdef output location.
 	* src/m4.h (DEBUG_TRACE_OUTPUT_DUMPDEF): New macro.
 	(DEBUG_TRACE_VERBOSE): Update.
diff --git a/NEWS b/NEWS
index 45664c8..567820d 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,12 @@ Foundation, Inc.
 ** Remove the undocumented command-line option '-N', as no one complained
    about the assertion failure regression that it introduced in 1.4.7.
 
+** The `-o'/`--error-output' command-line options, which were replaced by
+   `--debugfile' in 1.4.7, now issue a deprecation warning.  This warning
+   harmlessly triggers with versions of Autoconf 2.60 and earlier, but can
+   be silenced by applying this patch:
+     http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=8dc951191
+
 ** Fix the `m4wrap' builtin to accumulate wrapped text in FIFO order, as
    required by POSIX.  The manual mentions a way to restore the LIFO order
    present in earlier GNU M4 versions.  NOTE: this change exposes a bug
diff --git a/doc/m4.texinfo b/doc/m4.texinfo
index 9e5b07c..2ab7290 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -936,11 +936,10 @@ Debugging options
 debug output is discarded.  @xref{Debugfile}, for more details.  The
 option @option{--debugfile} may be given more than once, and order is
 significant with respect to file names.  The spellings @option{-o} and
-@option{--error-output} are misleading and inconsistent with other
-@acronym{GNU} tools; for now they are silently accepted as synonyms of
-@option{--debugfile} and only recognized once, but in a future version
-of M4, using them will cause a warning to be issued.
-@comment FIXME make them warn in m4 1.6
+@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.
 
 @ignore
 @comment not worth including in the manual, but provides a good test
@@ -957,6 +956,14 @@ Debugging options
 @error{}m4trace: -1- bar -> `hello'
 @result{}hello
 @end example
+
+@comment options: -o /dev/null
+@example
+$ @kbd{m4 -o /dev/null
+@error{}m4: Warning: `-o' is deprecated, use `--debugfile' instead
+dumpdef(`divnum')
+@result{}
+@end example
 @end ignore
 
 @item -l @var{num}
diff --git a/src/m4.c b/src/m4.c
index 1206761..8d0221f 100644
--- a/src/m4.c
+++ b/src/m4.c
@@ -541,7 +541,8 @@ main (int argc, char *const *argv, char *const *envp)
 	break;
 
       case 'e':
-	error (0, 0, "Warning: `m4 -e' is deprecated, use `-i' instead");
+	error (0, 0, _("Warning: `%s' is deprecated, use `%s' instead"),
+		       "-e", "-i");
 	/* fall through */
       case 'i':
 	interactive = true;
@@ -560,10 +561,10 @@ main (int argc, char *const *argv, char *const *envp)
 
       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.  */
-	/* Don't call debug_set_output here, as it has side effects.  */
+	   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"),
+	       optchar == 'o' ? "-o" : "--error-output", "--debugfile");
 	debugfile = optarg;
 	break;
 
-- 
1.6.0.4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.