]> git.saurik.com Git - bison.git/blobdiff - src/main.c
(AC_PROG_LEX): Use instead of AM_PROG_LEX.
[bison.git] / src / main.c
index c695ae5fc68561ae35baac6824e2f7b1ab015a89..7ee6c673bec00ac4aeef7a573613ab00a640b58d 100644 (file)
@@ -51,8 +51,8 @@ main (int argc, char *argv[])
 {
   program_name = argv[0];
   setlocale (LC_ALL, "");
-  bindtextdomain (PACKAGE, LOCALEDIR);
-  textdomain (PACKAGE);
+  (void) bindtextdomain (PACKAGE, LOCALEDIR);
+  (void) textdomain (PACKAGE);
 
   getargs (argc, argv);
 
@@ -73,8 +73,8 @@ main (int argc, char *argv[])
   reader ();
   timevar_pop (TV_READER);
 
-  if (complain_message_count)
-    exit (1);
+  if (complaint_issued)
+    return EXIT_FAILURE;
 
   /* Find useless nonterminals and productions and reduce the grammar. */
   timevar_push (TV_REDUCE);
@@ -99,11 +99,6 @@ main (int argc, char *argv[])
   lalr ();
   timevar_pop (TV_LALR);
 
-  timevar_push (TV_FREE);
-  nullable_free ();
-  derives_free ();
-  timevar_pop (TV_FREE);
-
   /* Find and record any conflicts: places where one token of
      lookahead is not enough to disambiguate the parsing.  In file
      conflicts.  Also resolve s/r conflicts based on precedence
@@ -113,6 +108,14 @@ main (int argc, char *argv[])
   conflicts_print ();
   timevar_pop (TV_CONFLICTS);
 
+  /* Compute the parser tables.  */
+  timevar_push (TV_ACTIONS);
+  tables_generate ();
+  timevar_pop (TV_ACTIONS);
+
+  grammar_rules_never_reduced_report
+    (_("rule never reduced because of conflicts"));
+
   /* Output file names. */
   compute_output_file_names ();
 
@@ -124,11 +127,6 @@ main (int argc, char *argv[])
       timevar_pop (TV_REPORT);
     }
 
-  /* Stop if there were errors, to avoid trashing previous output
-     files.  */
-  if (complain_message_count)
-    exit (1);
-
   /* Output the VCG graph.  */
   if (graph_flag)
     {
@@ -137,10 +135,10 @@ main (int argc, char *argv[])
       timevar_pop (TV_GRAPH);
     }
 
-  /* Compute the parser tables.  */
-  timevar_push (TV_ACTIONS);
-  tables_generate ();
-  timevar_pop (TV_ACTIONS);
+  /* Stop if there were errors, to avoid trashing previous output
+     files.  */
+  if (complaint_issued)
+    return EXIT_FAILURE;
 
   /* Lookaheads are no longer needed. */
   timevar_push (TV_FREE);
@@ -153,6 +151,8 @@ main (int argc, char *argv[])
   timevar_pop (TV_PARSER);
 
   timevar_push (TV_FREE);
+  nullable_free ();
+  derives_free ();
   tables_free ();
   states_free ();
   reduce_free ();
@@ -177,5 +177,5 @@ main (int argc, char *argv[])
   timevar_stop (TV_TOTAL);
   timevar_print (stderr);
 
-  return complain_message_count ? EXIT_FAILURE : EXIT_SUCCESS;
+  return complaint_issued ? EXIT_FAILURE : EXIT_SUCCESS;
 }