summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorsteve <steve@FreeBSD.org>1997-04-28 03:36:13 +0000
committersteve <steve@FreeBSD.org>1997-04-28 03:36:13 +0000
commitbafc3a0eb8183b0152381ddb67f2786e9f6b2623 (patch)
tree86f2d7614b9ebad29aa13420ce093b1b0739cdc2 /usr.bin
parent9b0ffd7cdce34fca58f4d753d65be928b091b2a8 (diff)
downloadFreeBSD-src-bafc3a0eb8183b0152381ddb67f2786e9f6b2623.zip
FreeBSD-src-bafc3a0eb8183b0152381ddb67f2786e9f6b2623.tar.gz
Fix problems using -Wwrite-strings and -Wcast-qual with yacc generated
parsers. Closes PR #2792. Submitted by: Tim Vanderhoek
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/yacc/output.c8
-rw-r--r--usr.bin/yacc/skeleton.c16
2 files changed, 8 insertions, 16 deletions
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 <stdio.h>\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\")))",
" {",
OpenPOWER on IntegriCloud