m4-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU M4 source repository branch, branch-1.4, updated. v1.4.12-12-g


From: Eric Blake
Subject: [SCM] GNU M4 source repository branch, branch-1.4, updated. v1.4.12-12-gc59c679
Date: Wed, 24 Dec 2008 03:26:58 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU M4 source repository".

http://git.sv.gnu.org/gitweb/?p=m4.git;a=commitdiff;h=c59c67993219ec04965b1347b44a7e3d09ff425c

The branch, branch-1.4 has been updated
       via  c59c67993219ec04965b1347b44a7e3d09ff425c (commit)
      from  a40a4d17b52d260a6629e2d02052e283a787ad66 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c59c67993219ec04965b1347b44a7e3d09ff425c
Author: Eric Blake <address@hidden>
Date:   Mon Dec 22 06:50:38 2008 -0700

    Make --debugfile argument optional.
    
    * src/builtin.c (m4_debugfile): Make error message consistent.
    * src/m4.c (long_options): Make the argument optional, to allow
    setting debug file back to stderr.
    (main): Make --debugfile order-dependent.
    (usage): Document this.
    * doc/m4.texinfo (Debugging options): Likewise.
    * NEWS: Likewise.
    
    Signed-off-by: Eric Blake <address@hidden>

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog      |    9 +++++++
 NEWS           |    7 ++++++
 doc/m4.texinfo |   32 ++++++++++++++++++++++-----
 src/builtin.c  |    2 +-
 src/m4.c       |   65 +++++++++++++++++++++++++++++++-------------------------
 5 files changed, 79 insertions(+), 36 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 18cd97e..836bd83 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2008-12-22  Eric Blake  <address@hidden>
 
+       Make --debugfile argument optional.
+       * src/builtin.c (m4_debugfile): Make error message consistent.
+       * src/m4.c (long_options): Make the argument optional, to allow
+       setting debug file back to stderr.
+       (main): Make --debugfile order-dependent.
+       (usage): Document this.
+       * doc/m4.texinfo (Debugging options): Likewise.
+       * NEWS: Likewise.
+
        Use @var correctly.
        * doc/m4.texinfo (Operation modes, Preprocessor features)
        (Limits control, Frozen state, Debugging options): Use lower case
diff --git a/NEWS b/NEWS
index 1be2c28..906601f 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,13 @@ Foundation, Inc.
 ** The `divert' and `undivert' builtins have been made more efficient
    when using temporary files for large diversions.
 
+** The command line option `--debugfile', introduced in 1.4.7, now
+   treats its argument as optional, in order to allow setting the debug
+   output back to stderr when used without an argument; and order is now
+   significant with respect to command line files.  You must therefore use
+   `m4 --debugfile=trace file', not `m4 file --debugfile trace'.  This
+   change does not affect the deprecated `-o'/`--error-output' option.
+
 ** A number of portability improvements inherited from gnulib.
 
 * Noteworthy changes in Version 1.4.12 (2008-10-10) [stable]
diff --git a/doc/m4.texinfo b/doc/m4.texinfo
index 16164e4..200905a 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -853,18 +853,38 @@ controls the format and amount of information presented 
by the debugging
 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 address@hidden
address@hidden address@hidden@address@hidden
 @itemx -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.  The spellings @option{-o} and
