X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/bb0027a9aca454a80f737e0c49df0a231c50b996..41cce2f604996c7713d9025f8a719ea56d83783e:/src/main.c diff --git a/src/main.c b/src/main.c index c695ae5f..7ee6c673 100644 --- a/src/main.c +++ b/src/main.c @@ -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; }