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".
This commit is contained in:
Alexandre Duret-Lutz 2013-09-30 19:36:19 +02:00
parent 5663872083
commit 3c943d836a
10 changed files with 27 additions and 12 deletions

View file

@ -54,7 +54,7 @@ AM_PROG_CC_C_O
AC_PROG_CXX
AM_PROG_LEX
AC_PROG_YACC
adl_CHECK_BISON
gl_INIT

15
m4/bison.m4 Normal file
View file

@ -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])])

View file

@ -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)

View file

@ -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)

View file

@ -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;

View file

@ -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)

View file

@ -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)

View file

@ -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 <ltl> subformula booleanatom sere lbtformula boolformula
%type <ltl> bracedsere parenthesedsubformula
%type <minmax> starargs equalargs sqbracketargs gotoargs

View file

@ -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)

View file

@ -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)