[PATCH 1/3] traces: show the full m4 invocation

Akim Demaille <[email protected]>
Newsgroups gmane.comp.parsers.bison.patches
Message-ID <[email protected]>
Unfortunately the effect of -dV is still position independent.

* src/output.c (output_skeleton): here.
---
 src/output.c | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/src/output.c b/src/output.c
index 1871fd75..5bee092d 100644
--- a/src/output.c
+++ b/src/output.c
@@ -698,17 +698,6 @@ output_skeleton (void)
 
   /* Create an m4 subprocess connected to us via two pipes.  */
 
-  if (trace_flag & trace_tools)
-    fprintf (stderr, "running: %s %s - %s %s\n",
-             m4, m4sugar, m4bison, skel);
-
-  /* Some future version of GNU M4 (most likely 1.6) may treat the -dV in a
-     position-dependent manner.  Keep it as the first argument so that all
-     files are traced.
-
-     See the thread starting at
-     <http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>
-     for details.  */
   int filter_fd[2];
   pid_t pid;
   {
@@ -730,6 +719,13 @@ output_skeleton (void)
 
     argv[i++] = "-I";
     argv[i++] = datadir;
+    /* Some future version of GNU M4 (most likely 1.6) may treat the
+       -dV in a position-dependent manner.  Keep it as the first
+       argument so that all files are traced.
+
+       See the thread starting at
+       <http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>
+       for details.  */
     if (trace_flag & trace_m4)
       argv[i++] = "-dV";
     argv[i++] = m4sugar;
@@ -739,6 +735,14 @@ output_skeleton (void)
     argv[i++] = NULL;
     aver (i <= ARRAY_CARDINALITY (argv));
 
+    if (trace_flag & trace_tools)
+      {
+        fputs ("running:", stderr);
+        for (int j = 0; argv[j]; ++j)
+          fprintf (stderr, " %s", argv[j]);
+        fputc ('\n', stderr);
+      }
+
     /* The ugly cast is because gnulib gets the const-ness wrong.  */
     pid = create_pipe_bidi ("m4", m4, (char **)(void*)argv, false, true,
                             true, filter_fd);
-- 
2.26.2
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.