mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
* 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.
This commit is contained in:
18
ChangeLog
18
ChangeLog
@@ -1,9 +1,27 @@
|
||||
2006-09-11 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* 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.
|
||||
|
||||
* doc/bison.texinfo (Calc++ Parser): Fix memory leak reported by
|
||||
Sander Brandenburg in
|
||||
<http://lists.gnu.org/archive/html/bug-bison/2006-09/msg00002.html>.
|
||||
Also, fix minor white space and comment issues.
|
||||
(Prologue): Mention that it's better to define feature-test macros
|
||||
before Bison declarations. Problem reported by Michael Deutschmann.
|
||||
|
||||
* README-cvs: Fix typo: "&" should be "&&". Problem reported
|
||||
by Jim Meyering.
|
||||
* m4/.cvsignore: Add argmatch.m4. Remove obstack.m4, strerror_r.m4.
|
||||
This adjusts to recent gnulib changes.
|
||||
|
||||
2006-09-04 Joel E. Denny <jdenny@ces.clemson.edu>
|
||||
|
||||
|
||||
@@ -221,6 +221,10 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
||||
#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. */
|
||||
|
||||
@@ -43,6 +43,10 @@ dnl FIXME: This is wrong, we want computed header guards.
|
||||
#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
|
||||
|
||||
@@ -2649,6 +2649,7 @@ can be done with two @var{Prologue} blocks, one before and one after the
|
||||
|
||||
@smallexample
|
||||
%@{
|
||||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include "ptypes.h"
|
||||
%@}
|
||||
@@ -2666,6 +2667,13 @@ can be done with two @var{Prologue} blocks, one before and one after the
|
||||
@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
|
||||
@code{_POSIX_C_SOURCE} should appear before all Bison declarations, as
|
||||
feature test macros can affect the behavior of Bison-generated
|
||||
@code{#include} directives.
|
||||
|
||||
@findex %before-header
|
||||
@findex %start-header
|
||||
@findex %after-header
|
||||
|
||||
@@ -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[);
|
||||
|
||||
Reference in New Issue
Block a user