mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 06:43:03 +00:00
headers: move CPP guards into YY_*_INCLUDED to avoid collisions
See <http://lists.gnu.org/archive/html/bug-bison/2012-09/msg00016.html>. * data/c.m4 (b4_cpp_guard): Prepend YY_ and append _INCLUDED. * tests/headers.at: Adjust. * NEWS, doc/bison.texi: Document.
This commit is contained in:
@@ -5124,6 +5124,23 @@ Values, ,Semantic Values of Tokens}.
|
||||
If you have declared @code{%code requires} or @code{%code provides}, the output
|
||||
header also contains their code.
|
||||
@xref{%code Summary}.
|
||||
|
||||
@cindex Header guard
|
||||
The generated header is protected against multiple inclusions with a C
|
||||
preprocessor guard: @samp{YY_@var{PREFIX}_@var{FILE}_INCLUDED}, where
|
||||
@var{PREFIX} and @var{FILE} are the prefix (@pxref{Multiple Parsers,
|
||||
,Multiple Parsers in the Same Program}) and generated file name turned
|
||||
uppercase, with each series of non alphanumerical characters converted to a
|
||||
single underscore.
|
||||
|
||||
For instance with @samp{%define api.prefix "calc"} and @samp{%defines
|
||||
"lib/parse.h"}, the header will be guarded as follows.
|
||||
@example
|
||||
#ifndef YY_CALC_LIB_PARSE_H_INCLUDED
|
||||
# define YY_CALC_LIB_PARSE_H_INCLUDED
|
||||
...
|
||||
#endif /* ! YY_CALC_LIB_PARSE_H_INCLUDED */
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
@deffn {Directive} %defines @var{defines-file}
|
||||
|
||||
Reference in New Issue
Block a user