From owner-freebsd-hackers Sun Sep 15 15:20:26 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id PAA18322 for hackers-outgoing; Sun, 15 Sep 1996 15:20:26 -0700 (PDT) Received: from fly.HiWAAY.net (root@fly.HiWAAY.net [204.214.4.2]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id PAA18316 for ; Sun, 15 Sep 1996 15:20:23 -0700 (PDT) Received: from bonsai.hiwaay.net by fly.HiWAAY.net; (8.7.5/1.1.8.2/21Sep95-1003PM) id RAA26121; Sun, 15 Sep 1996 17:20:20 -0500 (CDT) Message-ID: <323C80D6.1CFBAE39@hiwaay.net> Date: Sun, 15 Sep 1996 17:19:02 -0500 From: Steve Price X-Mailer: Mozilla 2.02 (X11; I; FreeBSD 2.2-CURRENT i386) MIME-Version: 1.0 To: hackers@freebsd.org Subject: patch to cleanup code generated by yacc(1) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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:",