Date: Sun, 15 Sep 1996 17:19:02 -0500 From: Steve Price <sprice@hiwaay.net> To: hackers@freebsd.org Subject: patch to cleanup code generated by yacc(1) Message-ID: <323C80D6.1CFBAE39@hiwaay.net>
next in thread | raw e-mail | index | archive | help
Hi all,
Attached is a patch that -Wall'izes the code generated by yacc(1).
Compiling yacc with -Wall still produces scads 'o warnings, but
at least the code that it generates is nearly -Wall proof. :)
Steve
Index: skeleton.c
===================================================================
RCS file: /u/FreeBSD/cvs/src/usr.bin/yacc/skeleton.c,v
retrieving revision 1.4
diff -u -r1.4 skeleton.c
--- skeleton.c 1996/09/03 10:56:32 1.4
+++ skeleton.c 1996/09/14 02:18:32
@@ -55,7 +55,7 @@
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,23 @@
"#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 *);",
+ " int yyparse();",
+ " int yylex();",
+ "}",
+ "#else",
+ "extern char *getenv();",
+ "extern int yylex();",
+ "extern int yyparse();",
+ "#endif",
0
};
@@ -120,17 +137,6 @@
"#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()",
@@ -196,12 +202,12 @@
" 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:",
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?323C80D6.1CFBAE39>
