summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkim Demaille <akim@lrde.epita.fr>2015-01-21 18:34:01 +0100
committerAkim Demaille <akim@lrde.epita.fr>2015-01-22 08:45:44 +0100
commit658b189348746aa79fba777f021bd7dc13eeabd7 (patch)
treedd461b803cbc89a7668c75268b186194a2894779
parenta06344172a724834ea865ca2da6f685df584daf5 (diff)
downloadbison-658b189348746aa79fba777f021bd7dc13eeabd7.tar.gz
tests: c++: fix a C++03 conformance issue
This fixes test 241 on xLC: "input.y", line 42.11: 1540-0274 (S) The name lookup for "report" did not find a declaration. "input.y", line 42.11: 1540-1292 (I) Static declarations are not considered for a function call if the function is not qualified. where report is: static void report (std::ostream& yyo, int ival, float fval) { yyo << "ival: " << ival << ", fval: " << fval; } and line 42 is: %printer { report (yyo, $$, $<fval>$); } <ival>; It turns out that indeed this function must not be declared static, <http://stackoverflow.com/a/17662745/1353549>. Let's put it into an anonymous namespace. Reported by Thomas Jahns. http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00059.html * tests/actions.at (Qualified $$ in actions): Don't use "static", prefer anonymous namespace.
-rw-r--r--NEWS4
-rw-r--r--tests/actions.at9
2 files changed, 10 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 2e38038e..3bd5d10a 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,10 @@ GNU Bison NEWS
Fix a compiler warning when no %destructor use $$.
+*** Test suites
+
+ Several portability issues in tests were fixed.
+
* Noteworthy changes in release 3.0.3 (2015-01-15) [stable]
** Bug fixes
diff --git a/tests/actions.at b/tests/actions.at
index 7220b715..2671ca54 100644
--- a/tests/actions.at
+++ b/tests/actions.at
@@ -1530,10 +1530,13 @@ AT_DATA_GRAMMAR([[input.y]],
]AT_SKEL_CC_IF([[
# include <iostream>
- static void
- report (std::ostream& yyo, int ival, float fval)
+ namespace
{
- yyo << "ival: " << ival << ", fval: " << fval;
+ void
+ report (std::ostream& yyo, int ival, float fval)
+ {
+ yyo << "ival: " << ival << ", fval: " << fval;
+ }
}
]], [[
# include <stdio.h>