X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/fd7f0289bcfa2e830439e37395fd91f0d7587a39..d8ce7031024f463a8ba96fc7b2a75facdc52ecb9:/src/gram.c diff --git a/src/gram.c b/src/gram.c index 4ee56867..f6cc3c5d 100644 --- a/src/gram.c +++ b/src/gram.c @@ -1,6 +1,6 @@ /* Allocate input grammar variables for Bison. - Copyright (C) 1984, 1986, 1989, 2001-2003, 2005-2012 Free Software + Copyright (C) 1984, 1986, 1989, 2001-2003, 2005-2013 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -93,16 +93,14 @@ rule_rhs_length (rule const *r) void rule_rhs_print (rule const *r, FILE *out) { - if (*r->rhs >= 0) + if (0 <= *r->rhs) { item_number *rp; for (rp = r->rhs; *rp >= 0; rp++) fprintf (out, " %s", symbols[*rp]->tag); } else - { - fprintf (out, " /* %s */", _("empty")); - } + fputs (" %empty", out); } static void @@ -125,13 +123,6 @@ rule_rhs_print_xml (rule const *r, FILE *out, int level) } } -static void -rule_print (rule const *r, FILE *out) -{ - fprintf (out, "%s:", r->lhs->tag); - rule_rhs_print (r, out); -} - void ritem_print (FILE *out) { @@ -289,8 +280,8 @@ grammar_dump (FILE *out, const char *title) rule_number r; for (r = 0; r < nrules + nuseless_productions; r++) { - fprintf (out, "%-5d ", r); - rule_print (&rules[r], out); + fprintf (out, "%-5d %s:", r, rules[r].lhs->tag); + rule_rhs_print (&rules[r], out); fprintf (out, "\n"); } } @@ -300,24 +291,10 @@ grammar_dump (FILE *out, const char *title) void grammar_rules_useless_report (const char *message) { - warnings w = Wother; - if (warnings_flag & w) - { - rule_number r; - for (r = 0; r < nrules ; ++r) - if (!rules[r].useful) - { - if (feature_flag & feature_caret) - complain (&rules[r].location, w, "%s", message); - else - { - complain (&rules[r].location, w | silent, "%s: ", message); - rule_print (&rules[r], stderr); - warnings_print_categories (w); - fprintf (stderr, "\n"); - } - } - } + rule_number r; + for (r = 0; r < nrules ; ++r) + if (!rules[r].useful) + complain (&rules[r].location, Wother, "%s", message); } void