[Libreoffice-commits] core.git: 2 commits - compilerplugins/clang config_host/config_libcxx.h.in configure.ac external/boost external/libmspub unotools/source vcl/unx

Stephan Bergmann sbergman at redhat.com
Wed Dec 6 06:29:04 UTC 2017


 compilerplugins/clang/reservedid.cxx          |    1 +
 config_host/config_libcxx.h.in                |   17 +++++++++++++++++
 configure.ac                                  |    2 ++
 external/boost/StaticLibrary_boost_locale.mk  |    6 ++++++
 external/libmspub/ExternalProject_libmspub.mk |    7 ++++++-
 unotools/source/i18n/resmgr.cxx               |    8 ++++++++
 vcl/unx/generic/app/i18n_ic.cxx               |    2 +-
 vcl/unx/generic/app/i18n_im.cxx               |    2 +-
 8 files changed, 42 insertions(+), 3 deletions(-)

New commits:
commit da85b582656219a0bc9d20cef59ae6b7ee1c4a9b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Dec 5 22:18:36 2017 +0100

    loplugin:redundantcast
    
    Change-Id: I7e73878f263be57d91a1db2fc3d65d411bd49228
    Reviewed-on: https://gerrit.libreoffice.org/45912
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx
index f2245e5a7d4f..8cf738c4ab62 100644
--- a/vcl/unx/generic/app/i18n_ic.cxx
+++ b/vcl/unx/generic/app/i18n_ic.cxx
@@ -349,7 +349,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) :
 
     if ( maContext != nullptr)
     {
-        maDestroyCallback.callback    = static_cast<XIMProc>(IC_IMDestroyCallback);
+        maDestroyCallback.callback    = IC_IMDestroyCallback;
         maDestroyCallback.client_data = reinterpret_cast<XPointer>(this);
         XSetICValues( maContext,
                       XNDestroyCallback,      &maDestroyCallback,
diff --git a/vcl/unx/generic/app/i18n_im.cxx b/vcl/unx/generic/app/i18n_im.cxx
index 7b7d27ca8940..8e9e8a9be634 100644
--- a/vcl/unx/generic/app/i18n_im.cxx
+++ b/vcl/unx/generic/app/i18n_im.cxx
@@ -359,7 +359,7 @@ SalI18N_InputMethod::CreateMethod ( Display *pDisplay )
         fprintf(stderr, "input method creation failed\n");
     #endif
 
-    maDestroyCallback.callback    = static_cast<XIMProc>(IM_IMDestroyCallback);
+    maDestroyCallback.callback    = IM_IMDestroyCallback;
     maDestroyCallback.client_data = reinterpret_cast<XPointer>(this);
     if (mbUseable && maMethod != nullptr)
         XSetIMValues(maMethod, XNDestroyCallback, &maDestroyCallback, nullptr);
commit 90d2155912bcee40377620d4836726041a72d537
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Dec 5 21:40:04 2017 +0100

    Work around latest Boost 1.65.1 still using deprecated std::auto_ptr
    
    ...in various places, which is gone by default at least from recent libc++ in
    C++17 mode.  So bring it back there for now, until Boost is fixed.
    
    Change-Id: I0b3128d114ab2b5693a84bdc7d2b9b9b9b5c3c76
    Reviewed-on: https://gerrit.libreoffice.org/45910
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/compilerplugins/clang/reservedid.cxx b/compilerplugins/clang/reservedid.cxx
index 6e97303615d3..ad1dcece0037 100644
--- a/compilerplugins/clang/reservedid.cxx
+++ b/compilerplugins/clang/reservedid.cxx
@@ -69,6 +69,7 @@ void ReservedId::run() {
                 && id != "_ATL_STATIC_REGISTRY"
                     // extensions/source/activex/StdAfx2.h
                 && id != "_GLIBCXX_CDTOR_CALLABI"
+                && id != "_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR" // unotools/source/i18n/resmgr.cxx
                 && id != "_MAX_PATH" // Windows
                 && id != "_POSIX_SOURCE"
                 && id != "_USE_MATH_DEFINES" // include/sal/config.h, Windows
diff --git a/config_host/config_libcxx.h.in b/config_host/config_libcxx.h.in
new file mode 100644
index 000000000000..cd90bb821154
--- /dev/null
+++ b/config_host/config_libcxx.h.in
@@ -0,0 +1,17 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_CONFIG_HOST_CONFIG_LIBCXX_H
+#define INCLUDED_CONFIG_HOST_CONFIG_LIBCXX_H
+
+#define HAVE_LIBCXX 0
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/configure.ac b/configure.ac
index 208debcbe5a0..e8d1f6a9bfa7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5947,6 +5947,7 @@ foo bar
 ]])],
     [CPP_LIBRARY=LIBCPP
      cpp_library_name="LLVM libc++"
+     AC_DEFINE([HAVE_LIBCXX])
     ],
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include <utility>
@@ -12487,6 +12488,7 @@ AC_CONFIG_HEADERS([config_host/config_global.h])
 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
 AC_CONFIG_HEADERS([config_host/config_java.h])
 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
