summaryrefslogtreecommitdiffstats
path: root/usr.bin/yacc
diff options
context:
space:
mode:
authorsteve <steve@FreeBSD.org>1996-09-22 02:05:53 +0000
committersteve <steve@FreeBSD.org>1996-09-22 02:05:53 +0000
commit29accf9e0f060860daa99411dc2966ee23229fb5 (patch)
tree3ed2bb2ceac425cbf16258b1ffeb1162bbe49d73 /usr.bin/yacc
parent365fa6d6f82625289fed70edf8eac14b3c1e70e4 (diff)
downloadFreeBSD-src-29accf9e0f060860daa99411dc2966ee23229fb5.zip
FreeBSD-src-29accf9e0f060860daa99411dc2966ee23229fb5.tar.gz
Fix for PR# 1427, yacc-generated parser generates warnings
with -Wall. Tim's work with some minor additions by me. Submitted by: Tim Vanderhoek <hoek@freenet.hamilton.on.ca>
Diffstat (limited to 'usr.bin/yacc')
-rw-r--r--usr.bin/yacc/skeleton.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/usr.bin/yacc/skeleton.c b/usr.bin/yacc/skeleton.c
index d75bc07..0dc2e2e 100644
--- a/usr.bin/yacc/skeleton.c
+++ b/usr.bin/yacc/skeleton.c
@@ -55,7 +55,7 @@ static char sccsid[] = "@(#)skeleton.c 5.7 (Berkeley) 5/24/93";
char *banner[] =
{
"#ifndef lint",
- "static char yysccsid[] = \"@(#)yaccpar 1.9 (Berkeley) 02/21/93\";",
+ "static char const yysccsid[] = \"@(#)yaccpar 1.9 (Berkeley) 02/21/93\";",
"#endif",
"#define YYBYACC 1",
"#define YYMAJOR 1",
@@ -63,6 +63,19 @@ char *banner[] =
"#define yyclearin (yychar=(-1))",
"#define yyerrok (yyerrflag=0)",
"#define YYRECOVERING (yyerrflag!=0)",
+ "/* cfront 1.2 defines \"c_plusplus\" instead of \"__cplusplus\" */",
+ "#ifdef c_plusplus",
+ "#ifndef __cplusplus",
+ "#define __cplusplus",
+ "#endif",
+ "#endif",
+ "#ifdef __cplusplus",
+ "extern \"C\" { char *getenv(const char *); }",
+ "#else",
+ "extern char *getenv();",
+ "extern int yylex();",
+ "extern int yyparse();",
+ "#endif",
0
};
@@ -120,17 +133,6 @@ char *body[] =
"#define YYREJECT goto yyabort",
"#define YYACCEPT goto yyaccept",
"#define YYERROR goto yyerrlab",
- "/* cfront 1.2 defines \"c_plusplus\" instead of \"__cplusplus\" */",
- "#ifdef c_plusplus",
- "#ifndef __cplusplus",
- "#define __cplusplus",
- "#endif",
- "#endif",
- "#ifdef __cplusplus",
- "extern \"C\" { char *getenv(const char *); }",
- "#else",
- "extern char *getenv();",
- "#endif",
"",
"int",
"yyparse()",
@@ -139,7 +141,7 @@ char *body[] =
"#if YYDEBUG",
" register char *yys;",
"",
- " if (yys = getenv(\"YYDEBUG\"))",
+ " if ((yys = getenv(\"YYDEBUG\")))",
" {",
" yyn = *yys;",
" if (yyn >= '0' && yyn <= '9')",
@@ -196,12 +198,12 @@ char *body[] =
" goto yyreduce;",
" }",
" if (yyerrflag) goto yyinrecovery;",
- "#ifdef lint",
+ "#if defined(lint) || defined(__GNUC__)",
" goto yynewerror;",
"#endif",
"yynewerror:",
" yyerror(\"syntax error\");",
- "#ifdef lint",
+ "#if defined(lint) || defined(__GNUC__)",
" goto yyerrlab;",
"#endif",
"yyerrlab:",
OpenPOWER on IntegriCloud