+are still printed to standard error.  If these options are not used, or
+if @var{file} is unspecified (only possible for @option{--debugfile}),
+debug output goes to standard error; if @var{file} is the empty string,
+debug output is discarded.  @xref{Debug Output}, 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
address@hidden, but in a future version of M4, using them will
-cause a warning to be issued.
address@hidden and only recognized once, but in a future version
+of M4, using them will cause a warning to be issued.
+
address@hidden
address@hidden not worth including in the manual, but provides a good test
+
address@hidden examples
address@hidden options: -Dbar=hello -tbar --debugfile= foo --debugfile -
address@hidden
+$ @kbd{m4 -d -Iexamples -Dbar=hello -tbar --debugfile= foo --debugfile -
address@hidden
+errprint(`hi
+')dnl
address@hidden
+bar
address@hidden: -1- bar -> `hello'
address@hidden
address@hidden example
address@hidden ignore
 
 @item -l @var{num}
 @itemx address@hidden
diff --git a/src/builtin.c b/src/builtin.c
index 03bb649..50f10cd 100644
--- a/src/builtin.c
+++ b/src/builtin.c
@@ -1662,7 +1662,7 @@ m4_debugfile (struct obstack *obs, int argc, token_data 
**argv)
     debug_set_output (NULL);
   else if (!debug_set_output (ARG (1)))
     M4ERROR ((warning_status, errno,
-             "cannot set error file: `%s'", ARG (1)));
+             "cannot set debug file `%s'", ARG (1)));
 }
 
 /* This section contains text processing macros: "len", "index",
diff --git a/src/m4.c b/src/m4.c
index befc7a9..65b5092 100644
--- a/src/m4.c
+++ b/src/m4.c
@@ -79,7 +79,7 @@ int retcode;
 struct macro_definition
 {
   struct macro_definition *next;
-  int code;                    /* D, U, s, t, or '\1' */
+  int code;                    /* D, U, s, t, '\1', or DEBUGFILE_OPTION.  */
   const char *arg;
 };
 typedef struct macro_definition macro_definition;
@@ -125,7 +125,7 @@ m4_error_at_line (int status, int errnum, const char *file, 
int line,
 #  define MAX(a,b) ((a) < (b) ? (b) : (a))
 # endif
 # define NSIG (MAX (SIGABRT, MAX (SIGILL, MAX (SIGFPE,  \
-                                               MAX (SIGSEGV, SIGBUS)))) + 1)
+                                              MAX (SIGSEGV, SIGBUS)))) + 1)
 #endif
 
 /* Pre-translated messages for program errors.  Do not translate in
@@ -144,20 +144,20 @@ fault_handler (int signo)
   if (signo)
     {
       /* POSIX states that reading static memory is, in general, not
-         async-safe.  However, the static variables that we read are
-         never modified once this handler is installed, so this
-         particular usage is safe.  And it seems an oversight that
-         POSIX claims strlen is not async-safe.  */
+        async-safe.  However, the static variables that we read are
+        never modified once this handler is installed, so this
+        particular usage is safe.  And it seems an oversight that
+        POSIX claims strlen is not async-safe.  */
       write (STDERR_FILENO, program_name, strlen (program_name));
       write (STDERR_FILENO, ": ", 2);
       write (STDERR_FILENO, program_error_message,
-             strlen (program_error_message));
+            strlen (program_error_message));
       if (signal_message[signo])
-        {
-          write (STDERR_FILENO, ": ", 2);
-          write (STDERR_FILENO, signal_message[signo],
-                 strlen (signal_message[signo]));
-        }
+       {
+         write (STDERR_FILENO, ": ", 2);
+         write (STDERR_FILENO, signal_message[signo],
+                strlen (signal_message[signo]));
+       }
       write (STDERR_FILENO, "\n", 1);
       _exit (EXIT_INTERNAL_ERROR);
     }
@@ -191,13 +191,13 @@ Operation modes:\n\
 ", stdout);
       xprintf ("\
   -E, --fatal-warnings         once: warnings become errors, twice: stop\n\
-                               execution at first error\n\
+                                 execution at first error\n\
   -i, --interactive            unbuffer output, ignore interrupts\n\
   -P, --prefix-builtins        force a `m4_' prefix to all builtins\n\
   -Q, --quiet, --silent        suppress some warnings for builtins\n\
       --warn-macro-sequence[=REGEXP]\n\
                                warn if macro definition matches REGEXP,\n\
-                               default %s\n\
+                                 default %s\n\
 ", DEFAULT_MACRO_SEQUENCE);
 #ifdef ENABLE_CHANGEWORD
       fputs ("\
@@ -230,7 +230,8 @@ Frozen state files:\n\
 \n\
 Debugging:\n\
   -d, --debug[=FLAGS]          set debug level (no FLAGS implies `aeq')\n\
-      --debugfile=FILE         redirect debug and trace output\n\
+      --debugfile[=FILE]       redirect debug and trace output to FILE\n\
+                                 (default stderr, discard if empty string)\n\
   -l, --arglength=NUM          restrict macro tracing size\n\
   -t, --trace=NAME             trace NAME when it is defined\n\
 ", stdout);
