summaryrefslogtreecommitdiffstats
path: root/usr.bin/yacc
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1996-01-07 22:30:13 +0000
committerphk <phk@FreeBSD.org>1996-01-07 22:30:13 +0000
commitbdd1ce3cabfbef5966cf0d529b2bfc1a55ffb01f (patch)
tree2c9f4dc20c5b4f413cc5b1b05f92ddc7e6ca2782 /usr.bin/yacc
parent2563a6a6ba3264475a0e6b5153dcc6804c871e98 (diff)
downloadFreeBSD-src-bdd1ce3cabfbef5966cf0d529b2bfc1a55ffb01f.zip
FreeBSD-src-bdd1ce3cabfbef5966cf0d529b2bfc1a55ffb01f.tar.gz
Make all the tables "const" so that they don't clutter our data-segment.
Diffstat (limited to 'usr.bin/yacc')
-rw-r--r--usr.bin/yacc/output.c20
-rw-r--r--usr.bin/yacc/skeleton.c18
2 files changed, 19 insertions, 19 deletions
diff --git a/usr.bin/yacc/output.c b/usr.bin/yacc/output.c
index 67c755a..7be96d5 100644
--- a/usr.bin/yacc/output.c
+++ b/usr.bin/yacc/output.c
@@ -146,7 +146,7 @@ output_rule_data()
register int j;
- fprintf(output_file, "short %slhs[] = {%42d,", symbol_prefix,
+ fprintf(output_file, "const short %slhs[] = {%42d,", symbol_prefix,
symbol_value[start_symbol]);
j = 10;
@@ -166,7 +166,7 @@ output_rule_data()
if (!rflag) outline += 2;
fprintf(output_file, "\n};\n");
- fprintf(output_file, "short %slen[] = {%42d,", symbol_prefix, 2);
+ fprintf(output_file, "const short %slen[] = {%42d,", symbol_prefix, 2);
j = 10;
for (i = 3; i < nrules; i++)
@@ -191,7 +191,7 @@ output_yydefred()
{
register int i, j;
- fprintf(output_file, "short %sdefred[] = {%39d,", symbol_prefix,
+ fprintf(output_file, "const short %sdefred[] = {%39d,", symbol_prefix,
(defred[0] ? defred[0] - 2 : 0));
j = 10;
@@ -333,7 +333,7 @@ goto_actions()
state_count = NEW2(nstates, short);
k = default_goto(start_symbol + 1);
- fprintf(output_file, "short %sdgoto[] = {%40d,", symbol_prefix, k);
+ fprintf(output_file, "const short %sdgoto[] = {%40d,", symbol_prefix, k);
save_column(start_symbol + 1, k);
j = 10;
@@ -657,7 +657,7 @@ output_base()
{
register int i, j;
- fprintf(output_file, "short %ssindex[] = {%39d,", symbol_prefix, base[0]);
+ fprintf(output_file, "const short %ssindex[] = {%39d,", symbol_prefix, base[0]);
j = 10;
for (i = 1; i < nstates; i++)
@@ -675,7 +675,7 @@ output_base()
}
if (!rflag) outline += 2;
- fprintf(output_file, "\n};\nshort %srindex[] = {%39d,", symbol_prefix,
+ fprintf(output_file, "\n};\nconst short %srindex[] = {%39d,", symbol_prefix,
base[nstates]);
j = 10;
@@ -694,7 +694,7 @@ output_base()
}
if (!rflag) outline += 2;
- fprintf(output_file, "\n};\nshort %sgindex[] = {%39d,", symbol_prefix,
+ fprintf(output_file, "\n};\nconst short %sgindex[] = {%39d,", symbol_prefix,
base[2*nstates]);
j = 10;
@@ -726,7 +726,7 @@ output_table()
++outline;
fprintf(code_file, "#define YYTABLESIZE %d\n", high);
- fprintf(output_file, "short %stable[] = {%40d,", symbol_prefix,
+ fprintf(output_file, "const short %stable[] = {%40d,", symbol_prefix,
table[0]);
j = 10;
@@ -756,7 +756,7 @@ output_check()
register int i;
register int j;
- fprintf(output_file, "short %scheck[] = {%40d,", symbol_prefix,
+ fprintf(output_file, "const short %scheck[] = {%40d,", symbol_prefix,
check[0]);
j = 10;
@@ -1051,7 +1051,7 @@ output_debug()
FREE(symnam);
if (!rflag) ++outline;
- fprintf(output_file, "char *%srule[] = {\n", symbol_prefix);
+ fprintf(output_file, "const char * const %srule[] = {\n", symbol_prefix);
for (i = 2; i < nrules; ++i)
{
fprintf(output_file, "\"%s :", symbol_name[rlhs[i]]);
diff --git a/usr.bin/yacc/skeleton.c b/usr.bin/yacc/skeleton.c
index 1e51b2e..fba6508 100644
--- a/usr.bin/yacc/skeleton.c
+++ b/usr.bin/yacc/skeleton.c
@@ -69,15 +69,15 @@ char *banner[] =
char *tables[] =
{
- "extern short yylhs[];",
- "extern short yylen[];",
- "extern short yydefred[];",
- "extern short yydgoto[];",
- "extern short yysindex[];",
- "extern short yyrindex[];",
- "extern short yygindex[];",
- "extern short yytable[];",
- "extern short yycheck[];",
+ "extern const short yylhs[];",
+ "extern const short yylen[];",
+ "extern const short yydefred[];",
+ "extern const short yydgoto[];",
+ "extern const short yysindex[];",
+ "extern const short yyrindex[];",
+ "extern const short yygindex[];",
+ "extern const short yytable[];",
+ "extern const short yycheck[];",
"#if YYDEBUG",
"extern char *yyname[];",
"extern char *yyrule[];",
OpenPOWER on IntegriCloud