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>
#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>
class location;
}
-]m4_ifdef([b4_start_header],
-[[/* Copy the %start-header blocks. */
-]b4_user_start_header])[
-
#include "location.hh"
/* Enabling traces. */
#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"
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
@smallexample
%@{
+ #define _GNU_SOURCE
#include <stdio.h>
#include "ptypes.h"
%@}
@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
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[);