Hello,
After commit [1] ("Redefine NULL to nullptr"), building gcc
fails when $CXX_FOR_BUILD is not using C++11 mode by default.
This happens with gcc-4.8 which is still supported.
This patch fixes this by adding -std=c++11 or its equivalent
to $CXX_FOR_BUILD using AX_CXX_COMPILE_STDCXX(11).
Tested by successful cross native build for aarch64-none-linux-gnu target.
OK for trunk?
ChangeLog:
2020-08-20 Ilya Leoshkevich
Vasee Vinayagamoorthy
PR target/95700
* configure: Regenerate.
* configure.ac: Require C++11 for building code generation tools.
Regards
Vasee Vinayagamoorthy
PS: I do not have commit rights, therefore could I request
someone to commit it on my behalf if this patch is approved.
Thanks in advance.
[1]
https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=d59a576b8b5e12c3a56f0262912090e2921f5daa
diff --git a/configure b/configure
index a0c5aca9e8d..1023dc72fd4 100755
--- a/configure
+++ b/configure
@@ -6523,6 +6523,1011 @@ $as_echo "#define HAVE_CXX11 1" >>confdefs.h
fi
+# Also require C++11 for building code generation tools.
+# Do nothing if "${build}" = "${host}", because in this case
+# CXX_FOR_BUILD="\$(CXX)", and $CXX is already set to the correct value above.
+if test "${build}" != "${host}"; then
+ saved_CXX=$CXX
+ saved_CXXCPP=$CXXCPP
+ CXX=$CXX_FOR_BUILD
+ CXXCPP=
+ax_cxx_compile_alternatives="11 0x"ax_cxx_compile_cxx11_required=true
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+ ac_success=no
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features by default" >&5
+$as_echo_n "checking whether $CXX supports C++11 features by default... " >&6; }
+if ${ax_cv_cxx_compile_cxx11+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+// If the compiler admits that it is not ready for C++11, why torture it?
+// Hopefully, this will speed up the test.
+
+#ifndef __cplusplus
+
+#error "This is not a C++ compiler"
+
+#elif __cplusplus < 201103L
+
+#error "This is not a C++11 compiler"
+
+#else
+
+namespace cxx11
+{
+
+ namespace test_static_assert
+ {
+
+template
+struct check
+{
+ static_assert(sizeof(int) <= sizeof(T), "not big enough");
+};
+
+ }
+
+ namespace test_final_override
+ {
+
+struct Base
+{
+ virtual ~Base() {}
+ virtual void f() {}
+};
+
+struct Derived : public Base
+{
+ virtual ~Derived() override {}
+ virtual void f() override {}
+};
+
+ }
+
+ namespace test_double_right_angle_brackets
+ {
+
+template < typename T >
+struct check {};
+
+typedef check single_type;
+typedef check> double_type;
+typedef check>> triple_type;
+typedef check>>> quadruple_type;
+
+ }
+
+ namespace test_decltype
+ {
+
+int
+f()
+{
+ int a = 1;
+ decltype(a) b = 2;
+ return a + b;
+}
+
+ }
+
+ namespace test_type_deduction
+ {
+
+template < typename T1, typename T2 >
+struct is_same
+{
+ static const bool value = false;
+};
+
+template < typename T >
+struct is_same
+{
+ static const bool value = true;
+};
+
+template < typename T1, typename T2 >
+auto
+add(T1 a1, T2 a2) -> decltype(a1 + a2)
+{
+ return a1 + a2;
+}
+
+int
+test(const int c, volatile int v)
+{
+ static_assert(is_same::value == true, "");
+ static_assert(is_same::value == false, "");
+ static_assert(is_same::value == false, "");
+ auto ac = c;
+ auto av = v;
+ auto sumi = ac + av + 'x';
+ auto sumf = ac + av + 1.0;
+ static_assert(is_same::value == true, "");
+ static_assert(is_same::value == true, "");
+ static_assert(is_same::value == true, "");
+ static_assert(is_same::value == false, "");
+ static_assert(is_same::value == true, "");
+ return (sumf > 0.0) ? sumi : add(c, v);
+}
+
+ }
+
+ namespace test_noexcept
+ {
+
+int f() { return 0; }
+int g() noexcept { return 0; }
+
+static_assert(noexcept(f()) == false, "");
+static_assert(noexcept(g()) == true, "");
+
+ }
+
+ namespace test_constexpr
+ {
+
+template < typename CharT >
+unsigned long constexpr
+strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
+{
+ return *s ? strlen_