bison-patches
[Top][All Lists]
Advanced

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

01-fyi-move-conds-up.patch


From: Akim Demaille
Subject: 01-fyi-move-conds-up.patch
Date: Mon, 17 Dec 2001 18:20:36 +0100

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        
        * src/files.c (output_files): Free the output_obstack.
        * src/main.c (main): Call print and print_graph conditionally.
        * src/print.c (print): Work unconditionally.
        * src/print_graph.c (print_graph): Work unconditionally.
        * src/conflicts.c (log_resolution): Output only if verbose_flag.
        
Index: src/conflicts.c
--- src/conflicts.c Sat, 08 Dec 2001 13:33:23 +0100 akim
+++ src/conflicts.c Sun, 16 Dec 2001 11:49:51 +0100 akim
@@ -40,10 +40,11 @@
 static inline void
 log_resolution (int state, int LAno, int token, char *resolution)
 {
-  obstack_fgrow4 (&output_obstack,
-                 _("\
+  if (verbose_flag)
+    obstack_fgrow4 (&output_obstack,
+                   _("\
 Conflict in state %d between rule %d and token %s resolved as %s.\n"),
-                 state, LAruleno[LAno], tags[token], resolution);
+                   state, LAruleno[LAno], tags[token], resolution);
 }
 
 
Index: src/files.c
--- src/files.c Sun, 16 Dec 2001 11:40:41 +0100 akim
+++ src/files.c Sun, 16 Dec 2001 11:46:09 +0100 akim
@@ -489,12 +489,13 @@
       char *temp_name;
 
       obstack_save (&attrs_obstack, attrsfile);
-      obstack_free (&attrs_obstack, NULL);
       temp_name = stringappend (short_base_name, EXT_GUARD_C);
 #ifndef MSDOS
       temp_name = stringappend (temp_name, src_extension);
 #endif /* MSDOS */
       obstack_save (&guard_obstack, temp_name);
-      obstack_free (&guard_obstack, NULL);
     }
+
+  obstack_free (&guard_obstack, NULL);
+  obstack_free (&attrs_obstack, NULL);
 }
Index: src/main.c
--- src/main.c Sat, 08 Dec 2001 13:24:47 +0100 akim
+++ src/main.c Sun, 16 Dec 2001 11:41:56 +0100 akim
@@ -93,10 +93,12 @@
     exit (1);
 
   /* Output the detailed report on the grammar.  */
-  print_results ();
+  if (verbose_flag)
+    print_results ();
 
   /* Output the VCG graph.  */
-  print_graph ();
+  if (graph_flag)
+    print_graph ();
 
   /* Output the tables and the parser to ftable.  In file output.  */
   output ();
Index: src/print.c
--- src/print.c Tue, 11 Dec 2001 20:27:03 +0100 akim
+++ src/print.c Sun, 16 Dec 2001 11:47:07 +0100 akim
@@ -307,35 +307,33 @@
 void
 print_results (void)
 {
-  if (verbose_flag)
-    {
-      int i;
-
-      /* We used to use just .out if SPEC_NAME_PREFIX (-p) was used, but
-        that conflicts with Posix.  */
-      FILE *out = xfopen (spec_verbose_file, "w");
-
-      size_t size = obstack_object_size (&output_obstack);
-      fwrite (obstack_finish (&output_obstack), 1, size, out);
-      if (size)
-       fputs ("\n\n", out);
-
-      reduce_output (out);
-      conflicts_output (out);
-
-      print_grammar (out);
-
-      /* New experimental feature: output all the items of a state,
-        not only its kernel.  Requires to run closure, which need
-        memory allocation/deallocation.  */
-      if (trace_flag)
-       new_closure (nitems);
-      for (i = 0; i < nstates; i++)
-       print_state (out, i);
-      if (trace_flag)
-       free_closure ();
+  int i;
 
-      xfclose (out);
-    }
+  /* We used to use just .out if SPEC_NAME_PREFIX (-p) was used, but
+     that conflicts with Posix.  */
+  FILE *out = xfopen (spec_verbose_file, "w");
+
+  size_t size = obstack_object_size (&output_obstack);
+  fwrite (obstack_finish (&output_obstack), 1, size, out);
   obstack_free (&output_obstack, NULL);
+
+  if (size)
+    fputs ("\n\n", out);
+
+  reduce_output (out);
+  conflicts_output (out);
+
+  print_grammar (out);
+
+  /* New experimental feature: output all the items of a state,
+     not only its kernel.  Requires to run closure, which need
+     memory allocation/deallocation.  */
+  if (trace_flag)
+    new_closure (nitems);
+  for (i = 0; i < nstates; i++)
+    print_state (out, i);
+  if (trace_flag)
+    free_closure ();
+
+  xfclose (out);
 }
Index: src/print_graph.c
--- src/print_graph.c Tue, 11 Dec 2001 20:27:03 +0100 akim
+++ src/print_graph.c Sun, 16 Dec 2001 11:41:56 +0100 akim
@@ -207,9 +207,6 @@
 {
   int i;
 
-  if (!graph_flag)
-    return;
-
   /* Output file.  */
   fgraph = xfopen (spec_graph_file, "w");
 



reply via email to

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