Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/yacc Use



details:   https://anonhg.NetBSD.org/src/rev/133d2385e76f
branches:  trunk
changeset: 487448:133d2385e76f
user:      explorer <explorer%NetBSD.org@localhost>
date:      Wed Jun 07 23:54:17 2000 +0000

description:
Use
        const char *yyname[] = {...};
        const char *yyrule[] = {...};
rather than
        char *yyname[] = {...};
        char *yyrule[] = {...};

to prevent warnings about
        initialization discards `const' from pointer target type
when the output of yacc is compiled with a picky warning level.

diffstat:

 usr.bin/yacc/output.c   |   8 ++++----
 usr.bin/yacc/skeleton.c |  12 ++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)

diffs (83 lines):

diff -r 2a27ced9e009 -r 133d2385e76f usr.bin/yacc/output.c
--- a/usr.bin/yacc/output.c     Wed Jun 07 22:40:59 2000 +0000
+++ b/usr.bin/yacc/output.c     Wed Jun 07 23:54:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: output.c,v 1.6 1997/07/25 16:46:35 perry Exp $ */
+/*     $NetBSD: output.c,v 1.7 2000/06/07 23:54:17 explorer Exp $      */
 
 /*
  * Copyright (c) 1989 The Regents of the University of California.
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)output.c   5.7 (Berkeley) 5/24/93";
 #else
-__RCSID("$NetBSD: output.c,v 1.6 1997/07/25 16:46:35 perry Exp $");
+__RCSID("$NetBSD: output.c,v 1.7 2000/06/07 23:54:17 explorer Exp $");
 #endif
 #endif /* not lint */
 
@@ -970,7 +970,7 @@
     symnam[0] = "end-of-file";
 
     if (!rflag) ++outline;
-    fprintf(output_file, "#if YYDEBUG\nchar *%sname[] = {", symbol_prefix);
+    fprintf(output_file, "#if YYDEBUG\nconst char *%sname[] = {", symbol_prefix);
     j = 80;
     for (i = 0; i <= max; ++i)
     {
@@ -1096,7 +1096,7 @@
     FREE(symnam);
 
     if (!rflag) ++outline;
-    fprintf(output_file, "char *%srule[] = {\n", symbol_prefix);
+    fprintf(output_file, "const char *%srule[] = {\n", symbol_prefix);
     for (i = 2; i < nrules; ++i)
     {
        fprintf(output_file, "\"%s :", symbol_name[rlhs[i]]);
diff -r 2a27ced9e009 -r 133d2385e76f usr.bin/yacc/skeleton.c
--- a/usr.bin/yacc/skeleton.c   Wed Jun 07 22:40:59 2000 +0000
+++ b/usr.bin/yacc/skeleton.c   Wed Jun 07 23:54:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: skeleton.c,v 1.17 1999/10/29 16:41:51 explorer Exp $   */
+/*     $NetBSD: skeleton.c,v 1.18 2000/06/07 23:54:17 explorer Exp $   */
 
 /*
  * Copyright (c) 1989 The Regents of the University of California.
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)skeleton.c 5.8 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: skeleton.c,v 1.17 1999/10/29 16:41:51 explorer Exp $");
+__RCSID("$NetBSD: skeleton.c,v 1.18 2000/06/07 23:54:17 explorer Exp $");
 #endif /* 0 */
 #endif /* not lint */
 
@@ -67,7 +67,7 @@
     "static char yysccsid[] = \"@(#)yaccpar    1.9 (Berkeley) 02/21/93\";",
     "#else",
     "#if defined(__NetBSD__) && defined(__IDSTRING)",
-    "__IDSTRING(yyrcsid, \"$NetBSD: skeleton.c,v 1.17 1999/10/29 16:41:51 explorer Exp $\");",
+    "__IDSTRING(yyrcsid, \"$NetBSD: skeleton.c,v 1.18 2000/06/07 23:54:17 explorer Exp $\");",
     "#endif /* __NetBSD__ && __IDSTRING */",
     "#endif /* 0 */",
     "#endif /* lint */",
@@ -96,8 +96,8 @@
     "extern short yytable[];",
     "extern short yycheck[];",
     "#if YYDEBUG",
-    "extern char *yyname[];",
-    "extern char *yyrule[];",
+    "extern const char *yyname[];",
+    "extern const char *yyrule[];",
     "#endif",
     0
 };
@@ -173,7 +173,7 @@
     "{",
     "    int yym, yyn, yystate;",
     "#if YYDEBUG",
-    "    char *yys;",
+    "    const char *yys;",
     "",
     "    if ((yys = getenv(\"YYDEBUG\")) != NULL)",
     "    {",



Home | Main Index | Thread Index | Old Index