From bafc3a0eb8183b0152381ddb67f2786e9f6b2623 Mon Sep 17 00:00:00 2001 From: steve Date: Mon, 28 Apr 1997 03:36:13 +0000 Subject: Fix problems using -Wwrite-strings and -Wcast-qual with yacc generated parsers. Closes PR #2792. Submitted by: Tim Vanderhoek --- usr.bin/yacc/output.c | 8 +++++--- usr.bin/yacc/skeleton.c | 16 +++------------- 2 files changed, 8 insertions(+), 16 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/yacc/output.c b/usr.bin/yacc/output.c index 432989b..b2a51cb 100644 --- a/usr.bin/yacc/output.c +++ b/usr.bin/yacc/output.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: output.c,v 1.7 1997/02/22 19:58:00 peter Exp $ */ #ifndef lint @@ -945,7 +945,8 @@ output_debug() ++outline; fprintf(code_file, "#define YYFINAL %d\n", final_state); outline += 3; - fprintf(code_file, "#ifndef YYDEBUG\n#define YYDEBUG %d\n#endif\n", + fprintf(code_file, "#ifndef YYDEBUG\n#define YYDEBUG %d\n" + "#elif YYDEBUG\n#include \n#endif\n", tflag); if (rflag) fprintf(output_file, "#ifndef YYDEBUG\n#define YYDEBUG %d\n#endif\n", @@ -970,7 +971,8 @@ output_debug() symnam[0] = "end-of-file"; if (!rflag) ++outline; - fprintf(output_file, "#if YYDEBUG\nchar *%sname[] = {", symbol_prefix); + fprintf(output_file, "#if YYDEBUG\n" + "const char * const %sname[] = {", symbol_prefix); j = 80; for (i = 0; i <= max; ++i) { diff --git a/usr.bin/yacc/skeleton.c b/usr.bin/yacc/skeleton.c index 4943ccb..ba397db 100644 --- a/usr.bin/yacc/skeleton.c +++ b/usr.bin/yacc/skeleton.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: skeleton.c,v 1.11 1997/02/22 19:58:02 peter Exp $ + * $Id: skeleton.c,v 1.12 1997/03/22 01:48:17 bde Exp $ */ #ifndef lint @@ -68,19 +68,9 @@ char *banner[] = "#define yyclearin (yychar=(YYEMPTY))", "#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", + "static int yygrowstack();", 0 }; @@ -173,7 +163,7 @@ char *body[] = "{", " register int yym, yyn, yystate;", "#if YYDEBUG", - " register char *yys;", + " register const char *yys;", "", " if ((yys = getenv(\"YYDEBUG\")))", " {", -- cgit v1.1