diff options
author | Steve Price <steve@FreeBSD.org> | 1996-09-22 02:05:53 +0000 |
---|---|---|
committer | Steve Price <steve@FreeBSD.org> | 1996-09-22 02:05:53 +0000 |
commit | 2e66d503c6f1ff39ed550d8405d7c92ac545a744 (patch) | |
tree | 3ed2bb2ceac425cbf16258b1ffeb1162bbe49d73 /usr.bin/yacc | |
parent | 04bd4759a8a72afbc8dc1dc1a270fc15a007f231 (diff) | |
download | src-2e66d503c6f1ff39ed550d8405d7c92ac545a744.tar.gz src-2e66d503c6f1ff39ed550d8405d7c92ac545a744.zip |
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>
Notes
Notes:
svn path=/head/; revision=18455
Diffstat (limited to 'usr.bin/yacc')
-rw-r--r-- | usr.bin/yacc/skeleton.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/usr.bin/yacc/skeleton.c b/usr.bin/yacc/skeleton.c index d75bc071e1c0..0dc2e2e50ac2 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:", |