bison-patches
[Top][All Lists]
Advanced

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

[Main] Prevent prefix redefinition.


From: Pascal Bart
Subject: [Main] Prevent prefix redefinition.
Date: Fri, 21 Sep 2001 20:14:21 +0000 (GMT)

Hello,

        This patch redefines yyparse ... only if name_prefix option is
set.  In fact, any users don't use name_prefix option, and redefine
manually yyparse ..., so this patch prevents redefinition warnings from
CPP.

Index: ChangeLog
===================================================================
RCS file: /cvsroot/bison/bison/ChangeLog,v
retrieving revision 1.217
diff -u -r1.217 ChangeLog
--- ChangeLog   2001/09/21 16:25:19     1.217
+++ ChangeLog   2001/09/21 18:06:35
@@ -1,3 +1,9 @@
+2001-09-21  Pascal Bart  <address@hidden>
+
+       * src/bison.simple: Use CPP redefinition of yyparse ... only if
+       the name_prefix option is set.
+       * src/muscle_tab.c (muscle_init): Insert muscle `define_prefix'.
+
 2001-09-21  Marc Autret  <address@hidden>

        * src/reader.c (copy_definition, parse_union_decl): Update and use
Index: src/bison.simple
===================================================================
RCS file: /cvsroot/bison/bison/src/bison.simple,v
retrieving revision 1.64
diff -u -r1.64 bison.simple
--- src/bison.simple    2001/09/19 19:25:02     1.64
+++ src/bison.simple    2001/09/21 18:06:36
@@ -35,13 +35,15 @@

 /* If name_prefix is specify substitute the variables and functions
    names.  */
-#define yyparse %%prefix##parse
-#define yylex %%prefix##lex
-#define yyerror %%prefix##error
-#define yylval %%prefix##lval
-#define yychar %%prefix##char
-#define yydebug %%prefix##debug
-#define yynerrs %%prefix##nerrs
+#if %%define_prefix
+# define yyparse %%prefix##parse
+# define yylex %%prefix##lex
+# define yyerror %%prefix##error
+# define yylval %%prefix##lval
+# define yychar %%prefix##char
+# define yydebug %%prefix##debug
+# define yynerrs %%prefix##nerrs
+#endif /* define_prefix */

 /* Copy the user declarations.  */
 %%prologue
Index: src/files.h
===================================================================
RCS file: /cvsroot/bison/bison/src/files.h,v
retrieving revision 1.18
diff -u -r1.18 files.h
--- src/files.h 2001/08/06 09:22:33     1.18
+++ src/files.h 2001/09/21 18:06:36
@@ -27,7 +27,7 @@
 /* File name specified with -o for the output file, or 0 if no -o.  */
 extern char *spec_outfile;

-/* For -a. */
+/* For -p. */
 extern char *spec_name_prefix;

 /* File name pfx specified with -b, or 0 if no -b.  */
Index: src/muscle_tab.c
===================================================================
RCS file: /cvsroot/bison/bison/src/muscle_tab.c,v
retrieving revision 1.3
diff -u -r1.3 muscle_tab.c
--- src/muscle_tab.c    2001/09/21 16:25:19     1.3
+++ src/muscle_tab.c    2001/09/21 18:06:36
@@ -94,6 +94,9 @@
   /* Default #line formatting.  */
   muscle_insert ("linef", "#line %d %s\n");

+  /* Options.  */
+  muscle_insert ("define_prefix", (spec_name_prefix ? "1" : "0"));
+
   /* No parser macros.  */
   muscle_insert ("nnts", "0");
   muscle_insert ("nrules", "0");

Pascal Bart (address@hidden)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]