mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-16 15:53:03 +00:00
C++: fix uses of inline
Sometimes `inline` would be used in *.cc files on symbols that are not exported (useless but harmless), and sometimes on exported symbols such as the constructor of syntax_error (harmful: linking fails). Reported several times, including: - by Dennis T http://lists.gnu.org/archive/html/bug-bison/2016-03/msg00002.html - by Frank Heckenbach https://savannah.gnu.org/patch/?9616 * data/c++.m4 (b4_inline): New: expands to `inline` or nothing. Use it where appropriate. * data/lalr1.cc: Use it where appropriate. * tests/c++.at (Syntax error as exception): Put the scanner in another compilation unit to exercise the constructor of syntax_error.
This commit is contained in:
21
tests/c++.at
21
tests/c++.at
@@ -633,6 +633,7 @@ AT_BISON_OPTION_PUSHDEFS([%skeleton "lalr1.cc"])
|
||||
|
||||
AT_DATA_GRAMMAR([[input.y]],
|
||||
[[%skeleton "lalr1.cc"
|
||||
%defines
|
||||
|
||||
%code
|
||||
{
|
||||
@@ -664,6 +665,17 @@ item:
|
||||
|
||||
%%
|
||||
|
||||
void
|
||||
yy::parser::error (const std::string &m)
|
||||
{
|
||||
std::cerr << "error: " << m << '\n';
|
||||
}
|
||||
]AT_MAIN_DEFINE[
|
||||
]])
|
||||
|
||||
AT_DATA_SOURCE([input-scan.cc],
|
||||
[[#include "input.hh"
|
||||
|
||||
int
|
||||
yylex (yy::parser::semantic_type *)
|
||||
{
|
||||
@@ -677,16 +689,9 @@ yylex (yy::parser::semantic_type *)
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
yy::parser::error (const std::string &m)
|
||||
{
|
||||
std::cerr << "error: " << m << '\n';
|
||||
}
|
||||
]AT_MAIN_DEFINE[
|
||||
]])
|
||||
|
||||
AT_FULL_COMPILE([[input]])
|
||||
AT_FULL_COMPILE([[input]], [[scan]])
|
||||
|
||||
AT_PARSER_CHECK([[./input]], [[0]], [[]],
|
||||
[[error: invalid expression
|
||||
|
||||
Reference in New Issue
Block a user