+AC_CONFIG_HEADERS([config_host/config_libcxx.h])
 AC_CONFIG_HEADERS([config_host/config_libepubgen.h])
 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
 AC_CONFIG_HEADERS([config_host/config_locales.h])
diff --git a/external/boost/StaticLibrary_boost_locale.mk b/external/boost/StaticLibrary_boost_locale.mk
index 6c185644569a..b6734d149c14 100644
--- a/external/boost/StaticLibrary_boost_locale.mk
+++ b/external/boost/StaticLibrary_boost_locale.mk
@@ -18,6 +18,12 @@ $(eval $(call gb_StaticLibrary_add_defs,boost_locale,\
 	-DBOOST_ALL_NO_LIB -DBOOST_LOCALE_NO_WINAPI_BACKEND -DBOOST_LOCALE_NO_POSIX_BACKEND -DBOOST_USE_WINDOWS_H \
 ))
 
+# Needed when building against libc++ in C++17 mode, as Boost 1.65.1
+# workdir/UnpackedTarball/boost/boost/locale/generator.hpp contains "std::auto_ptr<data> d;":
+$(eval $(call gb_StaticLibrary_add_defs,boost_locale, \
+    -D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR \
+))
+
 $(eval $(call gb_StaticLibrary_use_external,boost_locale,boost_headers))
 
 $(eval $(call gb_StaticLibrary_set_generated_cxx_suffix,boost_locale,cpp))
diff --git a/external/libmspub/ExternalProject_libmspub.mk b/external/libmspub/ExternalProject_libmspub.mk
index 40ba3dc6e56e..b374c0483466 100644
--- a/external/libmspub/ExternalProject_libmspub.mk
+++ b/external/libmspub/ExternalProject_libmspub.mk
@@ -22,6 +22,10 @@ $(eval $(call gb_ExternalProject_use_externals,libmspub,\
 	zlib \
 ))
 
+# -D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR is needed when building against libc++ in C++17 mode, as
+# libmspub configure checking for boost/ptr_container/ptr_vector.hpp can (indirectly) include
+# Boost 1.65.1 workdir/UnpackedTarball/boost/boost/ptr_container/detail/reversible_ptr_container.hpp
+# which mentions std::auto_ptr:
 $(call gb_ExternalProject_get_state_target,libmspub,build) :
 	$(call gb_ExternalProject_run,build,\
 		export PKG_CONFIG="" \
@@ -37,7 +41,8 @@ $(call gb_ExternalProject_get_state_target,libmspub,build) :
 			$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
 			CXXFLAGS="$(gb_CXXFLAGS) $(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS))" \
 			CPPFLAGS="$(CPPFLAGS) $(ICU_UCHAR_TYPE) $(BOOST_CPPFLAGS) \
-				-DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_SYSTEM_NO_DEPRECATED" \
+				-DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_SYSTEM_NO_DEPRECATED \
+				-D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR" \
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
 		&& $(MAKE) \
 	)
diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index a0ad625f7aff..99b27cd7bbbf 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -17,6 +17,14 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+// Needed when #include <boost/locale.hpp> below includes Boost 1.65.1
+// workdir/UnpackedTarball/boost/boost/locale/format.hpp using "std::auto_ptr<data> d;", but must
+// come very early here in case <memory> is already (indirectly) included earlier:
+#include <config_libcxx.h>
+#if HAVE_LIBCXX && __cplusplus >= 201703L
+#define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
+#endif
+
 #include <config_folders.h>
 
 #include <sal/config.h>


More information about the Libreoffice-commits mailing list