[Libreoffice-commits] core.git: external/boost
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Tue Oct 1 21:33:44 UTC 2019
external/boost/clang-cl.patch.0 | 13 +++++++++++++
1 file changed, 13 insertions(+)
New commits:
commit 62808ef28e05eee4945a6a15d981350d1306b848
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Oct 1 15:25:46 2019 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Oct 1 23:32:23 2019 +0200
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 at redhat.com>
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()
# ^
More information about the Libreoffice-commits
mailing list