bug-bison
[Top][All Lists]
Advanced

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

Re: [GNU Bison 2.3] testsuite: 103 104 failed


From: Paul Eggert
Subject: Re: [GNU Bison 2.3] testsuite: 103 104 failed
Date: Mon, 11 Sep 2006 12:00:04 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Thanks for reporting that.

This before-header and after-header business is wayyyy too
complicated!  Someone really ought to fix the underlying problem since
I hardly even understand the current rules myself, and I don't expect
users to understand it.  (Sheesh!  what a mess....)

Anyway, I installed the following patch, which should fix your
particular problem, and document the issues a bit better.

2006-09-11  Paul Eggert  <address@hidden>

        * data/glr.c (b4_shared_declarations): Put start-header first,
        before any #includes that we generate, so that feature-test
        macros work.  Problem reported by Michael Deutschmann in
        <http://lists.gnu.org/archive/html/bug-bison/2006-09/msg00004.html>.
        * data/lalr1.cc: Likewise.
        * doc/bison.texinfo (Prologue): Document that feature-test macros
        should be defined before any Bison declarations.
        * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Put defns
        that depend on location.hh after, not before, Bison decls, since
        we now include location.hh after the first user prologue.

Index: data/glr.cc
===================================================================
RCS file: /cvsroot/bison/bison/data/glr.cc,v
retrieving revision 1.24
diff -p -u -r1.24 glr.cc
--- data/glr.cc 9 Jul 2006 20:36:33 -0000       1.24
+++ data/glr.cc 11 Sep 2006 18:54:42 -0000
@@ -221,6 +221,10 @@ b4_copyright([Skeleton interface for Bis
 #ifndef PARSER_HEADER_H
 # define PARSER_HEADER_H
 
+]m4_ifdef([b4_start_header],
+[[/* Copy the %start-header blocks.  */
+]b4_user_start_header])[
+
 #include <string>
 #include <iostream>
 
@@ -233,10 +237,6 @@ namespace ]b4_namespace[
   class location;
 }
 
-]m4_ifdef([b4_start_header],
-[[/* Copy the %start-header blocks.  */
-]b4_user_start_header])[
-
 #include "location.hh"
 
 /* Enabling traces.  */
Index: data/lalr1.cc
===================================================================
RCS file: /cvsroot/bison/bison/data/lalr1.cc,v
retrieving revision 1.141
diff -p -u -r1.141 lalr1.cc
--- data/lalr1.cc       11 Aug 2006 19:50:14 -0000      1.141
+++ data/lalr1.cc       11 Sep 2006 18:54:42 -0000
@@ -43,6 +43,10 @@ dnl FIXME: This is wrong, we want comput
 #ifndef PARSER_HEADER_H
 # define PARSER_HEADER_H
 
+]m4_ifdef([b4_start_header],
+[[/* Copy the %start-header blocks.  */
+]b4_user_start_header])[
+
 #include <string>
 #include <iostream>
 #include "stack.hh"
@@ -53,12 +57,7 @@ namespace ]b4_namespace[
   class location;
 }
 
-]m4_ifdef([b4_start_header],
-[[/* Copy the %start-header blocks.  */
-]b4_user_start_header])[
-
-]dnl Include location.hh here: it might depend on headers included above.
-[#include "location.hh"
+#include "location.hh"
 
 /* Enabling traces.  */
 #ifndef YYDEBUG
Index: doc/bison.texinfo
===================================================================
RCS file: /cvsroot/bison/bison/doc/bison.texinfo,v
retrieving revision 1.204
diff -p -u -r1.204 bison.texinfo
--- doc/bison.texinfo   11 Sep 2006 18:02:10 -0000      1.204
+++ doc/bison.texinfo   11 Sep 2006 18:54:43 -0000
@@ -2649,6 +2649,7 @@ can be done with two @var{Prologue} bloc
 
 @smallexample
 address@hidden
+  #define _GNU_SOURCE
   #include <stdio.h>
   #include "ptypes.h"
 address@hidden
@@ -2666,6 +2667,13 @@ can be done with two @var{Prologue} bloc
 @dots{}
 @end smallexample
 
+When in doubt, it is usually safer to put prologue code before all
+Bison declarations, rather than after.  For example, any definitions
+of feature test macros like @code{_GNU_SOURCE} or
address@hidden should appear before all Bison declarations, as
+feature test macros can affect the behavior of Bison-generated
address@hidden directives.
+
 @findex %before-header
 @findex %start-header
 @findex %after-header
Index: tests/actions.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/actions.at,v
retrieving revision 1.66
diff -p -u -r1.66 actions.at
--- tests/actions.at    4 Sep 2006 22:20:52 -0000       1.66
+++ tests/actions.at    11 Sep 2006 18:54:43 -0000
@@ -190,7 +190,7 @@ m4_ifval([$6], [%union
   int ival;
 }])
 AT_LALR1_CC_IF([%define "global_tokens_and_yystype"])
-m4_ifval([$6], [[%end-header {]], [[%start-header {]])
+m4_ifval([$6], [[%end-header {]], [[%after-header {]])
 AT_LALR1_CC_IF([typedef yy::location YYLTYPE;
                 m4_ifval([$6], , [#define YYSTYPE int])])
 [static int yylex (]AT_LEX_FORMALS[);




reply via email to

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