diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-12-05 21:40:04 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-12-06 07:26:31 +0100 |
commit | 90d2155912bcee40377620d4836726041a72d537 (patch) | |
tree | 4a83922ab7dd3a15bfccf0ad48ffd41651785742 | |
parent | e754d0931ca75403647cc16100edd98e7e5ceadb (diff) |
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@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | compilerplugins/clang/reservedid.cxx | 1 | ||||
-rw-r--r-- | config_host/config_libcxx.h.in | 17 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | external/boost/StaticLibrary_boost_locale.mk | 6 | ||||
-rw-r--r-- | external/libmspub/ExternalProject_libmspub.mk | 7 | ||||
-rw-r--r-- | unotools/source/i18n/resmgr.cxx | 8 |
6 files changed, 40 insertions, 1 deletions
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> |