mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
yacc: comply with recent POSIX updates: declare yyerror and yylex
In POSIX Yacc mode, declare yyerror and yylex unless already #defined, or if YYERROR_IS_DECLARED/YYLEX_IS_DECLARED are defined (for consistency with Bison's YYSTYPE_IS_DECLARED/YYLTYPE_IS_DECLARED). See <https://austingroupbugs.net/view.php?id=1388#c5220>. * data/skeletons/c.m4 (b4_function_declare): Resurect. (b4_lex_formals): Since we will possibly expose this prototype in the header, take the prefix into account. * data/skeletons/yacc.c (b4_declare_yyerror_and_yylex): New. (b4_shared_declarations): Use it. * tests/local.at (AT_YACC_IF): New. When in Yacc mode, set the `yacc` Autotest keyword. (AT_YYERROR_DECLARE(c)): Don't declare in Yacc mode, to avoid clashes (since this signature is static). (AT_YYERROR_DEFINE(c)): Don't define as static in Yacc mode. * tests/regression.at (Early token definitions with --yacc): Specify that we are in Yacc mode.
This commit is contained in:
8
NEWS
8
NEWS
@@ -9,6 +9,14 @@ GNU Bison NEWS
|
||||
now generates a *.gv file by default, instead of *.dot. A transition
|
||||
started in Bison 3.4.
|
||||
|
||||
To comply with the latest POSIX standard, in Yacc compatibility mode
|
||||
(options `-y`/`--yacc`) Bison now generates prototypes for yyerror and
|
||||
yylex. In some situations, this is breaking compatibility: if the user
|
||||
has already declared these functions but with some differences (e.g., to
|
||||
declare them as static, or to use specific attributes), the generated
|
||||
parser will fail to compile. To disable these prototypes, #define yyerror
|
||||
(to `yyerror`), and likewise for yylex.
|
||||
|
||||
** Deprecated features
|
||||
|
||||
Support for the YYPRINT macro is removed. It worked only with yacc.c and
|
||||
|
||||
Reference in New Issue
Block a user