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.6, updated. v1.5.89a-80-


From: Eric Blake
Subject: [SCM] GNU M4 source repository branch, branch-1.6, updated. v1.5.89a-80-gdf6bfee
Date: Wed, 24 Dec 2008 03:27:00 +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=df6bfeeaac6bdc1ef8e5406c6ac051af2c10d0d8

The branch, branch-1.6 has been updated
       via  df6bfeeaac6bdc1ef8e5406c6ac051af2c10d0d8 (commit)
       via  ba36cd563013bc30871a299708864a6ebe3f1281 (commit)
      from  b881a17fe17d505e7fc5f6f9014ad1da152703d9 (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 df6bfeeaac6bdc1ef8e5406c6ac051af2c10d0d8
Author: Eric Blake <address@hidden>
Date:   Mon Dec 22 05:45:40 2008 -0700

    Add debugmode(o) to control dumpdef output location.
    
    * src/m4.h (DEBUG_TRACE_OUTPUT_DUMPDEF): New macro.
    (DEBUG_TRACE_VERBOSE): Update.
    * src/debug.c (debug_decode): Support new debug option.
    * src/builtin.c (m4_dumpdef): When set, force dumpdef to stderr
    rather than the debug file.
    * src/m4.c (usage): Document it.
    * doc/m4.texinfo (Debugmode, Dumpdef, Debugging options)
    (Debugfile): Likewise.
    * NEWS: Likewise.
    Based on an autoconf bug report by Paolo Bonzini.
    
    Signed-off-by: Eric Blake <address@hidden>

commit ba36cd563013bc30871a299708864a6ebe3f1281
Author: Eric Blake <address@hidden>
Date:   Mon Dec 22 10:54: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>
    (cherry picked from commit c59c67993219ec04965b1347b44a7e3d09ff425c)

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

Summary of changes:
 ChangeLog      |   23 ++++++++++++++
 NEWS           |   39 ++++++++++++++----------
 doc/m4.texinfo |   91 +++++++++++++++++++++++++++++++++++++++++++++++--------
 src/builtin.c  |   22 +++++++------
 src/debug.c    |    4 ++
 src/m4.c       |   41 +++++++++++++++----------
 src/m4.h       |    4 ++-
 7 files changed, 167 insertions(+), 57 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a0ce716..ef11ce4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2008-12-23  Eric Blake  <address@hidden>
+
+       Add debugmode(o) to control dumpdef output location.
+       * src/m4.h (DEBUG_TRACE_OUTPUT_DUMPDEF): New macro.
+       (DEBUG_TRACE_VERBOSE): Update.
+       * src/debug.c (debug_decode): Support new debug option.
+       * src/builtin.c (m4_dumpdef): When set, force dumpdef to stderr
+       rather than the debug file.
+       * src/m4.c (usage): Document it.
+       * doc/m4.texinfo (Debugmode, Dumpdef, Debugging options)
+       (Debugfile): Likewise.
+       * NEWS: Likewise.
+       Based on an autoconf bug report by Paolo Bonzini.
+
+       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.
+
 2008-12-22  Eric Blake  <address@hidden>
 
        Use @var correctly.
diff --git a/NEWS b/NEWS
index df960e7..45664c8 100644
--- a/NEWS
+++ b/NEWS
@@ -52,23 +52,13 @@ Foundation, Inc.
    `-d-V' to disable prior debug settings from the command line, similar to
    using the builtin `debugmode' without arguments.  The option
    `--debugmode' is added as an alias for `-d'.  The new flag `d' is added
-   to control whether dereferncing an undefined macro causes a warning;
+   to control whether dereferencing an undefined macro causes a warning;
    this flag is enabled by default if neither `-d' nor `-E' are specified.
-   When given the empty string, the mode is treated as `+adeq' instead of
-   `aeq'.  Also, the position of `-d' with respect to files on the command
-   line is now significant.
-
-** New `-g'/`--gnu' command-line option overrides `-G'/`--traditional'.
-   For now, the environment variable POSIXLY_CORRECT has no effect on M4
-   behavior; but a future release of M4 will behave as though --traditional
-   is implied if POSIXLY_CORRECT is set (this future change is necessary,
-   because in the current release, there is no way to disable GNU
-   extensions that conflict with POSIX without the use of a non-POSIX
-   command-line argument).  Clients of M4 that want to use GNU extensions,
-   even when POSIXLY_CORRECT is set, should start using the -g command-line
-   argument, even though it is currently a no-op if -G did not appear
-   earlier in the command line, so that the client will not break in the
-   face of an upgraded m4 and a POSIXLY_CORRECT execution environment.
+   The new flag `o' is added to control whether `dumpdef' outputs to stderr
+   or the current `debugfile' location.  When the command line option is
+   given the empty string, the mode is treated as `+adeq' instead of `aeq'.
+   Also, the position of `-d' with respect to files on the command line is
+   now significant.
 
 ** A new predefined text macro, `__m4_version__', expands to the unquoted
    version number of M4, if GNU extensions are enabled.  While you should
@@ -135,6 +125,23 @@ contains the following beta features that were deemed 
worth deferring until
 
 ** A number of portability improvements inherited from gnulib.
 
+* Noteworthy changes in Version 1.4.13 (2008-12-??) [stable]
+  Released by Eric Blake, based on git version 1.4.12.*
+
+** The manual is now distributed under the terms of FDL 1.3.
+
+** 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]
   Released by Eric Blake, based on git version 1.4.11.*
 
