[Libreoffice-commits] core.git: configure.ac solenv/gbuild

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Sep 5 12:36:59 UTC 2018


 configure.ac                           |   12 ++++++++----
 solenv/gbuild/platform/com_MSC_defs.mk |    2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)

New commits:
commit 62bfe29f9045127d479c42376f599ddfb0fbb2ca
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Aug 30 18:39:04 2018 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Sep 5 14:36:33 2018 +0200

    Already set MSVC's -std:c++17 during the configure.ac feature checks
    
    For cl version 19.15.26726 (VS 2017 15.8.1) that would detect
    HAVE_CPP_GUARANTEED_COPY_ELISION, but wrongly so as it turns out.  :(
    
    The compiler has C++20's __cpp_guaranteed_copy_elision feature-test macro
    defined (and <https://en.cppreference.com/w/cpp/compiler_support> claims that
    C++17 "Guaranteed copy elision" is supported in "MSVC 19.13", aka VS 2017 15.6).
    But the build then failed at
    
    > [build CXX] sw/source/uibase/app/docsh2.cxx
    [...]
    > C:/lo/core/sw/source/uibase/app/docsh2.cxx(427): error C2248: 'editeng::SortedAutoCompleteStrings::SortedAutoCompleteStrings': cannot access private member declared in class 'editeng::SortedAutoCompleteStrings'
    > C:\lo\core\include\editeng/swafopt.hxx(66): note: see declaration of 'editeng::SortedAutoCompleteStrings::SortedAutoCompleteStrings'
    > C:\lo\core\include\editeng/swafopt.hxx(55): note: see declaration of 'editeng::SortedAutoCompleteStrings'
    
    due to enabling the HAVE_CPP_GUARANTEED_COPY_ELISION-conditional code in
    include/editeng/swafopt.hxx.
    
    (And while my VS 15.8.1 stopped detecting HAVE_CPP_GUARANTEED_COPY_ELISION then,
    <https://ci.libreoffice.org/job/gerrit_windows/14774/>, reportedly done with
    15.7.4 aka 15.7.27703.2035, still mis-detected it and then failed at
    sw/source/uibase/app/docsh2.cxx(427) as above, so needed a tweak to the check in
    configure.ac.)
    
    Change-Id: Ie14d74f3f795d819047deaafdb1e644ed00ee406
    Reviewed-on: https://gerrit.libreoffice.org/59835
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/configure.ac b/configure.ac
index 0e9d452ca591..ebf8b01ac657 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6181,7 +6181,7 @@ CXXFLAGS_CXX11=
 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
     AC_MSG_CHECKING([whether $CXX supports C++11])
     AC_MSG_RESULT(yes)
-    # MSVC supports (a subset of) CXX11 without any switch
+    CXXFLAGS_CXX11=-std:c++17
 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
     HAVE_CXX11=
     AC_MSG_CHECKING([whether $CXX supports C++17, C++14, or C++11])
@@ -6413,14 +6413,18 @@ AC_LANG_PUSH([C++])
 save_CXXFLAGS=$CXXFLAGS
 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-        #if !defined __cpp_guaranteed_copy_elision
+        // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
+        // supporting it:
+        #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
         struct S {
         private:
             S(S const &);
         public:
-            S copy() const { return *this; }
+            S();
+            ~S();
         };
-        void f(S & s) { S c(s.copy()); }
+        S copy();
+        void f() { S c(copy()); }
         #endif
     ])], [
         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
diff --git a/solenv/gbuild/platform/com_MSC_defs.mk b/solenv/gbuild/platform/com_MSC_defs.mk
index 3791ccac65d6..252690c8c0a8 100644
--- a/solenv/gbuild/platform/com_MSC_defs.mk
+++ b/solenv/gbuild/platform/com_MSC_defs.mk
@@ -167,7 +167,7 @@ endif
 
 gb_CXXFLAGS := \
 	-utf-8 \
-	-std:c++17 \
+	$(CXXFLAGS_CXX11) \
 	-Gd \
 	-GR \
 	-Gs \


More information about the Libreoffice-commits mailing list