mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 22: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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user