diff --git a/doc/m4.texinfo b/doc/m4.texinfo
index 61da3e6..9e5b07c 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -923,18 +923,41 @@ len(`123')
 @result{}3
 @end example
 
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
+Redirect 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.
address@hidden, for more details.  The spellings @option{-o} and
+are still printed to standard error.  Output from @code{dumpdef} goes to
+this file when the debug level @code{o} is not set (@pxref{Debugmode}).
+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{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
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 FIXME make them warn in m4 1.6
+
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
@@ -3973,12 +3996,13 @@ If you want to see what a name expands into, you can 
use the builtin
 @code{dumpdef}:
 
 @deffn Builtin dumpdef (@address@hidden)
-Accepts any number of arguments.  If called without any arguments,
-it displays the definitions of all known names, otherwise it displays
-the definitions of each @var{name} given.  The output is printed to the
-current debug file (usually standard error), and is sorted by name.  If
-a @var{name} is undefined, the @samp{d} debug level controls whether a
-warning is issued (@pxref{Debugmode}).
+Accepts any number of arguments.  If called without any arguments, it
+displays the definitions of all known names, otherwise it displays the
+definitions of each @var{name} given, sorted by name.  If a @var{name}
+is undefined, the @samp{d} debug level controls whether a warning is
+issued (@pxref{Debugmode}).  Likewise, the @samp{o} debug level controls
+whether the output is issued to standard error or the current debug
+file (@pxref{Debugfile}).
 
 The expansion of @code{dumpdef} is void.
 @end deffn
@@ -4289,6 +4313,11 @@ changed.
 In debug and trace output, include the current input line number in the
 output line.
 
address@hidden o
+Output @code{dumpdef} data to standard error instead of the current
+debug file.  This can be useful when post-processing trace output, where
+interleaving dumpdef and trace output can cause ambiguities.
+
 @item p
 In debug output, print a message when a named file is found through the
 path search mechanism (@pxref{Search Path}), giving the actual file name
@@ -4420,7 +4449,9 @@ Invoking m4}), or with the builtin macro @code{debugfile}:
 Sends all further debug and trace output to @var{file}, opened in append
 mode.  If @var{file} is the empty string, debug and trace output are
 discarded.  If @code{debugfile} is called without any arguments, debug
-and trace output are sent to standard error.  This does not affect
+and trace output are sent to standard error.  Output from @code{dumpdef}
+is sent to this file if the debug level @code{o} is not set
+(@pxref{Debugmode}).  This does not affect
 warnings, error messages, or @code{errprint} output, which are
 always sent to standard error.  If @var{file} cannot be opened, the
 current debug file is unchanged, and an error is issued.
@@ -4448,6 +4479,38 @@ divnum
 @result{}0
 @end example
 
+Sometimes it is useful to post-process trace output, even though there
+is no standardized format for trace output.  In this situation, forcing
address@hidden to output to standard error instead of the default of the
+current debug file will avoid any ambiguities between the two types of
+output; it also allows debugging via @code{dumpdef} when debug output is
+discarded.
+
address@hidden
+$ @kbd{m4 -d}
+traceon(`divnum')
address@hidden
+divnum
address@hidden: -1- divnum -> `0'
address@hidden
+dumpdef(`divnum')
address@hidden:@tabchar{}<divnum>
address@hidden
+debugfile(`')
address@hidden
+divnum
address@hidden
+dumpdef(`divnum')
address@hidden
+debugmode(`+o')
address@hidden
+divnum
address@hidden
+dumpdef(`divnum')
address@hidden:@tabchar{}<divnum>
address@hidden
address@hidden example
+
 @node Input Control
 @chapter Input control
 
diff --git a/src/builtin.c b/src/builtin.c
index 613e1d2..33ef9e5 100644
--- a/src/builtin.c
+++ b/src/builtin.c
@@ -885,9 +885,11 @@ m4_dumpdef (struct obstack *obs, int argc, macro_arguments 
*argv)
   int i;
   struct dump_symbol_data data;
   const builtin *bp;
+  FILE *output = (debug_level & DEBUG_TRACE_OUTPUT_DUMPDEF) ? stderr : debug;
+
 
   /* If there's no debug stream to dump to, skip all of this work.  */
-  if (!debug)
+  if (!output)
     return;
 
   data.obs = obs;
@@ -925,19 +927,19 @@ m4_dumpdef (struct obstack *obs, int argc, 
macro_arguments *argv)
     {
       /* TODO - add debugmode(b) option to control quoting style?  */
       fwrite (SYMBOL_NAME (data.base[0]), 1, SYMBOL_NAME_LEN (data.base[0]),
-             debug);
-      fputc (':', debug);
-      fputc ('\t', debug);
+             output);
+      fputc (':', output);
+      fputc ('\t', output);
 
       switch (SYMBOL_TYPE (data.base[0]))
        {
        case TOKEN_TEXT:
          if (debug_level & DEBUG_TRACE_QUOTE)
-           fwrite (curr_quote.str1, 1, curr_quote.len1, debug);
+           fwrite (curr_quote.str1, 1, curr_quote.len1, output);
          fwrite (SYMBOL_TEXT (data.base[0]), 1,
-                 SYMBOL_TEXT_LEN (data.base[0]), debug);
+                 SYMBOL_TEXT_LEN (data.base[0]), output);
          if (debug_level & DEBUG_TRACE_QUOTE)
-           fwrite (curr_quote.str2, 1, curr_quote.len2, debug);
+           fwrite (curr_quote.str2, 1, curr_quote.len2, output);
          break;
 
        case TOKEN_FUNC:
@@ -947,7 +949,7 @@ m4_dumpdef (struct obstack *obs, int argc, macro_arguments 
*argv)
              assert (!"m4_dumpdef");
              abort ();
            }
-         xfprintf (debug, "<%s>", bp->name);
+         xfprintf (output, "<%s>", bp->name);
          break;
 
        default:
@@ -955,7 +957,7 @@ m4_dumpdef (struct obstack *obs, int argc, macro_arguments 
*argv)
          abort ();
          break;
        }
-      fputc ('\n', debug);
+      fputc ('\n', output);
     }
 }
 
