bison-patches
[Top][All Lists]
Advanced

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

[PATCH 3/5] maint: prepare forthcoming changes


From: Victor Santet
Subject: [PATCH 3/5] maint: prepare forthcoming changes
Date: Fri, 29 Jun 2012 15:22:11 +0200

* src/gram.c (rule_rhs_print): Do not print new line anymore.
(rule_print): Make it static.
* src/closure.c, src/derives.c, src/gram.c: Adjust.
---
 src/closure.c |    1 +
 src/derives.c |    1 +
 src/gram.c    |   26 +++++++++++++-------------
 src/gram.h    |    3 ---
 4 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/src/closure.c b/src/closure.c
index 929aa77..ccd0565 100644
--- a/src/closure.c
+++ b/src/closure.c
@@ -103,6 +103,7 @@ print_fderives (void)
         {
           fprintf (stderr, "\t\t%3d ", r);
           rule_rhs_print (&rules[r], stderr);
+          fprintf (stderr, "\n");
         }
     }
   fprintf (stderr, "\n\n");
diff --git a/src/derives.c b/src/derives.c
index a0afbb3..8902392 100644
--- a/src/derives.c
+++ b/src/derives.c
@@ -52,6 +52,7 @@ print_derives (void)
         {
           fprintf (stderr, "\t\t%3d ", (*rp)->user_number);
           rule_rhs_print (*rp, stderr);
+          fprintf (stderr, "\n");
         }
     }
 
diff --git a/src/gram.c b/src/gram.c
index 810311f..3089f46 100644
--- a/src/gram.c
+++ b/src/gram.c
@@ -105,11 +105,10 @@ rule_rhs_print (rule *r, FILE *out)
       item_number *rp;
       for (rp = r->rhs; *rp >= 0; rp++)
         fprintf (out, " %s", symbols[*rp]->tag);
-      fputc ('\n', out);
     }
   else
     {
-      fprintf (out, " /* %s */\n", _("empty"));
+      fprintf (out, " /* %s */", _("empty"));
     }
 }
 
@@ -133,7 +132,7 @@ rule_rhs_print_xml (rule *r, FILE *out, int level)
     }
 }
 
-void
+static void
 rule_print (rule *r, FILE *out)
 {
   fprintf (out, "%s:", r->lhs->tag);
@@ -189,6 +188,7 @@ grammar_rules_partial_print (FILE *out, const char *title,
       first = false;
       rule_lhs_print (&rules[r], previous_lhs, out);
       rule_rhs_print (&rules[r], out);
+      fprintf (out, "\n");
       previous_lhs = rules[r].lhs;
     }
   if (!first)
@@ -296,6 +296,7 @@ grammar_dump (FILE *out, const char *title)
       {
         fprintf (out, "%-5d  ", r);
         rule_print (&rules[r], out);
+        fprintf (out, "\n");
       }
   }
   fprintf (out, "\n\n");
@@ -305,16 +306,15 @@ void
 grammar_rules_useless_report (const char *message)
 {
   rule_number r;
-  for (r = 0; r < nrules ; ++r)
-    if (!rules[r].useful)
-      {
-        complain_at (rules[r].location, Wother, "%s: ", message);
-        if (warnings_flag & Wother)
-          {
-            rule_print (&rules[r], stderr);
-            fflush (stderr);
-          }
-      }
+  if (warnings_flag & Wother)
+    for (r = 0; r < nrules ; ++r)
+      if (!rules[r].useful)
+        {
+          complain_at (rules[r].location, Wother | silent, "%s: ", message);
+          rule_print (&rules[r], stderr);
+          fprintf (stderr, "\n");
+          fflush (stderr);
+        }
 }
 
 void
diff --git a/src/gram.h b/src/gram.h
index 75b3b0a..e502b78 100644
--- a/src/gram.h
+++ b/src/gram.h
@@ -229,9 +229,6 @@ size_t rule_rhs_length (rule *r);
 /* Print this rule's RHS on OUT.  */
 void rule_rhs_print (rule *r, FILE *out);
 
-/* Print this rule on OUT.  */
-void rule_print (rule *r, FILE *out);
-
 
 
 
-- 
1.7.9.5




reply via email to

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