mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 00:03:03 +00:00
Use unlocked I/O for a minor performance improvement on hosts like
GNU/Linux and Solaris that support unlocked I/O. The basic idea is to use the gnlib unlocked-io module, and to prefer putc and puts to printf when either will work (since the latter doesn't come in an unlocked flavor). * bootstrap (gnulib_modules): Add unlocked-io. * data/c.m4 (yysymprint): Prefer puts and putc to printf. * data/glr.c (YYFPUTC, YYFPUTS, YYDPUTS): New macros. Prefer them to YYFPRINTF and YYDPRINTF if either will do, and similarly for puts and putc and printf. * data/yacc.c: Likewise. * lib/bitset.c (bitset_print): Likewise. * lib/bitset.h [USE_UNLOCKED_IO]: Include unlocked-io.h. * lib/bitsetv.c (bitsetv_dump, debug-bitsetv): Prefer putc and puts to printf. * lib/lbitset.c (debug_lbitset): Likewise. * src/closure.c (print_firsts, print_fderives): Likewise. * src/gram.c (grammar_dump): Likewise. * src/lalr.c (look_ahead_tokens_print): Likewise. * src/output.c (escaped_output): Likewise. (user_actions_output): Coalesce two printfs. * src/parse-gram.h (%printer): Prefer putc and puts to printf. * src/reduce.c (reduce_print): Likewise. * src/state.c (state_rule_look_ahead_tokens_print): Likewise. * src/system.h: Include unlocked-io.h rathe than stdio.h.
This commit is contained in:
19
src/gram.c
19
src/gram.c
@@ -247,23 +247,24 @@ grammar_dump (FILE *out, const char *title)
|
||||
ntokens, nvars, nsyms, nrules, nritems);
|
||||
|
||||
|
||||
fprintf (out, "Variables\n---------\n\n");
|
||||
fputs (("Variables\n---------\n\n"
|
||||
"Value Sprec Sassoc Tag\n"),
|
||||
out);
|
||||
{
|
||||
symbol_number i;
|
||||
fprintf (out, "Value Sprec Sassoc Tag\n");
|
||||
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
fprintf (out, "%5d %5d %5d %s\n",
|
||||
i,
|
||||
symbols[i]->prec, symbols[i]->assoc,
|
||||
symbols[i]->tag);
|
||||
fprintf (out, "\n\n");
|
||||
}
|
||||
fputs ("\n\n", out);
|
||||
|
||||
fprintf (out, "Rules\n-----\n\n");
|
||||
fputs (("Rules\n-----\n\n"
|
||||
"Num (Prec, Assoc, Useful, Ritem Range) Lhs -> Rhs (Ritem range) [Num]\n"),
|
||||
out);
|
||||
{
|
||||
rule_number i;
|
||||
fprintf (out, "Num (Prec, Assoc, Useful, Ritem Range) Lhs -> Rhs (Ritem range) [Num]\n");
|
||||
for (i = 0; i < nrules + nuseless_productions; i++)
|
||||
{
|
||||
rule *rule_i = &rules[i];
|
||||
@@ -287,9 +288,9 @@ grammar_dump (FILE *out, const char *title)
|
||||
fprintf (out, " [%d]\n", item_number_as_rule_number (*rp));
|
||||
}
|
||||
}
|
||||
fprintf (out, "\n\n");
|
||||
fputs ("\n\n", out);
|
||||
|
||||
fprintf (out, "Rules interpreted\n-----------------\n\n");
|
||||
fputs ("Rules interpreted\n-----------------\n\n", out);
|
||||
{
|
||||
rule_number r;
|
||||
for (r = 0; r < nrules + nuseless_productions; r++)
|
||||
@@ -298,7 +299,7 @@ grammar_dump (FILE *out, const char *title)
|
||||
rule_print (&rules[r], out);
|
||||
}
|
||||
}
|
||||
fprintf (out, "\n\n");
|
||||
fputs ("\n\n", out);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user