From 3c943d836ab440617ee0f5868c2a2eaba1c0e260 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Mon, 30 Sep 2013 19:36:19 +0200 Subject: [PATCH] Add support for Bison 3.0. We still want to remain compatible with Bison 2.7 so instead of fixing all the new errors reported by 3.0 we silence some warning. We should fix these for good once Bison 3.0 is more widespread. * m4/bison.m4: New file. Test if bison support -Wno-empty-rule and -Wno-deprecated. Define BISON and BISON_EXTRA_FLAGS. * configure.ac: Do not test for yacc, use the above test instead. * src/dstarparse/Makefile.am, src/eltlparse/Makefile.am, src/kripkeparse/Makefile.am, src/ltlparse/Makefile.am, src/neverparse/Makefile.am, src/tgbaparse/Makefile.am: Use BISON and BISON_EXTRA_FLAGS. * src/ltlparse/ltlparse.yy: Fix or and remove useless %right/%nonassoc settings. * src/eltlparse/eltlparse.yy: Likewise, and remove "%pure-parser". --- configure.ac | 2 +- m4/bison.m4 | 15 +++++++++++++++ src/dstarparse/Makefile.am | 2 +- src/eltlparse/Makefile.am | 2 +- src/eltlparse/eltlparse.yy | 2 +- src/kripkeparse/Makefile.am | 2 +- src/ltlparse/Makefile.am | 2 +- src/ltlparse/ltlparse.yy | 8 ++++---- src/neverparse/Makefile.am | 2 +- src/tgbaparse/Makefile.am | 2 +- 10 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 m4/bison.m4 diff --git a/configure.ac b/configure.ac index b0d2b3644..a8df259ee 100644 --- a/configure.ac +++ b/configure.ac @@ -54,7 +54,7 @@ AM_PROG_CC_C_O AC_PROG_CXX AM_PROG_LEX -AC_PROG_YACC +adl_CHECK_BISON gl_INIT diff --git a/m4/bison.m4 b/m4/bison.m4 new file mode 100644 index 000000000..fcb8f3b63 --- /dev/null +++ b/m4/bison.m4 @@ -0,0 +1,15 @@ +AC_DEFUN([adl_CHECK_BISON], +[AC_ARG_VAR([BISON], [Bison parser generator]) +AC_CHECK_PROGS([BISON], [bison]) +if test -n "$BISON"; then + # Bison 3.0 has warning about issues that cannot be fixed in a + # compatible way with Bison 2.7. Since we want to be compatible + # with both version AND use -Werror, disable those warnings. + # (Unfortunately -Wno-error=empty-rule,no-error=deprecated does not + # work: https://lists.gnu.org/archive/html/bug-bison/2013-09/index.html) + opt='-Wno-empty-rule -Wno-deprecated -Wno-precedence' + if AM_RUN_LOG([$BISON $opt --version]); then + BISON_EXTRA_FLAGS=$opt + fi +fi +AC_SUBST([BISON_EXTRA_FLAGS])]) diff --git a/src/dstarparse/Makefile.am b/src/dstarparse/Makefile.am index a50feabd0..e739ba636 100644 --- a/src/dstarparse/Makefile.am +++ b/src/dstarparse/Makefile.am @@ -43,7 +43,7 @@ $(FROM_DSTARPARSE_YY_MAIN): $(srcdir)/$(DSTARPARSE_YY) ## $(srcdir)/$(DSTARPARSE_YY), it will also use the value of $(srcdir)/ ## in the generated include statements. cd $(srcdir) && \ - bison -Wall -Werror --report=all \ + $(BISON) -Wall -Werror --report=all $(BISON_EXTRA_FLAGS) \ $(DSTARPARSE_YY) -o $(FROM_DSTARPARSE_YY_MAIN) $(FROM_DSTARPARSE_YY_OTHERS): $(DSTARPARSE_YY) @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $(FROM_DSTARPARSE_YY_MAIN) diff --git a/src/eltlparse/Makefile.am b/src/eltlparse/Makefile.am index 91f6bba7a..0d0fb0d4a 100644 --- a/src/eltlparse/Makefile.am +++ b/src/eltlparse/Makefile.am @@ -40,7 +40,7 @@ $(FROM_ELTLPARSE_YY_MAIN): $(srcdir)/$(ELTLPARSE_YY) ## $(srcdir)/$(ELTLPARSE_YY), it will also use the value of $(srcdir)/ ## in the generated include statements. cd $(srcdir) && \ - bison -Wall -Werror --report=all \ + $(BISON) -Wall -Werror --report=all $(BISON_EXTRA_FLAGS) \ $(ELTLPARSE_YY) -o $(FROM_ELTLPARSE_YY_MAIN) $(FROM_ELTLPARSE_YY_OTHERS): $(ELTLPARSE_YY) @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $(FROM_ELTLPARSE_YY_MAIN) diff --git a/src/eltlparse/eltlparse.yy b/src/eltlparse/eltlparse.yy index e52d1d6a7..16e32bfff 100644 --- a/src/eltlparse/eltlparse.yy +++ b/src/eltlparse/eltlparse.yy @@ -67,7 +67,7 @@ namespace spot %parse-param {const spot::ltl::formula* &result} %lex-param {spot::eltl::parse_error_list_t &pe} %expect 0 -%pure-parser + %union { int ival; diff --git a/src/kripkeparse/Makefile.am b/src/kripkeparse/Makefile.am index c2e7e11c6..9d347b134 100644 --- a/src/kripkeparse/Makefile.am +++ b/src/kripkeparse/Makefile.am @@ -44,7 +44,7 @@ $(FROM_KRIPKEPARSE_YY_MAIN): $(srcdir)/$(KRIPKEPARSE_YY) ## $(srcdir)/$(KRIPKEPARSE_YY), it will also use the value of $(srcdir)/ ## in the generated include statements. cd $(srcdir) && \ - bison -Wall -Werror --report=all \ + $(BISON) -Wall -Werror --report=all $(BISON_EXTRA_FLAGS) \ $(KRIPKEPARSE_YY) -o $(FROM_KRIPKEPARSE_YY_MAIN) $(FROM_KRIPKEPARSE_YY_OTHERS): $(KRIPKEPARSE_YY) @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $(FROM_KRIPKEPARSE_YY_MAIN) diff --git a/src/ltlparse/Makefile.am b/src/ltlparse/Makefile.am index ccbc0eac0..076ebbc5d 100644 --- a/src/ltlparse/Makefile.am +++ b/src/ltlparse/Makefile.am @@ -43,7 +43,7 @@ $(FROM_LTLPARSE_YY_MAIN): $(srcdir)/$(LTLPARSE_YY) ## $(srcdir)/$(LTLPARSE_YY), it will also use the value of $(srcdir)/ ## in the generated include statements. cd $(srcdir) && \ - bison -Wall -Werror --report=all \ + $(BISON) -Wall -Werror --report=all $(BISON_EXTRA_FLAGS) \ $(LTLPARSE_YY) -o $(FROM_LTLPARSE_YY_MAIN) $(FROM_LTLPARSE_YY_OTHERS): $(LTLPARSE_YY) @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $(FROM_LTLPARSE_YY_MAIN) diff --git a/src/ltlparse/ltlparse.yy b/src/ltlparse/ltlparse.yy index a430eaae1..1bb71d4b6 100644 --- a/src/ltlparse/ltlparse.yy +++ b/src/ltlparse/ltlparse.yy @@ -197,7 +197,7 @@ using namespace spot::ltl; /* Priorities. */ /* Low priority SERE-LTL binding operator. */ -%right OP_UCONCAT OP_ECONCAT OP_UCONCAT_NONO OP_ECONCAT_NONO +%nonassoc OP_UCONCAT OP_ECONCAT OP_UCONCAT_NONO OP_ECONCAT_NONO %left OP_CONCAT %left OP_FUSION @@ -222,11 +222,11 @@ using namespace spot::ltl; /* High priority regex operator. */ %nonassoc OP_BSTAR OP_STAR_OPEN OP_PLUS OP_EQUAL_OPEN OP_GOTO_OPEN -/* Not has the most important priority after Wring's `=0' and `=1'. */ +/* Not has the most important priority (after Wring's `=0' and `=1', + but as those can only attach to atomic proposition, they do not + need any precedence). */ %nonassoc OP_NOT -%nonassoc OP_POST_NEG OP_POST_POS - %type subformula booleanatom sere lbtformula boolformula %type bracedsere parenthesedsubformula %type starargs equalargs sqbracketargs gotoargs diff --git a/src/neverparse/Makefile.am b/src/neverparse/Makefile.am index 904807c5e..d82eb71e8 100644 --- a/src/neverparse/Makefile.am +++ b/src/neverparse/Makefile.am @@ -43,7 +43,7 @@ $(FROM_NEVERCLAIMPARSE_YY_MAIN): $(srcdir)/$(NEVERCLAIMPARSE_YY) ## $(srcdir)/$(NEVERCLAIMPARSE_YY), it will also use the value of $(srcdir)/ ## in the generated include statements. cd $(srcdir) && \ - bison -Wall -Werror --report=all \ + $(BISON) -Wall -Werror --report=all $(BISON_EXTRA_FLAGS) \ $(NEVERCLAIMPARSE_YY) -o $(FROM_NEVERCLAIMPARSE_YY_MAIN) $(FROM_NEVERCLAIMPARSE_YY_OTHERS): $(NEVERCLAIMPARSE_YY) @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $(FROM_NEVERCLAIMPARSE_YY_MAIN) diff --git a/src/tgbaparse/Makefile.am b/src/tgbaparse/Makefile.am index eeb67ce86..754a0552e 100644 --- a/src/tgbaparse/Makefile.am +++ b/src/tgbaparse/Makefile.am @@ -46,7 +46,7 @@ $(FROM_TGBAPARSE_YY_MAIN): $(srcdir)/$(TGBAPARSE_YY) ## $(srcdir)/$(TGBAPARSE_YY), it will also use the value of $(srcdir)/ ## in the generated include statements. cd $(srcdir) && \ - bison -Wall -Werror --report=all \ + $(BISON) -Wall -Werror --report=all $(BISON_EXTRA_FLAGS) \ $(TGBAPARSE_YY) -o $(FROM_TGBAPARSE_YY_MAIN) $(FROM_TGBAPARSE_YY_OTHERS): $(TGBAPARSE_YY) @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $(FROM_TGBAPARSE_YY_MAIN)