mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
c, c++: avoid implicit fall-throw
Reported by Derek Clegg. http://lists.gnu.org/archive/html/bug-bison/2019-01/msg00004.html * configure.ac (warn_common): Add -Wimplicit-fallthrough. This does trigger failures in the test suite. * data/skeletons/glr.c, data/skeletons/lalr1.cc, * data/skeletons/yacc.c, tests/c++.at: Make fall-throws explicit.
This commit is contained in:
@@ -6650,6 +6650,28 @@ For example, if you use @samp{%define api.prefix @{c@}}, the names become
|
||||
@code{cparse}, @code{clex}, @dots{}, @code{CSTYPE}, @code{CLTYPE}, and so
|
||||
on.
|
||||
|
||||
Users of Flex must update the signature of the generated @code{yylex}
|
||||
function. Since the Flex scanner usually includes the generated header of
|
||||
the parser (to get the definitions of the tokens, etc.), the most convenient
|
||||
way is to insert the declaration of @code{yylex} in the @code{provides}
|
||||
section:
|
||||
|
||||
@example
|
||||
%define api.prefix @{c@}
|
||||
// Emitted in the header file, after the definition of YYSTYPE.
|
||||
%code provides
|
||||
@{
|
||||
// Tell Flex the expected prototype of yylex.
|
||||
#define YY_DECL \
|
||||
int clex (CSTYPE*y ylval, CLTYPE *yylloc)
|
||||
|
||||
// Declare the scanner.
|
||||
YY_DECL;
|
||||
@}
|
||||
@end example
|
||||
|
||||
@sp 1
|
||||
|
||||
The @code{%define} variable @code{api.prefix} works in two different ways.
|
||||
In the implementation file, it works by adding macro definitions to the
|
||||
beginning of the parser implementation file, defining @code{yyparse} as
|
||||
|
||||
Reference in New Issue
Block a user