@@ -1806,7 +1808,7 @@ m4_debugfile (struct obstack *obs, int argc, 
macro_arguments *argv)
   if (argc == 1)
     debug_set_output (me, NULL);
   else if (!debug_set_output (me, ARG (1)))
-    m4_warn (errno, me, _("cannot set error file: %s"),
+    m4_warn (errno, me, _("cannot set debug file %s"),
             quotearg_style (locale_quoting_style, ARG (1)));
 }
 
diff --git a/src/debug.c b/src/debug.c
index babaf87..b97fca3 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -109,6 +109,10 @@ debug_decode (const char *opts)
              level |= DEBUG_TRACE_DEREF;
              break;
 
+           case 'o':
+             level |= DEBUG_TRACE_OUTPUT_DUMPDEF;
+             break;
+
            case 'V':
              level |= DEBUG_TRACE_VERBOSE;
              break;
diff --git a/src/m4.c b/src/m4.c
index bf8a657..1206761 100644
--- a/src/m4.c
+++ b/src/m4.c
@@ -71,7 +71,7 @@ int retcode;
 struct macro_definition
 {
   struct macro_definition *next;
-  int code;                    /* D, U, s, t, or '\1' */
+  int code;                    /* See label `defer'.  */
   const char *arg;
 };
 typedef struct macro_definition macro_definition;