@@ -303,7 +304,7 @@ static const struct option long_options[] =
   {"undefine", required_argument, NULL, 'U'},
   {"word-regexp", required_argument, NULL, 'W'},
 
-  {"debugfile", required_argument, NULL, DEBUGFILE_OPTION},
+  {"debugfile", optional_argument, NULL, DEBUGFILE_OPTION},
   {"diversions", required_argument, NULL, DIVERSIONS_OPTION},
   {"warn-macro-sequence", optional_argument, NULL, WARN_MACRO_SEQUENCE_OPTION},
 
@@ -387,7 +388,7 @@ main (int argc, char *const *argv, char *const *envp)
      handlers.  */
   program_error_message
     = xasprintf (_("internal error detected; please report this bug to <%s>"),
-                 PACKAGE_BUGREPORT);
+                PACKAGE_BUGREPORT);
   signal_message[SIGSEGV] = xstrdup (strsignal (SIGSEGV));
   signal_message[SIGABRT] = xstrdup (strsignal (SIGABRT));
   signal_message[SIGILL] = xstrdup (strsignal (SIGILL));
@@ -415,10 +416,10 @@ main (int argc, char *const *argv, char *const *envp)
     char *crash = getenv ("M4_CRASH");
     if (crash)
       {
-        if (!atoi (crash))
-          ++*(int *) 8;
-        assert (false);
-        abort ();
+       if (!atoi (crash))
+         ++*(int *) 8;
+       assert (false);
+       abort ();
       }
   }
 #endif /* DEBUG_STKOVF */
@@ -455,6 +456,7 @@ main (int argc, char *const *argv, char *const *envp)
       case 's':
       case 't':
       case '\1':
+      case DEBUGFILE_OPTION:
        /* Arguments that cannot be handled until later are accumulated.  */
 
        defn = (macro_definition *) xmalloc (sizeof (macro_definition));
@@ -548,17 +550,16 @@ main (int argc, char *const *argv, char *const *envp)
           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:
        /* Don't call debug_set_output here, as it has side effects.  */
        debugfile = optarg;
        break;
 
       case WARN_MACRO_SEQUENCE_OPTION:
-         /* Don't call set_macro_sequence here, as it can exit.
-            --warn-macro-sequence sets optarg to NULL (which uses the
-            default regexp); --warn-macro-sequence= sets optarg to ""
-            (which disables these warnings).  */
-        macro_sequence = optarg;
+        /* Don't call set_macro_sequence here, as it can exit.
+           --warn-macro-sequence sets optarg to NULL (which uses the
+           default regexp); --warn-macro-sequence= sets optarg to ""
+           (which disables these warnings).  */
+       macro_sequence = optarg;
        break;
 
       case VERSION_OPTION:
@@ -575,7 +576,7 @@ main (int argc, char *const *argv, char *const *envp)
 
   /* Do the basic initializations.  */
   if (debugfile && !debug_set_output (debugfile))
-    M4ERROR ((0, errno, "cannot set debug file `%s'", debugfile));
+    M4ERROR ((warning_status, errno, "cannot set debug file `%s'", debugfile));
 
   input_init ();
   output_init ();
@@ -633,7 +634,13 @@ main (int argc, char *const *argv, char *const *envp)
 
        case '\1':
          seen_file = true;
-          process_file (defines->arg);
+         process_file (defines->arg);
+         break;
+
+       case DEBUGFILE_OPTION:
+         if (!debug_set_output (defines->arg))
+           M4ERROR ((warning_status, errno, "cannot set debug file `%s'",
+                     debugfile ? debugfile : _("stderr")));
          break;
 
        default:


hooks/post-receive
--
GNU M4 source repository




reply via email to

[Prev in Thread] Current Thread [Next in Thread]