summaryrefslogtreecommitdiffstats
path: root/external/boost
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-10-01 15:25:46 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-10-01 23:32:23 +0200
commit62808ef28e05eee4945a6a15d981350d1306b848 (patch)
treedc904c5e3e85c501f066d2acf3da06ec103dcbdf /external/boost
parentCXX_X64_BINARY must be clang-cl not cl when building with clang-cl (diff)
downloadcore-62808ef28e05eee4945a6a15d981350d1306b848.tar.gz
core-62808ef28e05eee4945a6a15d981350d1306b848.zip
external/boost: clang-cl cannot use MSVC's ATOMIC_FLAG_INIT
The C++ standard leaves it unspecified how ATOMIC_FLAG_INIT is defined, and at least MS Visual Studio 2017 version 15.9 defines it as {0}, asking for list- initialization, but std::atomic_flag is no aggregate (it has a default ctor) and has no suitable ctor for that initializer list. Other standard library implementations solve that by e.g. adding a std::atomic_flag ctor taking a bool parameter, and defining ATOMIC_FLAG_INIT as std::atomic_flag(false); but MSVC apparently relies on some non-standard behavior here that allows to initialize std::atomic_flag from {0}. But that is apparently not supported by clang-cl, causing failures like > [build CXX] workdir/UnpackedTarball/boost/libs/locale/src/shared/date_time.cpp > In file included from workdir/UnpackedTarball/boost/libs/locale/src/shared/date_time.cpp:11: > In file included from workdir/UnpackedTarball/boost\boost/thread/locks.hpp:10: > In file included from workdir/UnpackedTarball/boost\boost/thread/lock_algorithms.hpp:11: > In file included from workdir/UnpackedTarball/boost\boost/thread/lock_types.hpp:18: > In file included from workdir/UnpackedTarball/boost\boost/thread/thread_time.hpp:9: > In file included from workdir/UnpackedTarball/boost\boost/date_time/time_clock.hpp:17: > In file included from external/boost/include\boost/shared_ptr.hpp:27: > In file included from workdir/UnpackedTarball/boost\boost/shared_ptr.hpp:17: > In file included from workdir/UnpackedTarball/boost\boost/smart_ptr/shared_ptr.hpp:36: > workdir/UnpackedTarball/boost\boost/smart_ptr/detail/spinlock_pool.hpp(77,5): error: no matching constructor for initialization of 'std::atomic_flag' > BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, > ^~~~~~~~~~~~~~~~~~~~~~~~~~ > workdir/UnpackedTarball/boost\boost/smart_ptr/detail/spinlock_std_atomic.hpp(81,38): note: expanded from macro 'BOOST_DETAIL_SPINLOCK_INIT' > #define BOOST_DETAIL_SPINLOCK_INIT { ATOMIC_FLAG_INIT } > ^~~~~~~~~~~~~~~~ > C:/PROGRA~2/MIB055~1/2017/COMMUN~1/VC/Tools/MSVC/1416~1.270/Include\atomic(158,26): note: expanded from macro 'ATOMIC_FLAG_INIT' > #define ATOMIC_FLAG_INIT {0} > ^~~ > C:/PROGRA~2/MIB055~1/2017/COMMUN~1/VC/Tools/MSVC/1416~1.270/Include\atomic(169,2): note: candidate constructor not viable: no known conversion from 'int' to 'const std::atomic_flag' for 1st argument > atomic_flag(const atomic_flag&) = delete; > ^ > C:/PROGRA~2/MIB055~1/2017/COMMUN~1/VC/Tools/MSVC/1416~1.270/Include\atomic(168,2): note: candidate constructor not viable: requires 0 arguments, but 1 was provided > atomic_flag() noexcept = default; > ^ The internals of external/boost appear to be the only place where we currently use ATOMIC_FLAG_INIT, and we can work around that easily by picking a different backend in boost/smart_ptr/detail/spinlock.hpp for the problematic combination of Clang and _MSC_VER 1916 (which may need to be extended to further MSVC versions). Change-Id: Ie6aa62556efbedd3897ad7803b546cb8088ebe10 Reviewed-on: https://gerrit.libreoffice.org/79967 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'external/boost')
-rw-r--r--external/boost/clang-cl.patch.013
1 files changed, 13 insertions, 0 deletions
diff --git a/external/boost/clang-cl.patch.0 b/external/boost/clang-cl.patch.0
index 8834e4e626f3..49259a0d5783 100644
--- a/external/boost/clang-cl.patch.0
+++ b/external/boost/clang-cl.patch.0
@@ -19,6 +19,19 @@
typedef array_iterator<T,T*,mpl::size_t<NumDims>,reference,
mutable_iterator_tag> iterator;
+# clang-cl cannot use MSVC's ATOMIC_FLAG_INIT:
+--- boost/smart_ptr/detail/spinlock.hpp
++++ boost/smart_ptr/detail/spinlock.hpp
+@@ -43,7 +43,7 @@
+ #elif defined( BOOST_SP_USE_PTHREADS )
+ # include <boost/smart_ptr/detail/spinlock_pt.hpp>
+
+-#elif !defined( BOOST_NO_CXX11_HDR_ATOMIC )
++#elif !defined( BOOST_NO_CXX11_HDR_ATOMIC ) && !(defined __clang__ && defined _MSC_VER && _MSC_VER == 1916)
+ # include <boost/smart_ptr/detail/spinlock_std_atomic.hpp>
+
+ #elif defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ )
+
# workdir/UnpackedTarball/boost/libs/thread/src/win32/thread.cpp(1006,36) : error: dllimport cannot be applied to non-inline function definition
# BOOST_THREAD_DECL void __cdecl on_process_enter()
# ^