Mercurial > octave
diff m4/acinclude.m4 @ 29746:7f339da6cabd
avoid possible gcc warning about C++ one definition rule (bug #60586)
* acinclude.m4 (OCTAVE_PROG_BISON): Also check whether api.prefix
applies to yysymbol_kind_t in the files that bison generates. If so,
substitute new variables, OCTAVE_PARSER_CPPFLAGS and
OCTAVE_TEX_PARSER_CPPFLAGS.
* libinterp/corefcn/module.mk (%canon_reldir%_libcorefcn_la_CPPFLAGS):
Add $(OCTAVE_TEX_PARSER_CPPFLAGS) to the list.
* libinterp/parse-tree/module.mk (%canon_reldir%_libparse_tree_la_CPPFLAGS):
Add $(OCTAVE_PARSER_CPPFLAGS) to the list.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 08 Jun 2021 15:49:37 -0400 |
parents | 5811df727e96 |
children | e0fded8bd7bb |
line wrap: on
line diff
--- a/m4/acinclude.m4 Mon Jun 07 22:54:48 2021 +0200 +++ b/m4/acinclude.m4 Tue Jun 08 15:49:37 2021 -0400 @@ -3221,6 +3221,39 @@ done rm -f conftest.yy y.tab.h y.tab.c ]) + + AC_CACHE_CHECK([whether api.prefix applies to yysymbol_kind_t], + [octave_cv_bison_api_prefix_applies_to_yysymbol_kind_t], [ + [case "$octave_cv_bison_api_prefix_decl_style" in + "api brace") + def='%define api.prefix {PREFIX_}' + ;; + "api quote") + def='%define api.prefix "PREFIX_"' + ;; + "name brace") + def='%define name-prefix {PREFIX_}' + ;; + "name quote") + def='%define name-prefix "PREFIX_"' + ;; + esac] + cat << EOF > conftest.yy +$def +%start input +%% +input:; +%% +EOF + ## Older versions of bison only warn and exit with success. + $YACC $WARN_YFLAGS conftest.yy + if grep PREFIX_symbol_kind_t y.tab.c > /dev/null; then + octave_cv_bison_api_prefix_applies_to_yysymbol_kind_t=yes + else + octave_cv_bison_api_prefix_applies_to_yysymbol_kind_t=no + fi + rm -f conftest.yy y.tab.h y.tab.c + ]) fi if test -z "$octave_cv_bison_api_prefix_decl_style" \ @@ -3245,7 +3278,14 @@ building from VCS sources. " OCTAVE_CONFIGURE_WARNING([warn_bison]) + fi + if test "$octave_cv_bison_api_prefix_applies_to_yysymbol_kind_t" = no; then + OCTAVE_PARSER_CPPFLAGS="-Dyysymbol_kind_t=octave_symbol_kind_t" + OCTAVE_TEX_PARSER_CPPFLAGS="-Dyysymbol_kind_t=octave_tex_symbol_kind_t" + fi + AC_SUBST(OCTAVE_PARSER_CPPFLAGS) + AC_SUBST(OCTAVE_TEX_PARSER_CPPFLAGS) AC_SUBST(WARN_YFLAGS) ]) dnl