X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/5ca3209b44b086e21ba82f038e8b82b40c6f33cc..ccdb39e0a6f95cb4a3f19c08885a7c421cdebedb:/src/main.c diff --git a/src/main.c b/src/main.c index dc28693f..04957a2b 100644 --- a/src/main.c +++ b/src/main.c @@ -74,7 +74,7 @@ main (int argc, char *argv[]) timevar_pop (TV_READER); if (complaint_issued) - exit (EXIT_FAILURE); + goto finish; /* Find useless nonterminals and productions and reduce the grammar. */ timevar_push (TV_REDUCE); @@ -138,7 +138,7 @@ main (int argc, char *argv[]) /* Stop if there were errors, to avoid trashing previous output files. */ if (complaint_issued) - exit (EXIT_FAILURE); + goto finish; /* Lookaheads are no longer needed. */ timevar_push (TV_FREE); @@ -158,6 +158,8 @@ main (int argc, char *argv[]) reduce_free (); conflicts_free (); grammar_free (); + /* FIXME: We are leaking all the other file names. */ + free (infile); /* The scanner memory cannot be released right after parsing, as it contains things such as user actions, prologue, epilogue etc. */ @@ -173,14 +175,11 @@ main (int argc, char *argv[]) if (trace_flag & trace_bitsets) bitset_stats_dump (stderr); + finish: + /* Stop timing and print the times. */ timevar_stop (TV_TOTAL); timevar_print (stderr); - /* Some ancient SunOS versions exit (0) if main returns, so use - `exit' to exit with nonzero status. */ - if (complaint_issued) - exit (EXIT_FAILURE); - - return EXIT_SUCCESS; + return complaint_issued ? EXIT_FAILURE : EXIT_SUCCESS; }