mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
build: work around GCC warnings on Flex code
With GCC 7.3.0 and Flex 2.6.4, we get warnings on all the generated
scanners:
examples/calc++/calc++-scanner.cc: In function 'void yyrestart(FILE*)':
examples/calc++/calc++-scanner.cc:1611:20: error: potential null pointer dereference [-Werror=null-dereference]
/* %endif */
~~~~~~~~~~~ ^
examples/calc++/calc++-scanner.cc:1607:19: error: potential null pointer dereference [-Werror=null-dereference]
/* %if-c-only */
~~~~~~~~~~~~~~~ ^
examples/calc++/calc++-scanner.cc:1611:20: error: potential null pointer dereference [-Werror=null-dereference]
/* %endif */
~~~~~~~~~~~ ^
examples/calc++/calc++-scanner.cc:1607:19: error: potential null pointer dereference [-Werror=null-dereference]
/* %if-c-only */
~~~~~~~~~~~~~~~ ^
cc1plus: all warnings being treated as errors
Obviously the lines are incorrect, and the warnings are emitted twice.
Still, let's get rid of these warnings.
* doc/bison.texi, src/flex-scanner.h: Disable these warnings in code
generated by Flex.
This commit is contained in:
@@ -11399,6 +11399,12 @@ parser's to get the set of defined tokens.
|
||||
# undef yywrap
|
||||
# define yywrap() 1
|
||||
|
||||
// Pacify warnings in yy_init_buffer (observed with Flex 2.6.4)
|
||||
// and GCC 7.3.0.
|
||||
#if defined __GNUC__ && 7 <= __GNUC__
|
||||
# pragma GCC diagnostic ignored "-Wnull-dereference"
|
||||
#endif
|
||||
|
||||
// The location of the current token.
|
||||
static yy::location loc;
|
||||
%@}
|
||||
|
||||
Reference in New Issue
Block a user