bison-patches
[Top][All Lists]
Advanced

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

Re: [SPAM] Re: Extract the action scanner from the grammar scanner


From: Joel E. Denny
Subject: Re: [SPAM] Re: Extract the action scanner from the grammar scanner
Date: Wed, 7 Jun 2006 17:17:40 -0400 (EDT)

On Wed, 7 Jun 2006, Paul Eggert wrote:

> I use Debian stable, which is 2.5.31 with patches.  If memory serves
> 2.5.4 has problems with reentrancy.  I wouldn't have qualms requring
> 2.5.31 for maintainers.

I hope you don't mind, but I just went ahead and fixed this.  That saves 
me some trouble at least.

> This shouldn't be needed, as .c files should include "system.h" first,
> immediately after including <config.h>.  That way, .h files need not
> worry about including "system.h".

I've used this pattern but forgot it.  Thanks.

> I have toyed with the idea of having system.h include config.h, to
> save a line in each .c file.

That's actually what I do in my projects now that I think about it.

I installed this.

2006-06-07  Joel E. Denny  <address@hidden>

        * src/flex-scanner.h: For the sake of Flex 2.5.4, don't #define yyleng
        and yytext if they're already #define'd.
        * src/flex-scanner.h, src/location.h: Move #include "system.h" to...
        * src/scan-code-c.c: ... here.
        * src/scan-code.l, src/scan-gram.l: ... and here.  Also #include
        <config.h>.

Index: src/flex-scanner.h
===================================================================
RCS file: /sources/bison/bison/src/flex-scanner.h,v
retrieving revision 1.1
diff -p -u -r1.1 flex-scanner.h
--- src/flex-scanner.h  7 Jun 2006 07:58:28 -0000       1.1
+++ src/flex-scanner.h  7 Jun 2006 21:07:10 -0000
@@ -24,8 +24,6 @@
 # error "FLEX_PREFIX not defined"
 #endif
 
-#include "system.h"
-
 /* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used.  */
 int   FLEX_PREFIX (get_lineno) (void);
 FILE *FLEX_PREFIX (get_in) (void);
@@ -44,9 +42,13 @@ int   FLEX_PREFIX (lex_destroy) (void);
 /* It seems to be a nice "feature" of Flex that one cannot use yytext,
    yyleng etc. when a prefix is given, since there is no longer a
    #define, but rather the token is actually changed in the output.
-   */
-#define yyleng  FLEX_PREFIX (leng)
-#define yytext  FLEX_PREFIX (text)
+   However, this is not true for Flex 2.5.4.  */
+#ifndef yyleng
+# define yyleng  FLEX_PREFIX (leng)
+#endif
+#ifndef yytext
+# define yytext  FLEX_PREFIX (text) */
+#endif
 
 /* OBSTACK_FOR_STRING -- Used to store all the characters that we need to
    keep (to construct ID, STRINGS etc.).  Use the following macros to
Index: src/location.h
===================================================================
RCS file: /sources/bison/bison/src/location.h,v
retrieving revision 1.16
diff -p -u -r1.16 location.h
--- src/location.h      7 Jun 2006 20:15:40 -0000       1.16
+++ src/location.h      7 Jun 2006 21:07:10 -0000
@@ -21,7 +21,6 @@
 #ifndef LOCATION_H_
 # define LOCATION_H_
 
-# include "system.h"
 # include "uniqstr.h"
 
 /* A boundary between two characters.  */
Index: src/scan-code-c.c
===================================================================
RCS file: /sources/bison/bison/src/scan-code-c.c,v
retrieving revision 1.1
diff -p -u -r1.1 scan-code-c.c
--- src/scan-code-c.c   6 Jun 2006 16:40:06 -0000       1.1
+++ src/scan-code-c.c   7 Jun 2006 21:07:10 -0000
@@ -1,2 +1,3 @@
 #include <config.h>
+#include "system.h"
 #include "scan-code.c"
Index: src/scan-code.l
===================================================================
RCS file: /sources/bison/bison/src/scan-code.l,v
retrieving revision 1.3
diff -p -u -r1.3 scan-code.l
--- src/scan-code.l     7 Jun 2006 20:06:27 -0000       1.3
+++ src/scan-code.l     7 Jun 2006 21:07:10 -0000
@@ -24,6 +24,9 @@
 %option prefix="code_" outfile="lex.yy.c"
 
 %{
+#include <config.h>
+#include "system.h"
+
 /* Work around a bug in flex 2.5.31.  See Debian bug 333231
    <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=333231>.  */
 #undef code_wrap
Index: src/scan-gram.l
===================================================================
RCS file: /sources/bison/bison/src/scan-gram.l,v
retrieving revision 1.89
diff -p -u -r1.89 scan-gram.l
--- src/scan-gram.l     7 Jun 2006 20:06:27 -0000       1.89
+++ src/scan-gram.l     7 Jun 2006 21:07:11 -0000
@@ -24,6 +24,9 @@
 %option prefix="gram_" outfile="lex.yy.c"
 
 %{
+#include <config.h>
+#include "system.h"
+
 /* Work around a bug in flex 2.5.31.  See Debian bug 333231
    <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=333231>.  */
 #undef gram_wrap




reply via email to

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