bison-patches
[Top][All Lists]
Advanced

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

Re: '#define inline' patch for Bison on Compaq/DEC Alpha OSF/1 4.0


From: Akim Demaille
Subject: Re: '#define inline' patch for Bison on Compaq/DEC Alpha OSF/1 4.0
Date: 14 Nov 2002 10:55:17 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Honest Recruiter)

>>>>> "Paul" == Paul Eggert <address@hidden> writes:

>> From: Akim Demaille <address@hidden> Date: 13 Nov 2002 10:43:42
>> +0100
>> 
>> But then, we are releasing glr.c for C((, not C89 extended, as was
>> intended.  How about
>> 
>> #if ! defined (__GNUC__) && ! defined inline # define inline #endif
>> 
>> instead?

Paul> Currently, "inline" has approximately the same status that
Paul> "const" had in 1992.  It's required by the current C standard,
Paul> and is supported by most current C compilers, but there are
Paul> still many older C compilers still in use that don't handle
Paul> "inline" properly.

Paul> However, I doubt whether many GLR users will employ those old
Paul> compilers, and the few who do can easily "#define inline /*
Paul> empty */" themselves (or via Autoconf); so it's not clear to me
Paul> that we need to worry about this porting issue.

I agree, but it was not clear from your patch.  I had not understood
the user had to deal with it.  I documented this.

Paul> However, if we do need to worry about it, why not remove
Paul> "inline" entirely from glr.c?  Even the above patch won't work
Paul> correctly for sufficiently-old GCC versions; also, the patch
Paul> isn't compatible with how Autoconf handles "inline", as Autoconf
Paul> doesn't define "inline" if the compiler supports it.

The GLR machinery is already expensive as is, we don't want to pay
efficiency for the meer support of obsolescent technology.  Rather,
I'm installing this patch.

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * tests/atlocal.in (CPPFLAGS): We have config.h.
        * tests/testsuite.at (AT_DATA_GRAMMAR_PROLOGUE, AT_DATA_GRAMMAR):
        New.
        * tests/actions.at, tests/calc.at, tests/conflicts.at,
        * tests/cxx-type.at, tests/glr-regr1.at, tests/headers.at,
        * tests/regression.at, tests/torture.at: Use them for all the
        grammars that are to be compiled.
        * tests/cxx-type.at (_AT_TEST_GLR_CALC): Rename as...
        * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): this.
        * doc/bison.texinfo (GLR Parsers): Document `inline'.

Index: NEWS
===================================================================
RCS file: /cvsroot/bison/bison/NEWS,v
retrieving revision 1.76
diff -u -u -r1.76 NEWS
--- NEWS 13 Nov 2002 15:17:34 -0000 1.76
+++ NEWS 14 Nov 2002 09:54:02 -0000
@@ -2,6 +2,10 @@
 ----------
 Changes in version 1.75c:
 
+* GLR and inline
+  Users of Bison have to decide how they handle the portability of the
+  C keyword `inline'.
+
 Changes in version 1.75b, 2002-11-13:
 
 * %destructor
Index: doc/bison.texinfo
===================================================================
RCS file: /cvsroot/bison/bison/doc/bison.texinfo,v
retrieving revision 1.81
diff -u -u -r1.81 bison.texinfo
--- doc/bison.texinfo 14 Nov 2002 08:32:10 -0000 1.81
+++ doc/bison.texinfo 14 Nov 2002 09:54:05 -0000
@@ -412,42 +412,41 @@
 @cindex generalized @acronym{LR} (@acronym{GLR}) parsing
 @cindex ambiguous grammars
 @cindex non-deterministic parsing
-Parsers for @acronym{LALR}(1) grammars are @dfn{deterministic},
-meaning roughly that
-the next grammar rule to apply at any point in the input is uniquely
-determined by the preceding input and a fixed, finite portion (called
-a @dfn{look-ahead}) of the remaining input.
-A context-free grammar can be @dfn{ambiguous}, meaning that
-there are multiple ways to apply the grammar rules to get the some inputs.
-Even unambiguous grammars can be @dfn{non-deterministic}, meaning that no
-fixed look-ahead always suffices to determine the next grammar rule to apply.
-With the proper declarations, Bison is also able to parse these more general
-context-free grammars, using a technique known as @acronym{GLR} parsing (for
-Generalized @acronym{LR}).  Bison's @acronym{GLR} parsers are able to
-handle any context-free
-grammar for which the number of possible parses of any given string
-is finite.
+
+Parsers for @acronym{LALR}(1) grammars are @dfn{deterministic}, meaning
+roughly that the next grammar rule to apply at any point in the input is
+uniquely determined by the preceding input and a fixed, finite portion
+(called a @dfn{look-ahead}) of the remaining input.  A context-free
+grammar can be @dfn{ambiguous}, meaning that there are multiple ways to
+apply the grammar rules to get the some inputs.  Even unambiguous
+grammars can be @dfn{non-deterministic}, meaning that no fixed
+look-ahead always suffices to determine the next grammar rule to apply.
+With the proper declarations, Bison is also able to parse these more
+general context-free grammars, using a technique known as @acronym{GLR}
+parsing (for Generalized @acronym{LR}).  Bison's @acronym{GLR} parsers
+are able to handle any context-free grammar for which the number of
+possible parses of any given string is finite.
 
 @cindex symbols (abstract)
 @cindex token
 @cindex syntactic grouping
 @cindex grouping, syntactic
-In the formal grammatical rules for a language, each kind of syntactic unit
-or grouping is named by a @dfn{symbol}.  Those which are built by grouping
-smaller constructs according to grammatical rules are called
+In the formal grammatical rules for a language, each kind of syntactic
+unit or grouping is named by a @dfn{symbol}.  Those which are built by
+grouping smaller constructs according to grammatical rules are called
 @dfn{nonterminal symbols}; those which can't be subdivided are called
 @dfn{terminal symbols} or @dfn{token types}.  We call a piece of input
 corresponding to a single terminal symbol a @dfn{token}, and a piece
 corresponding to a single nonterminal symbol a @dfn{grouping}.
 
 We can use the C language as an example of what symbols, terminal and
-nonterminal, mean.  The tokens of C are identifiers, constants (numeric and
-string), and the various keywords, arithmetic operators and punctuation
-marks.  So the terminal symbols of a grammar for C include `identifier',
-`number', `string', plus one symbol for each keyword, operator or
-punctuation mark: `if', `return', `const', `static', `int', `char',
-`plus-sign', `open-brace', `close-brace', `comma' and many more.  (These
-tokens can be subdivided into characters, but that is a matter of
+nonterminal, mean.  The tokens of C are identifiers, constants (numeric
+and string), and the various keywords, arithmetic operators and
+punctuation marks.  So the terminal symbols of a grammar for C include
+`identifier', `number', `string', plus one symbol for each keyword,
+operator or punctuation mark: `if', `return', `const', `static', `int',
+`char', `plus-sign', `open-brace', `close-brace', `comma' and many more.
+(These tokens can be subdivided into characters, but that is a matter of
 lexicography, not grammar.)
 
 Here is a simple C function subdivided into tokens:
@@ -642,28 +641,28 @@
 @cindex conflicts
 @cindex shift/reduce conflicts
 
-In some grammars, there will be cases where Bison's standard @acronym{LALR}(1)
-parsing algorithm cannot decide whether to apply a certain grammar rule
-at a given point.  That is, it may not be able to decide (on the basis
-of the input read so far) which of two possible reductions (applications
-of a grammar rule) applies, or whether to apply a reduction or read more
-of the input and apply a reduction later in the input.  These are known
-respectively as @dfn{reduce/reduce} conflicts (@pxref{Reduce/Reduce}),
-and @dfn{shift/reduce} conflicts (@pxref{Shift/Reduce}).
+In some grammars, there will be cases where Bison's standard
address@hidden(1) parsing algorithm cannot decide whether to apply a
+certain grammar rule at a given point.  That is, it may not be able to
+decide (on the basis of the input read so far) which of two possible
+reductions (applications of a grammar rule) applies, or whether to apply
+a reduction or read more of the input and apply a reduction later in the
+input.  These are known respectively as @dfn{reduce/reduce} conflicts
+(@pxref{Reduce/Reduce}), and @dfn{shift/reduce} conflicts
+(@pxref{Shift/Reduce}).
 
-To use a grammar that is not easily modified to be @acronym{LALR}(1), a more
-general parsing algorithm is sometimes necessary.  If you include
+To use a grammar that is not easily modified to be @acronym{LALR}(1), a
+more general parsing algorithm is sometimes necessary.  If you include
 @code{%glr-parser} among the Bison declarations in your file
-(@pxref{Grammar Outline}), the result will be a Generalized
address@hidden (@acronym{GLR})
-parser.  These parsers handle Bison grammars that contain no unresolved
-conflicts (i.e., after applying precedence declarations) identically to
address@hidden(1) parsers.  However, when faced with unresolved
-shift/reduce and reduce/reduce conflicts, @acronym{GLR} parsers use
-the simple expedient of doing
-both, effectively cloning the parser to follow both possibilities.  Each
-of the resulting parsers can again split, so that at any given time,
-there can be any number of possible parses being explored.  The parsers
+(@pxref{Grammar Outline}), the result will be a Generalized @acronym{LR}
+(@acronym{GLR}) parser.  These parsers handle Bison grammars that
+contain no unresolved conflicts (i.e., after applying precedence
+declarations) identically to @acronym{LALR}(1) parsers.  However, when
+faced with unresolved shift/reduce and reduce/reduce conflicts,
address@hidden parsers use the simple expedient of doing both,
+effectively cloning the parser to follow both possibilities.  Each of
+the resulting parsers can again split, so that at any given time, there
+can be any number of possible parses being explored.  The parsers
 proceed in lockstep; that is, all of them consume (shift) a given input
 symbol before any of them proceed to the next.  Each of the cloned
 parsers eventually meets one of two possible fates: either it runs into
@@ -810,6 +809,32 @@
 "x" y z + T <init-declare> x T <cast> y z + = <OR>
 @end example
 
address@hidden 1
+
address@hidden @code{incline}
address@hidden @acronym{GLR} parsers and @code{inline}
+Note that the @acronym{GLR} parsers require an ISO C89 compiler.  In
+addition, they use the @code{inline} keyword, which is not C89, but a
+common extension.  It is up to the user of these parsers to handle
+portability issues.  For instance, if using Autoconf and the Autoconf
+macro @code{AC_C_INLINE}, a mere
+
address@hidden
address@hidden
+#include <config.h>
address@hidden
address@hidden example
+
address@hidden
+will suffice.  Otherwise, we suggest
+
address@hidden
address@hidden
+#if ! defined __GNUC__ && ! defined inline
+# define inline
+#endif
address@hidden
address@hidden example
 
 @node Locations Overview
 @section Locations
Index: tests/actions.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/actions.at,v
retrieving revision 1.19
diff -u -u -r1.19 actions.at
--- tests/actions.at 12 Nov 2002 10:18:05 -0000 1.19
+++ tests/actions.at 14 Nov 2002 09:54:05 -0000
@@ -29,7 +29,7 @@
 # instead of being attached to the empty rule dedicated to this
 # action.
 
-AT_DATA([[input.y]],
+AT_DATA_GRAMMAR([[input.y]],
 [[%{
 # include <stdio.h>
 # include <stdlib.h>
@@ -88,7 +88,7 @@
 
 AT_SETUP([Exotic Dollars])
 
-AT_DATA([[input.y]],
+AT_DATA_GRAMMAR([[input.y]],
 [[%{
 # include <stdio.h>
 # include <stdlib.h>
@@ -167,7 +167,7 @@
 
 # Make sure complex $n work.
 
-AT_DATA([[input.y]],
+AT_DATA_GRAMMAR([[input.y]],
 [[$4
 %{
 #include <stdio.h>
Index: tests/atlocal.in
===================================================================
RCS file: /cvsroot/bison/bison/tests/atlocal.in,v
retrieving revision 1.10
diff -u -u -r1.10 atlocal.in
--- tests/atlocal.in 13 Oct 2002 18:49:44 -0000 1.10
+++ tests/atlocal.in 14 Nov 2002 09:54:05 -0000
@@ -9,7 +9,7 @@
 CFLAGS='@O0CFLAGS@ @WARNING_CFLAGS@ @WERROR_CFLAGS@'
 
 # We need `config.h'.
-CPPFLAGS="-I$abs_top_builddir @CPPFLAGS@"
+CPPFLAGS="-DHAVE_CONFIG_H=1 -I$abs_top_builddir @CPPFLAGS@"
 
 # Is the compiler GCC?
 GCC='@GCC@'
Index: tests/calc.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/calc.at,v
retrieving revision 1.41
diff -u -u -r1.41 calc.at
--- tests/calc.at 7 Nov 2002 12:52:19 -0000 1.41
+++ tests/calc.at 14 Nov 2002 09:54:05 -0000
@@ -35,15 +35,10 @@
 m4_define([_AT_DATA_CALC_Y],
 [m4_if([$1$2$3], $[1]$[2]$[3], [],
        [m4_fatal([$0: Invalid arguments: address@hidden)])dnl
-AT_DATA([calc.y],
+AT_DATA_GRAMMAR([calc.y],
 [[/* Infix notation calculator--calc */
 ]$4[
 %{
-#include <config.h>
-/* We don't need perfect functions for these tests. */
-#undef malloc
-#undef memcmp
-#undef realloc
 #include <stdio.h>
 
 #if STDC_HEADERS
Index: tests/conflicts.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/conflicts.at,v
retrieving revision 1.19
diff -u -u -r1.19 conflicts.at
--- tests/conflicts.at 19 Oct 2002 01:09:36 -0000 1.19
+++ tests/conflicts.at 14 Nov 2002 09:54:05 -0000
@@ -50,14 +50,9 @@
 
 AT_SETUP([%nonassoc and eof])
 
-AT_DATA([input.y],
+AT_DATA_GRAMMAR([input.y],
 [[
 %{
-#include <config.h>
-/* We don't need perfect functions for these tests. */
-#undef malloc
-#undef memcmp
-#undef realloc
 #include <stdio.h>
 
 #if STDC_HEADERS
Index: tests/cxx-type.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/cxx-type.at,v
retrieving revision 1.9
diff -u -u -r1.9 cxx-type.at
--- tests/cxx-type.at 7 Nov 2002 12:52:19 -0000 1.9
+++ tests/cxx-type.at 14 Nov 2002 09:54:05 -0000
@@ -18,13 +18,13 @@
 
 AT_BANNER([[C++ Type Syntax (GLR).]])
 
-# _AT_TEST_GLR_CALC(DECL, RESOLVE1, RESOLVE2)
-# -------------------------------------------
+# _AT_TEST_GLR_CXXTYPES(DECL, RESOLVE1, RESOLVE2)
+# -----------------------------------------------
 # Store into types.y the calc program, with DECL inserted as a declaration,
 # and with RESOLVE1 and RESOLVE2 as annotations on the conflicted rule for
 # stmt.  Then compile the result.
-m4_define([_AT_TEST_GLR_CALC],
-[AT_DATA([types.y],
+m4_define([_AT_TEST_GLR_CXXTYPES],
+[AT_DATA_GRAMMAR([types.y],
 [[/* Simplified C++ Type and Expression Grammar.  */
 
 $1
@@ -253,57 +253,62 @@
 ## ---------------------------------------------------- ##
 
 AT_SETUP([GLR: Resolve ambiguity, impure, no locations])
-_AT_TEST_GLR_CALC([],[%dprec 1],[%dprec 2])
+_AT_TEST_GLR_CXXTYPES([],
+                      [%dprec 1], [%dprec 2])
 AT_PARSER_CHECK([[./types test-input | sed 's/  *$//']], 0,
                 _AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR)
 AT_CLEANUP
 
 AT_SETUP([GLR: Resolve ambiguity, impure, locations])
-_AT_TEST_GLR_CALC([%locations],[%dprec 1],[%dprec 2])
+_AT_TEST_GLR_CXXTYPES([%locations],[%dprec 1],[%dprec 2])
 AT_PARSER_CHECK([[./types test-input | sed 's/  *$//']], 0,
                 _AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR)
 AT_CLEANUP
 
 AT_SETUP([GLR: Resolve ambiguity, pure, no locations])
-_AT_TEST_GLR_CALC([%pure-parser],[%dprec 1],[%dprec 2])
+_AT_TEST_GLR_CXXTYPES([%pure-parser],
+                      [%dprec 1], [%dprec 2])
 AT_PARSER_CHECK([[./types test-input | sed 's/  *$//']], 0,
                 _AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR)
 AT_CLEANUP
 
 AT_SETUP([GLR: Resolve ambiguity, pure, locations])
-_AT_TEST_GLR_CALC([%pure-parser
-%locations],[%dprec 1],[%dprec 2])
+_AT_TEST_GLR_CXXTYPES([%pure-parser %locations],
+                      [%dprec 1], [%dprec 2])
 AT_PARSER_CHECK([[./types test-input | sed 's/  *$//']], 0,
                 _AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR)
 AT_CLEANUP
 
 AT_SETUP([GLR: Merge conflicting parses, impure, no locations])
-_AT_TEST_GLR_CALC([],[%merge <stmtMerge>],[%merge <stmtMerge>])
+_AT_TEST_GLR_CXXTYPES([],
+                      [%merge <stmtMerge>], [%merge <stmtMerge>])
 AT_PARSER_CHECK([[./types test-input | sed 's/  *$//']], 0,
                 _AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR)
 AT_CLEANUP
 
 AT_SETUP([GLR: Merge conflicting parses, impure, locations])
-_AT_TEST_GLR_CALC([%locations],[%merge <stmtMerge>],[%merge <stmtMerge>])
+_AT_TEST_GLR_CXXTYPES([%locations],
+                      [%merge <stmtMerge>], [%merge <stmtMerge>])
 AT_PARSER_CHECK([[./types test-input | sed 's/  *$//']], 0,
                 _AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR)
 AT_CLEANUP
 
 AT_SETUP([GLR: Merge conflicting parses, pure, no locations])
-_AT_TEST_GLR_CALC([%pure-parser],[%merge <stmtMerge>],[%merge <stmtMerge>])
+_AT_TEST_GLR_CXXTYPES([%pure-parser],
+                      [%merge <stmtMerge>], [%merge <stmtMerge>])
 AT_PARSER_CHECK([[./types test-input | sed 's/  *$//']], 0,
                 _AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR)
 AT_CLEANUP
 AT_SETUP([GLR: Merge conflicting parses, pure, locations])
-_AT_TEST_GLR_CALC([%pure-parser
-%locations],[%merge <stmtMerge>],[%merge <stmtMerge>])
+_AT_TEST_GLR_CXXTYPES([%pure-parser %locations],
+                      [%merge <stmtMerge>],[%merge <stmtMerge>])
 AT_PARSER_CHECK([[./types test-input | sed 's/  *$//']], 0,
                 _AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR)
 AT_CLEANUP
 
 AT_SETUP([GLR: Verbose messages, resolve ambiguity, impure, no locations])
-_AT_TEST_GLR_CALC([%error-verbose],
-[%merge <stmtMerge>],[%merge <stmtMerge>])
+_AT_TEST_GLR_CXXTYPES([%error-verbose],
+                      [%merge <stmtMerge>], [%merge <stmtMerge>])
 AT_PARSER_CHECK([[./types test-input | sed 's/  *$//']], 0,
                _AT_AMBIG_GLR_OUTPUT, _AT_VERBOSE_GLR_STDERR)
 AT_CLEANUP
Index: tests/glr-regr1.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/glr-regr1.at,v
retrieving revision 1.3
diff -u -u -r1.3 glr-regr1.at
--- tests/glr-regr1.at 13 Nov 2002 23:20:52 -0000 1.3
+++ tests/glr-regr1.at 14 Nov 2002 09:54:05 -0000
@@ -20,7 +20,7 @@
 
 AT_SETUP([Badly Collapsed GLR States])
 
-AT_DATA([glr-regr1.y],
+AT_DATA_GRAMMAR([glr-regr1.y],
 [[/* Regression Test: Improper state compression */
 /* Reported by Scott McPeak */
 
Index: tests/headers.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/headers.at,v
retrieving revision 1.7
diff -u -u -r1.7 headers.at
--- tests/headers.at 14 Nov 2002 00:36:03 -0000 1.7
+++ tests/headers.at 14 Nov 2002 09:54:05 -0000
@@ -55,7 +55,7 @@
 dirname=`AS_DIRNAME([$1])`
 AS_MKDIR_P([$dirname])
 
-AT_DATA([$1.y],
+AT_DATA_GRAMMAR([$1.y],
 [%%
 dummy:;
 ])
@@ -80,7 +80,7 @@
 
 AT_SETUP([export YYLTYPE])
 
-AT_DATA([input.y],
+AT_DATA_GRAMMAR([input.y],
 [%locations
 
 %name-prefix="my_"
Index: tests/input.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/input.at,v
retrieving revision 1.19
diff -u -u -r1.19 input.at
--- tests/input.at 14 Nov 2002 00:35:27 -0000 1.19
+++ tests/input.at 14 Nov 2002 09:54:05 -0000
@@ -92,7 +92,7 @@
 
 AT_SETUP([Torturing the Scanner])
 
-AT_DATA([input.y],
+AT_DATA_GRAMMAR([input.y],
 [[%{
 /* This is seen in GCC: a %{ and %} in middle of a comment. */
 const char *foo = "So %{ and %} can be here too.";
@@ -187,6 +187,8 @@
   fprintf (stderr, "%s\n", msg);
 }
 ]])
+
+# Pacify Emacs'font-lock-mode: "
 
 AT_DATA([main.c],
 [[typedef int value_t;
Index: tests/regression.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/regression.at,v
retrieving revision 1.74
diff -u -u -r1.74 regression.at
--- tests/regression.at 12 Nov 2002 09:03:13 -0000 1.74
+++ tests/regression.at 14 Nov 2002 09:54:06 -0000
@@ -29,7 +29,7 @@
 # Found in GCJ: they expect the tokens to be defined before the user
 # prologue, so that they can use the token definitions in it.
 
-AT_DATA([input.y],
+AT_DATA_GRAMMAR([input.y],
 [[%{
 void yyerror (const char *s);
 int yylex (void);
@@ -313,7 +313,7 @@
 AT_SETUP([Token definitions])
 
 # Bison managed, when fed with `%token 'f' "f"' to #define 'f'!
-AT_DATA([input.y],
+AT_DATA_GRAMMAR([input.y],
 [%{
 void yyerror (const char *s);
 int yylex (void);
@@ -340,7 +340,7 @@
 
 AT_SETUP([Characters Escapes])
 
-AT_DATA([input.y],
+AT_DATA_GRAMMAR([input.y],
 [%{
 void yyerror (const char *s);
 int yylex (void);
@@ -352,6 +352,7 @@
 | '"'  "'"
 ;
 ]])
+# Pacify font-lock-mode: "
 
 AT_CHECK([bison -o input.c input.y])
 AT_COMPILE([input.o], [-c input.c])
Index: tests/testsuite.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/testsuite.at,v
retrieving revision 1.17
diff -u -u -r1.17 testsuite.at
--- tests/testsuite.at 30 Oct 2002 02:03:14 -0000 1.17
+++ tests/testsuite.at 14 Nov 2002 09:54:06 -0000
@@ -22,6 +22,34 @@
 m4_version_prereq([2.52g])
 
 
+# AT_DATA_GRAMMAR_PROLOGUE
+# ------------------------
+# The prologue that should be included in any grammar which parser is
+# meant to be compiled.
+m4_define([AT_DATA_GRAMMAR_PROLOGUE],
+[[%{
+#if HAVE_CONFIG_H
+# include <config.h>
+  /* We don't need perfect functions for these tests. */
+# undef malloc
+# undef memcmp
+# undef realloc
+#endif
+%}]
+])
+
+
+# AT_DATA_GRAMMAR(NAME, CONTENT)
+# ------------------------------
+# Generate the file NAME, which CONTENT is preceded by
+# AT_DATA_GRAMMAR_PROLOGUE.
+m4_define([AT_DATA_GRAMMAR],
+[AT_DATA([$1],
+[AT_DATA_GRAMMAR_PROLOGUE
+$2])
+])
+
+
 # AT_COMPILE(OUTPUT, [SOURCES = OUTPUT.c])
 # ----------------------------------------
 #
@@ -77,7 +105,7 @@
 # Some old bugs.
 m4_include([regression.at])
 
-# GLR tests: 
+# GLR tests:
 # C++ types, simplified
 m4_include([cxx-type.at])
 # Regression test for state-folding optimization
Index: tests/torture.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/torture.at,v
retrieving revision 1.21
diff -u -u -r1.21 torture.at
--- tests/torture.at 10 Nov 2002 07:04:07 -0000 1.21
+++ tests/torture.at 14 Nov 2002 09:54:06 -0000
@@ -48,6 +48,7 @@
 my $max = $ARGV[0] || 10;
 
 print <<EOF;
+]AT_DATA_GRAMMAR_PROLOGUE[
 %{
 #include <stdio.h>
 #include <stdlib.h>
@@ -163,6 +164,7 @@
 my $max = $ARGV[0] || 10;
 
 print <<EOF;
+]AT_DATA_GRAMMAR_PROLOGUE[
 %{
 #include <stdio.h>
 #include <stdlib.h>




reply via email to

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