mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
build: strengthen the C++ standard flag test
On the CI, we have this spurious failure with clang 3.9 with
-std=c++17:
In file included from list.y:23:
In file included from /usr/include/c++/4.8/iostream:39:
In file included from /usr/include/c++/4.8/ostream:38:
In file included from /usr/include/c++/4.8/ios:42:
In file included from /usr/include/c++/4.8/bits/ios_base.h:41:
In file included from /usr/include/c++/4.8/bits/locale_classes.h:40:
In file included from /usr/include/c++/4.8/string:52:
In file included from /usr/include/c++/4.8/bits/basic_string.h:2815:
In file included from /usr/include/c++/4.8/ext/string_conversions.h:43:
/usr/include/c++/4.8/cstdio:120:11: error: no member named 'gets' in the global namespace
using ::gets;
~~^
This shows that our test, based on gl_WARN_ADD, is a joke. We have to
really check for at least a bit of C++.
* m4/ax_check_compile_flag.m4, m4/bison-cxx-std.m4: New.
* configure.ac: Use them to make sure the compiler actually works.
This commit is contained in:
26
configure.ac
26
configure.ac
@@ -21,7 +21,8 @@
|
||||
# better to avoid a typo in the 'configure --help' entry for the YACC
|
||||
# environment variable.
|
||||
AC_PREREQ([2.68])
|
||||
m4_pattern_forbid([^gl_[A-Z]])
|
||||
m4_pattern_forbid([^_?(gl_[A-Z]|BISON_)])
|
||||
m4_pattern_allow([^BISON_USE_NLS$])
|
||||
|
||||
AC_INIT([GNU Bison],
|
||||
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
||||
@@ -52,18 +53,6 @@ AC_CONFIG_HEADERS([lib/config.h:lib/config.in.h])
|
||||
# Checks for the compiler.
|
||||
AC_PROG_CC_STDC
|
||||
AC_PROG_CXX
|
||||
AC_LANG_PUSH([C++])
|
||||
gl_WARN_ADD([-fno-exceptions], [NO_EXCEPTIONS_CXXFLAGS])
|
||||
gl_WARN_ADD([-std=c++98], [CXX98_CXXFLAGS])
|
||||
gl_WARN_ADD([-std=c++03], [CXX03_CXXFLAGS])
|
||||
gl_WARN_ADD([-std=c++11], [CXX11_CXXFLAGS])
|
||||
gl_WARN_ADD([-std=c++14], [CXX14_CXXFLAGS])
|
||||
gl_WARN_ADD([-std=c++17], [CXX17_CXXFLAGS])
|
||||
gl_WARN_ADD([-std=c++2a], [CXX2A_CXXFLAGS])
|
||||
AC_SUBST([STDCXX_FLAGS],
|
||||
["$CXX98_CXXFLAGS $CXX03_CXXFLAGS $CXX11_CXXFLAGS $CXX14_CXXFLAGS $CXX17_CXXFLAGS $CXX2A_CXXFLAGS "])
|
||||
AM_CONDITIONAL([ENABLE_CXX11], [test x"$CXX11_CXXFLAGS" != x])
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
# Gnulib (early checks).
|
||||
gl_EARLY
|
||||
@@ -82,6 +71,17 @@ AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
|
||||
[lv_cv_gcc_pragma_push_works=no])
|
||||
CFLAGS=$save_CFLAGS])
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
gl_WARN_ADD([-fno-exceptions], [NO_EXCEPTIONS_CXXFLAGS])
|
||||
gl_WARN_ADD([-std=c++98], [CXX98_CXXFLAGS])
|
||||
gl_WARN_ADD([-std=c++03], [CXX03_CXXFLAGS])
|
||||
BISON_CXX_COMPILE_STDCXX_11
|
||||
BISON_CXX_COMPILE_STDCXX_14
|
||||
BISON_CXX_COMPILE_STDCXX_17
|
||||
BISON_CXX_COMPILE_STDCXX_2A
|
||||
AM_CONDITIONAL([ENABLE_CXX11], [test x"$CXX11_CXXFLAGS" != x])
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
AC_ARG_ENABLE([gcc-warnings],
|
||||
[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended).
|
||||
Also, issue synclines from the examples/ to
|
||||
|
||||
Reference in New Issue
Block a user