mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-10 12:53:03 +00:00
Undo the parts of the unlocked-I/O change that substituted
putc or puts for printf. This might hurt performance a bit, but some people prefer the printf style. * data/c.m4 (yysymprint): Prefer printf to puts and putc. * data/glr.c (YYFPUTC, YYFPUTS, YYDPUTS): Remove. All uses replaced by YYFPRINTF and YYDPRINTF. * data/yacc.c: Likewise. * lib/bitset.c (bitset_print): Likewise. * lib/bitsetv.c (bitsetv_dump, debug-bitsetv): Prefer printf to putc and puts. * 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): Break apart two printfs. * src/parse-gram.y (%printer): Prefer printf to putc and puts. * 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:
@@ -75,7 +75,7 @@ print_firsts (void)
|
||||
{
|
||||
symbol_number i, j;
|
||||
|
||||
fputs ("FIRSTS\n", stderr);
|
||||
fprintf (stderr, "FIRSTS\n");
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
{
|
||||
bitset_iterator iter;
|
||||
@@ -86,7 +86,7 @@ print_firsts (void)
|
||||
symbols[j + ntokens]->tag);
|
||||
}
|
||||
}
|
||||
fputs ("\n\n", stderr);
|
||||
fprintf (stderr, "\n\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ print_fderives (void)
|
||||
int i;
|
||||
rule_number r;
|
||||
|
||||
fputs ("FDERIVES\n", stderr);
|
||||
fprintf (stderr, "FDERIVES\n");
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
{
|
||||
bitset_iterator iter;
|
||||
@@ -107,7 +107,7 @@ print_fderives (void)
|
||||
rule_rhs_print (&rules[r], stderr);
|
||||
}
|
||||
}
|
||||
fputs ("\n\n", stderr);
|
||||
fprintf (stderr, "\n\n");
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------.
|
||||
|
||||
19
src/gram.c
19
src/gram.c
@@ -247,24 +247,23 @@ grammar_dump (FILE *out, const char *title)
|
||||
ntokens, nvars, nsyms, nrules, nritems);
|
||||
|
||||
|
||||
fputs (("Variables\n---------\n\n"
|
||||
"Value Sprec Sassoc Tag\n"),
|
||||
out);
|
||||
fprintf (out, "Variables\n---------\n\n");
|
||||
{
|
||||
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);
|
||||
|
||||
fputs (("Rules\n-----\n\n"
|
||||
"Num (Prec, Assoc, Useful, Ritem Range) Lhs -> Rhs (Ritem range) [Num]\n"),
|
||||
out);
|
||||
fprintf (out, "Rules\n-----\n\n");
|
||||
{
|
||||
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];
|
||||
@@ -288,9 +287,9 @@ grammar_dump (FILE *out, const char *title)
|
||||
fprintf (out, " [%d]\n", item_number_as_rule_number (*rp));
|
||||
}
|
||||
}
|
||||
fputs ("\n\n", out);
|
||||
fprintf (out, "\n\n");
|
||||
|
||||
fputs ("Rules interpreted\n-----------------\n\n", out);
|
||||
fprintf (out, "Rules interpreted\n-----------------\n\n");
|
||||
{
|
||||
rule_number r;
|
||||
for (r = 0; r < nrules + nuseless_productions; r++)
|
||||
@@ -299,7 +298,7 @@ grammar_dump (FILE *out, const char *title)
|
||||
rule_print (&rules[r], out);
|
||||
}
|
||||
}
|
||||
fputs ("\n\n", out);
|
||||
fprintf (out, "\n\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -410,7 +410,7 @@ look_ahead_tokens_print (FILE *out)
|
||||
{
|
||||
state_number i;
|
||||
int j, k;
|
||||
fputs ("Look-ahead tokens: BEGIN\n", out);
|
||||
fprintf (out, "Look-ahead tokens: BEGIN\n");
|
||||
for (i = 0; i < nstates; ++i)
|
||||
{
|
||||
reductions *reds = states[i]->reductions;
|
||||
@@ -434,7 +434,7 @@ look_ahead_tokens_print (FILE *out)
|
||||
reds->rules[j]->number);
|
||||
};
|
||||
}
|
||||
fputs ("Look-ahead tokens: END\n", out);
|
||||
fprintf (out, "Look-ahead tokens: END\n");
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -119,7 +119,7 @@ static void
|
||||
escaped_output (FILE *out, char const *string)
|
||||
{
|
||||
char const *p;
|
||||
fputs ("[[", out);
|
||||
fprintf (out, "[[");
|
||||
|
||||
for (p = quotearg_style (c_quoting_style, string); *p; p++)
|
||||
switch (*p)
|
||||
@@ -131,7 +131,7 @@ escaped_output (FILE *out, char const *string)
|
||||
default: fputc (*p, out); break;
|
||||
}
|
||||
|
||||
fputs ("]]", out);
|
||||
fprintf (out, "]]");
|
||||
}
|
||||
|
||||
|
||||
@@ -302,7 +302,8 @@ user_actions_output (FILE *out)
|
||||
fprintf (out, "]b4_syncline(%d, ",
|
||||
rules[r].action_location.start.line);
|
||||
escaped_output (out, rules[r].action_location.start.file);
|
||||
fprintf (out, ")[\n %s\n break;\n\n",
|
||||
fprintf (out, ")[\n");
|
||||
fprintf (out, " %s\n break;\n\n",
|
||||
rules[r].action);
|
||||
}
|
||||
fputs ("]])\n\n", out);
|
||||
|
||||
@@ -181,7 +181,7 @@ static int current_prec = 0;
|
||||
%type <integer> INT
|
||||
%printer { fprintf (stderr, "%d", $$); } INT
|
||||
%type <symbol> ID symbol string_as_id
|
||||
%printer { fputs ($$->tag, stderr); } ID symbol string_as_id
|
||||
%printer { fprintf (stderr, "%s", $$->tag); } ID symbol string_as_id
|
||||
%type <symbol> ID_COLON
|
||||
%printer { fprintf (stderr, "%s:", $$->tag); } ID_COLON
|
||||
%type <assoc> precedence_declarator
|
||||
|
||||
@@ -407,7 +407,7 @@ reduce_print (void)
|
||||
"%d useless rules",
|
||||
nuseless_productions),
|
||||
nuseless_productions);
|
||||
fputc ('\n', stderr);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -237,13 +237,13 @@ state_rule_look_ahead_tokens_print (state *s, rule *r, FILE *out)
|
||||
bitset_iterator biter;
|
||||
int k;
|
||||
char const *sep = "";
|
||||
fputs (" [", out);
|
||||
fprintf (out, " [");
|
||||
BITSET_FOR_EACH (biter, reds->look_ahead_tokens[red], k, 0)
|
||||
{
|
||||
fprintf (out, "%s%s", sep, symbols[k]->tag);
|
||||
sep = ", ";
|
||||
}
|
||||
fputc (']', out);
|
||||
fprintf (out, "]");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user