[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: flex-scanner.h w/o obstacks
From: |
Joel E. Denny |
Subject: |
FYI: flex-scanner.h w/o obstacks |
Date: |
Thu, 10 Aug 2006 00:53:01 -0400 (EDT) |
I committed the following. My main point is to make flex-scanner.h usable
in scanners that don't need obstacks (like scan-skel.l), but I did a
little other clean-up as well.
Joel
Index: ChangeLog
===================================================================
RCS file: /sources/bison/bison/ChangeLog,v
retrieving revision 1.1543
diff -p -u -r1.1543 ChangeLog
--- ChangeLog 10 Aug 2006 01:18:50 -0000 1.1543
+++ ChangeLog 10 Aug 2006 04:45:04 -0000
@@ -1,3 +1,15 @@
+2006-08-10 Joel E. Denny <address@hidden>
+
+ Clean up scanners a bit.
+ * src/flex-scanner.h (FLEX_NO_OBSTACK): New macro that blocks obstack
+ definitions so gcc won't warn when obstack_for_string is unused.
+ * src/scan-code.l: config.h and system.h are already #include'd by
+ scan-code-c.c, so get rid of them here.
+ * src/scan-gram.l: Likewise.
+ * src/scan-skel.l: Likewise, and use flex-scanner.h without obstack
+ definitions rather than duplicating the rest of it.
+ * src/scan-gram-c.c, scan-skel-c.c: #include "system.h".
+
2006-08-09 Joel E. Denny <address@hidden>
Suppress signed/unsigned comparison warnings for yycheck.
Index: src/flex-scanner.h
===================================================================
RCS file: /sources/bison/bison/src/flex-scanner.h,v
retrieving revision 1.4
diff -p -u -r1.4 flex-scanner.h
--- src/flex-scanner.h 9 Jul 2006 19:44:34 -0000 1.4
+++ src/flex-scanner.h 10 Aug 2006 04:45:06 -0000
@@ -1,4 +1,4 @@
-/* Common parts between scan-code.l and scan-gram.l.
+/* Common parts between scan-code.l, scan-gram.l, and scan-skel.l.
Copyright (C) 2006 Free Software Foundation, Inc.
@@ -59,6 +59,8 @@ int FLEX_PREFIX (lex_destroy) (void);
STRING_FINISH also stores this string in LAST_STRING, which can be
used, and which is used by STRING_FREE to free the last string. */
+#ifndef FLEX_NO_OBSTACK
+
static struct obstack obstack_for_string;
#define STRING_GROW \
@@ -72,3 +74,5 @@ static struct obstack obstack_for_string
#define STRING_FREE \
obstack_free (&obstack_for_string, last_string)
+
+#endif
Index: src/scan-code.l
===================================================================
RCS file: /sources/bison/bison/src/scan-code.l,v
retrieving revision 1.10
diff -p -u -r1.10 scan-code.l
--- src/scan-code.l 13 Jul 2006 08:12:00 -0000 1.10
+++ src/scan-code.l 10 Aug 2006 04:45:07 -0000
@@ -24,17 +24,15 @@
%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
#define code_wrap() 1
#define FLEX_PREFIX(Id) code_ ## Id
-#include "complain.h"
#include "flex-scanner.h"
+
+#include "complain.h"
#include "reader.h"
#include "getargs.h"
#include <assert.h>
Index: src/scan-gram-c.c
===================================================================
RCS file: /sources/bison/bison/src/scan-gram-c.c,v
retrieving revision 1.1
diff -p -u -r1.1 scan-gram-c.c
--- src/scan-gram-c.c 9 Dec 2005 23:53:14 -0000 1.1
+++ src/scan-gram-c.c 10 Aug 2006 04:45:07 -0000
@@ -1,2 +1,3 @@
#include <config.h>
+#include "system.h"
#include "scan-gram.c"
Index: src/scan-gram.l
===================================================================
RCS file: /sources/bison/bison/src/scan-gram.l,v
retrieving revision 1.97
diff -p -u -r1.97 scan-gram.l
--- src/scan-gram.l 13 Jul 2006 08:12:00 -0000 1.97
+++ src/scan-gram.l 10 Aug 2006 04:45:07 -0000
@@ -24,9 +24,6 @@
%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
Index: src/scan-skel-c.c
===================================================================
RCS file: /sources/bison/bison/src/scan-skel-c.c,v
retrieving revision 1.1
diff -p -u -r1.1 scan-skel-c.c
--- src/scan-skel-c.c 9 Dec 2005 23:53:14 -0000 1.1
+++ src/scan-skel-c.c 10 Aug 2006 04:45:07 -0000
@@ -1,2 +1,3 @@
#include <config.h>
+#include "system.h"
#include "scan-skel.c"
Index: src/scan-skel.l
===================================================================
RCS file: /sources/bison/bison/src/scan-skel.l,v
retrieving revision 1.40
diff -p -u -r1.40 scan-skel.l
--- src/scan-skel.l 9 Jul 2006 03:44:51 -0000 1.40
+++ src/scan-skel.l 10 Aug 2006 04:45:07 -0000
@@ -29,7 +29,9 @@
#undef skel_wrap
#define skel_wrap() 1
-#include "system.h"
+#define FLEX_NO_OBSTACK
+#define FLEX_PREFIX(Id) skel_ ## Id
+#include "flex-scanner.h"
#include <dirname.h>
#include <error.h>
@@ -40,19 +42,7 @@
#include "files.h"
#include "scan-skel.h"
-/* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */
int skel_lex (void);
-int skel_get_lineno (void);
-FILE *skel_get_in (void);
-FILE *skel_get_out (void);
-int skel_get_leng (void);
-char *skel_get_text (void);
-void skel_set_lineno (int);
-void skel_set_in (FILE *);
-void skel_set_out (FILE *);
-int skel_get_debug (void);
-void skel_set_debug (int);
-int skel_lex_destroy (void);
#define QPUTS(String) \
fputs (quotearg_style (c_quoting_style, String), yyout)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: flex-scanner.h w/o obstacks,
Joel E. Denny <=