@@ -218,13 +218,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 (_("\
@@ -258,7 +258,8 @@ Frozen state files:\n\
 Debugging:\n\
   -d, --debug[=[-|+]FLAGS], --debugmode[=[-|+]FLAGS]\n\
                                set debug level (no FLAGS implies `+adeq')\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);
@@ -274,6 +275,7 @@ FLAGS is any of:\n\
   l   include current input line number in trace and debug\n\
 "), stdout);
       fputs (_("\
+  o   output dumpdef to stderr rather than debug file\n\
   p   show results of path searches in debug\n\
   q   quote values in dumpdef and trace, useful with a or e\n\
   t   trace all macro calls, regardless of per-macro traceon state\n\
@@ -340,7 +342,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},
   {"warn-macro-sequence", optional_argument, NULL, WARN_MACRO_SEQUENCE_OPTION},
 
   {"help", no_argument, NULL, HELP_OPTION},
@@ -466,6 +468,7 @@ main (int argc, char *const *argv, char *const *envp)
       case 'U':
       case 's':
       case 't':
+      case DEBUGFILE_OPTION:
       defer:
        /* Arguments that cannot be handled until later are accumulated.  */
 
@@ -560,7 +563,6 @@ 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;
@@ -588,7 +590,7 @@ main (int argc, char *const *argv, char *const *envp)
   /* Do the basic initializations.  */
   if (debugfile && !debug_set_output (NULL, debugfile))
     m4_error (0, errno, NULL, _("cannot set debug file %s"),
-              quotearg_style (locale_quoting_style, debugfile));
+             quotearg_style (locale_quoting_style, debugfile));
 
   input_init ();
   output_init ();
@@ -616,30 +618,30 @@ main (int argc, char *const *argv, char *const *envp)
     {
       macro_definition *next;
       symbol *sym;
+      const char *arg = defines->arg;
 
       switch (defines->code)
        {
        case 'D':
          {
-           const char *value = strchr (defines->arg, '=');
-           size_t len = value ? value - defines->arg : strlen (defines->arg);
-           define_user_macro (defines->arg, len, value ? value + 1 : "",
+           const char *value = strchr (arg, '=');
+           size_t len = value ? value - arg : strlen (arg);
+           define_user_macro (arg, len, value ? value + 1 : "",
                               value ? SIZE_MAX : 0, SYMBOL_INSERT);
          }
          break;
 
        case 'U':
-         lookup_symbol (defines->arg, strlen (defines->arg), SYMBOL_DELETE);
+         lookup_symbol (arg, strlen (arg), SYMBOL_DELETE);
          break;
 
        case 'd':
-         if (debug_decode (defines->arg) < 0)
-           error (0, 0, "bad debug flags: `%s'", defines->arg);
+         if (debug_decode (arg) < 0)
+           error (0, 0, "bad debug flags: `%s'", arg);
          break;
 
        case 't':
-         sym = lookup_symbol (defines->arg, strlen (defines->arg),
-                              SYMBOL_INSERT);
+         sym = lookup_symbol (arg, strlen (arg), SYMBOL_INSERT);
          SYMBOL_TRACED (sym) = true;
          break;
 
@@ -648,7 +650,14 @@ main (int argc, char *const *argv, char *const *envp)
          break;
 
        case '\1':
-         process_file (defines->arg);
+         process_file (arg);
+         break;
+
+       case DEBUGFILE_OPTION:
+         if (!debug_set_output (NULL, arg))
+            m4_error (0, errno, NULL, _("cannot set debug file %s"),
+                      quotearg_style (locale_quoting_style,
+                                      arg ? arg : _("stderr")));
          break;
 
        default:
diff --git a/src/m4.h b/src/m4.h
index 76c697b..0611db4 100644
--- a/src/m4.h
+++ b/src/m4.h
@@ -196,9 +196,11 @@ extern FILE *debug;
 #define DEBUG_TRACE_CALLID 0x200
 /* d: warn if dereferencing undefined macro */
 #define DEBUG_TRACE_DEREF 0x400
+/* o: output dumpdef to stderr, not debug file */
+#define DEBUG_TRACE_OUTPUT_DUMPDEF 0x800
 
 /* V: very verbose --  print everything */
-#define DEBUG_TRACE_VERBOSE 0x7FF
+#define DEBUG_TRACE_VERBOSE 0xFFF
 /* default flags -- equiv: adeq */
 #define DEBUG_TRACE_DEFAULT 0x407
 


hooks/post-receive
--
GNU M4 source repository




reply via email to

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