62808ef28e
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>
48 lines
2.1 KiB
Text
48 lines
2.1 KiB
Text
--- boost/multi_array/base.hpp
|
|
+++ boost/multi_array/base.hpp
|
|
@@ -222,7 +222,7 @@
|
|
// MSVC 2010 is broken in debug mode: it requires
|
|
// that an Output Iterator have output_iterator_tag in its iterator_category if
|
|
// that iterator is not bidirectional_iterator or random_access_iterator.
|
|
-#if BOOST_WORKAROUND(BOOST_MSVC, >= 1600)
|
|
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1600) || defined __clang__
|
|
struct mutable_iterator_tag
|
|
: boost::random_access_traversal_tag, std::input_iterator_tag
|
|
{
|
|
@@ -274,7 +274,7 @@
|
|
//
|
|
// iterator support
|
|
//
|
|
-#if BOOST_WORKAROUND(BOOST_MSVC, >= 1600)
|
|
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1600) || defined __clang__
|
|
// Deal with VC 2010 output_iterator_tag requirement
|
|
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()
|
|
# ^
|
|
--- boost/thread/detail/config.hpp
|
|
+++ boost/thread/detail/config.hpp
|
|
@@ -396,7 +396,7 @@
|
|
#else //Use default
|
|
# if defined(BOOST_THREAD_PLATFORM_WIN32)
|
|
# if defined(BOOST_MSVC) || defined(BOOST_INTEL_WIN) \
|
|
- || defined(__MINGW32__) || defined(MINGW32) || defined(BOOST_MINGW32)
|
|
+ || defined(__MINGW32__) || defined(MINGW32) || defined(BOOST_MINGW32) || defined __clang__
|
|
//For compilers supporting auto-tss cleanup
|
|
//with Boost.Threads lib, use Boost.Threads lib
|
|
# define BOOST_THREAD_USE_LIB
|