api.value.type: diagnose guaranteed failure with --yacc

Instead of generating invalid C code, generate an error when --yacc and
'%define api.value.type union' are used together.

* data/bison.m4: Issue an error in this case.
* tests/types.at (%yacc vs. %define api.value.type union): New, check this
error.
* doc/bison.texi (Type Generation): Document it.
* tests/output.at: Check that '-o y.tab.c' and '-y' behave equally
wrt generated file names.
* NEWS (Use of YACC='bison -y'): New.
Promote the use of 'bison -o y.tab.c'.
This commit is contained in:
Akim Demaille
2013-03-27 09:18:32 +01:00
parent d1a07886ee
commit 1fa19a7697
5 changed files with 70 additions and 4 deletions

View File

@@ -3795,6 +3795,11 @@ yylval.TOK_INT = 42;
return TOK_INT;
@end example
This Bison extension cannot work if @code{%yacc} (or
@option{-y}/@option{--yacc}) is enabled, as POSIX mandates that Yacc
generate tokens as macros (e.g., @samp{#define INT 258}, or @samp{#define
TOK_INT 258}).
This feature is new, and user feedback would be most welcome.
A similar feature is provided for C++ that in addition overcomes C++