[Libreoffice-commits] core.git: configure.ac

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 9 14:48:09 UTC 2020


 configure.ac |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit ad6ef813e9d745d44719dae381d64cdcc2f82719
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Sep 9 14:17:37 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Sep 9 16:47:29 2020 +0200

    Guard against some GCC consteval bug
    
    ...that caused CustomTarget_idlc/parser_test to fail with recent GCC and
    --with-latest-c++ with
    
    > workdir/CustomTarget/idlc/parser_test/in.idl:2 [26:26] : illegal redefinition in scope 'comsunstaruno', 'comsunstarunoXInterface'
    > instdir/sdk/bin/idlc: detected 1 errors
    > instdir/sdk/bin/idlc Version 1.1
    >
    > Compiling: workdir/CustomTarget/idlc/parser_test/in.idl
    > "constructor.tests 20" expected SUCCESS, got 1 (256): FAILED!
    
    because
    
    > const OStringLiteral sGlobal("::");
    
    in idlc/source/astdeclaration.cxx is apparently not initialized properly when
    the OStringLiteral ctor is marked as consteval.  (See the linked GCC bug report
    for further details.)
    
    Change-Id: I44c547fb990c9b13d86b990199ae93e9fbe9d156
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102318
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/configure.ac b/configure.ac
index d97b10fff15b..bfa0d28e5969 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6802,12 +6802,20 @@ if test "$GCC" = yes; then
 fi
 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
 
-AC_MSG_CHECKING([whether $CXX_BASE supports C++20 consteval])
+AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
+dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
+dnl from consteval constructor initializing const variable":
 AC_LANG_PUSH([C++])
 save_CXXFLAGS=$CXXFLAGS
 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-        consteval int f() { return 0; }
+AC_RUN_IFELSE([AC_LANG_PROGRAM([
+        struct S {
+            consteval S() { i = 1; }
+            int i = 0;
+        };
+        S const s;
+    ], [
+        return (s.i == 1) ? 0 : 1;
     ])], [
         AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
         AC_MSG_RESULT([yes])


More information about the Libreoffice-commits mailing list