Hi Wolfgang, On Mon, 15 Aug 2011, Wolfgang S. Kechel wrote:
> 217: GNU Cim Grammar: LALR(1) FAILED > (existing.at:780) > 218: GNU Cim Grammar: IELR(1) FAILED > (existing.at:780) > 219: GNU Cim Grammar: Canonical LR(1) FAILED > (existing.at:780) > 220: GNU pic (Groff 1.18.1) Grammar: LALR(1) FAILED > (existing.at:1401) > 221: GNU pic (Groff 1.18.1) Grammar: IELR(1) FAILED > (existing.at:1401) > 222: GNU pic (Groff 1.18.1) Grammar: Canonical LR(1) FAILED > (existing.at:1401) Thanks. For every test group, the complaint is: "input.c", line 214: zero-sized struct/union Indeed, each of these test groups is generating an empty union, which is not accepted by the ISO C99 grammar and is apparently not portable. The first patch below fixes that. I pushed it to branch-2.5 and master. I can get gcc to report that problem by adding the -pedantic option in the test suite. The second patch below adds -pedantic when bison is configured with --enable-gcc-warnings, and it fixes another minor test suite problem reported by -pedantic. The third patch fixes a problem it reports for data/lalr1.cc on master. I haven't pushed either of these patches yet. Any objections from anyone? If I also use -pedantic when compiling bison, I see two problems in bison's source. The first is an assert whose argument is too long for a C string. That's easy enough to work around. The second problem comes from gnulib: bison's src/scan-code.l uses gnulib's c_isdigit, which uses gcc's statement expression extension, which also appears in many other places in gnulib. I find that surprising given that one of the purposes of gnulib is to improve portability. Does anyone have advice on this issue? If not, I'll soon ask at bug-gnulib. > 247: parse-gram.y: LALR = IELR ok In your original report, this test group also failed. Do you know what the problem was? Maybe you still have the original tests/testsuite.log. >From 7451638148706f6317975db418cc78e488f420aa Mon Sep 17 00:00:00 2001 From: Joel E. Denny <[email protected]> Date: Sun, 21 Aug 2011 14:45:03 -0400 Subject: [PATCH 1/2] tests: fix empty unions. Empty unions are not accepted by the ISO C99 grammar or by at least some versions of Sun Studio. Reported by Wolfgang S. Kechel at <http://lists.gnu.org/archive/html/bug-bison/2011-08/msg00003.html>. * NEWS (2.5.1): Document fix. * THANKS (Wolfgang S. Kechel): Add. * tests/existing.at (GNU Cim Grammar) (GNU pic (Groff 1.18.1) Grammar.): Remove empty %union. --- ChangeLog | 12 ++++++++++++ NEWS | 2 ++ THANKS | 1 + tests/existing.at | 6 ++---- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0034da1..b1d9ba4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2011-08-21 Joel E. Denny <[email protected]> + + tests: fix empty unions. + Empty unions are not accepted by the ISO C99 grammar or by at + least some versions of Sun Studio. Reported by Wolfgang S. Kechel + at + <http://lists.gnu.org/archive/html/bug-bison/2011-08/msg00003.html>. + * NEWS (2.5.1): Document fix. + * THANKS (Wolfgang S. Kechel): Add. + * tests/existing.at (GNU Cim Grammar) + (GNU pic (Groff 1.18.1) Grammar.): Remove empty %union. + 2011-07-10 Joel E. Denny <[email protected]> build: avoid YACC typo inherited from Autoconf. diff --git a/NEWS b/NEWS index f847988..f4b9769 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ Bison News * Changes in version 2.5.1 (????-??-??): +** Some portability problems in the test suite have been fixed. + ** Minor improvements have been made to the manual. * Changes in version 2.5 (2011-05-14): diff --git a/THANKS b/THANKS index 7fee37e..8d044c6 100644 --- a/THANKS +++ b/THANKS @@ -107,6 +107,7 @@ Tys Lefering [email protected] Vin Shelton [email protected] W.C.A. Wijngaards [email protected] Wayne Green [email protected] +Wolfgang S. Kechel [email protected] Wolfram Wagner [email protected] Wwp [email protected] Zack Weinberg [email protected] diff --git a/tests/existing.at b/tests/existing.at index 64e0b7b..8dce318 100644 --- a/tests/existing.at +++ b/tests/existing.at @@ -778,8 +778,7 @@ dnl In the case of the syntax error, the parser recovers, so it returns 0. # It reported 80 SR && 99 RR conflicts instead of 78/10!!! AT_TEST_EXISTING_GRAMMAR([[GNU Cim Grammar]], -[[%union {} - +[[ %token HACTIVATE HAFTER /*HAND*/ HARRAY HAT HBEFORE HBEGIN HBOOLEAN @@ -1400,7 +1399,6 @@ State 427 conflicts: 9 shift/reduce, 2 reduce/reduce AT_TEST_EXISTING_GRAMMAR([[GNU pic (Groff 1.18.1) Grammar]], [[%error-verbose -%union {} %token LABEL %token VARIABLE @@ -1950,7 +1948,7 @@ dnl without being followed by "of".) [[VARIABLE, '=', LABEL, LEFT, DOT_X]], dnl BISON-STDERR -[[input.y:471.11-48: warning: rule useless in parser due to conflicts: path: ORDINAL LAST object_type relative_path +[[input.y:470.11-48: warning: rule useless in parser due to conflicts: path: ORDINAL LAST object_type relative_path ]], dnl LAST-STATE -- 1.7.0.4 >From 5422d56a718805a2470558808355e04182a12d65 Mon Sep 17 00:00:00 2001 From: Joel E. Denny <[email protected]> Date: Sun, 21 Aug 2011 13:07:16 -0400 Subject: [PATCH 2/2] tests: add -pedantic for --enable-gcc-warnings. This should help to avoid some portability problems. For example, it would have revealed the empty unions fixed by the last patch * configure.ac (WARN_CFLAGS_TESTS, WARN_CXXFLAGS_TEST): Implement. * tests/synclines.at (AT_TEST_SYNCLINE): Avoid -pedantic warning about an empty translation unit. --- ChangeLog | 9 +++++++++ configure.ac | 7 +++---- tests/synclines.at | 1 + 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1d9ba4..f1175f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2011-08-21 Joel E. Denny <[email protected]> + tests: add -pedantic for --enable-gcc-warnings. + This should help to avoid some portability problems. For example, + it would have revealed the empty unions fixed by the last patch + * configure.ac (WARN_CFLAGS_TESTS, WARN_CXXFLAGS_TEST): Implement. + * tests/synclines.at (AT_TEST_SYNCLINE): Avoid -pedantic warning + about an empty translation unit. + +2011-08-21 Joel E. Denny <[email protected]> + tests: fix empty unions. Empty unions are not accepted by the ISO C99 grammar or by at least some versions of Sun Studio. Reported by Wolfgang S. Kechel diff --git a/configure.ac b/configure.ac index 2152c84..f2490c9 100644 --- a/configure.ac +++ b/configure.ac @@ -82,10 +82,9 @@ if test "${enableval}" = yes; then AC_SUBST([WARN_CFLAGS]) # Warnings for the test suite only. gl_WARN_ADD([-Wundef], [WARN_CFLAGS_TEST]) - WARN_CXXFLAGS_TEST="$WARN_CXXFLAGS $WARN_CFLAGS_TEST" - WARN_CFLAGS_TEST="$WARN_CFLAGS $WARN_CFLAGS_TEST" - AC_SUBST([WARN_CXXFLAGS_TEST]) - AC_SUBST([WARN_CFLAGS_TEST]) + gl_WARN_ADD([-pedantic], [WARN_CFLAGS_TEST]) + AC_SUBST([WARN_CXXFLAGS_TEST], ["$WARN_CXXFLAGS $WARN_CFLAGS_TEST"]) + AC_SUBST([WARN_CFLAGS_TEST], ["$WARN_CFLAGS $WARN_CFLAGS_TEST"]) fi BISON_TEST_FOR_WORKING_C_COMPILER diff --git a/tests/synclines.at b/tests/synclines.at index cc2a722..42b2a66 100644 --- a/tests/synclines.at +++ b/tests/synclines.at @@ -88,6 +88,7 @@ m4_define([AT_TEST_SYNCLINE], AT_DATA([syncline.c], [[#error "1" +int i; // avoids -pedantic warning about an empty translation unit ]]) AT_SYNCLINES_COMPILE([syncline.c]) -- 1.7.0.4 >From f3bd3f7876b4d4c6d22b9590e1a0938ad342c91f Mon Sep 17 00:00:00 2001 From: Joel E. Denny <[email protected]> Date: Sun, 21 Aug 2011 17:35:26 -0400 Subject: [PATCH] lalr1.cc: remove trailing comma from enumerator list. * data/lalr1.cc (yy::parser): Here. This suppresses a -pedantic warning. --- ChangeLog | 6 ++++++ data/lalr1.cc | 2 +- 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index ced339c..76397fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2011-08-21 Joel E. Denny <[email protected]> + lalr1.cc: remove trailing comma from enumerator list. + * data/lalr1.cc (yy::parser): Here. This suppresses a -pedantic + warning. + +2011-08-21 Joel E. Denny <[email protected]> + tests: add -pedantic for --enable-gcc-warnings. This should help to avoid some portability problems. For example, it would have revealed the empty unions fixed by the last patch diff --git a/data/lalr1.cc b/data/lalr1.cc index 37b91ed..cb77025 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -336,7 +336,7 @@ b4_namespace_close])[ yyfinal_ = ]b4_final_state_number[, //< Termination state number. yyterror_ = 1, yyerrcode_ = 256, - yyntokens_ = ]b4_tokens_number[, //< Number of tokens. + yyntokens_ = ]b4_tokens_number[ //< Number of tokens. }; ]b4_parse_param_vars[ -- 1.7.0.4
