summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-11-12 18:17:51 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-11-13 10:29:04 +0100
commit9b421ef6dee41c33d1a82fc8a8ec6983f13fe2a7 (patch)
tree6898866490c5181e1e2ad6e5e5d55429b187f9a1 /external
parent5d201bc4909698d276cc4764017b15faa9b5b7be (diff)
external/boost: Adapt to clang-cl
Change-Id: Ib07e85bd1a157b6fa78f07a17f8cf5033b01bddf
Diffstat (limited to 'external')
-rw-r--r--external/boost/StaticLibrary_boostthread.mk20
-rw-r--r--external/boost/UnpackedTarball_boost.mk2
-rw-r--r--external/boost/clang-cl.patch.042
3 files changed, 64 insertions, 0 deletions
diff --git a/external/boost/StaticLibrary_boostthread.mk b/external/boost/StaticLibrary_boostthread.mk
index 77b6ea12229f..f2498d5fdd13 100644
--- a/external/boost/StaticLibrary_boostthread.mk
+++ b/external/boost/StaticLibrary_boostthread.mk
@@ -18,6 +18,26 @@ $(eval $(call gb_StaticLibrary_add_defs,boostthread,\
-DBOOST_ALL_NO_LIB \
))
+# Lots of the declarations in boost duplicated from windows.h when
+# BOOST_USE_WINDOWS_H is not defined (which appears to be the normal case) cause
+# warnings or even errors with Clang when windows.h is included too (e.g.,
+# "conflicting types for 'FileTimeToLocalFileTime'" between
+# C:/PROGRA~2/WI3CF2~1/8.1/include/um/fileapi.h and
+# workdir/UnpackedTarball/boost/boost/date_time/filetime_functions.hpp), for
+# which it appears easies to just define BOOST_USE_WINDOWS_H; also
+# -Winvalid-constexpr (e.g., reported from the constexpr definition of lowest()
+# in workdir/UnpackedTarball/boost/boost/chrono/duration.hpp, which uses
+# std::numeric_limits<>::max() from MSVC's standard library, where nothing is
+# marked constexpr) is apparently reported as an error by default:
+ifeq ($(OS),WNT)
+ifeq ($(COM_IS_CLANG),TRUE)
+$(eval $(call gb_StaticLibrary_add_defs,boostthread, \
+ -DBOOST_USE_WINDOWS_H \
+ -Wno-error=invalid-constexpr \
+))
+endif
+endif
+
$(eval $(call gb_StaticLibrary_use_external,boostthread,boost_headers))
$(eval $(call gb_StaticLibrary_set_generated_cxx_suffix,boostthread,cpp))
diff --git a/external/boost/UnpackedTarball_boost.mk b/external/boost/UnpackedTarball_boost.mk
index 6beeac17a452..e52f6cd57852 100644
--- a/external/boost/UnpackedTarball_boost.mk
+++ b/external/boost/UnpackedTarball_boost.mk
@@ -85,6 +85,8 @@ boost_patches += boost_1_59_0.multi_array.wshadow.patch
# https://svn.boost.org/trac/boost/ticket/11501
boost_patches += boost_1_59_0.property_tree.wreturn-type.patch
+boost_patches += clang-cl.patch.0
+
$(eval $(call gb_UnpackedTarball_UnpackedTarball,boost))
$(eval $(call gb_UnpackedTarball_set_tarball,boost,$(BOOST_TARBALL)))
diff --git a/external/boost/clang-cl.patch.0 b/external/boost/clang-cl.patch.0
new file mode 100644
index 000000000000..0dd44d4a3678
--- /dev/null
+++ b/external/boost/clang-cl.patch.0
@@ -0,0 +1,42 @@
+--- boost/config/compiler/clang.hpp
++++ boost/config/compiler/clang.hpp
+@@ -260,9 +260,7 @@
+
+
+ // Unused attribute:
+-#if defined(__GNUC__) && (__GNUC__ >= 4)
+ # define BOOST_ATTRIBUTE_UNUSED __attribute__((unused))
+-#endif
+
+ #ifndef BOOST_COMPILER
+ # define BOOST_COMPILER "Clang version " __clang_version__
+
+# workdir/UnpackedTarball/boost\boost/smart_ptr/detail/sp_counted_base_clang.hpp(29,1) : error: cannot mangle this C11 atomic type yet
+# inline void atomic_increment( atomic_int_least32_t * pw )
+# ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+--- boost/smart_ptr/detail/sp_counted_base.hpp
++++ boost/smart_ptr/detail/sp_counted_base.hpp
+@@ -21,7 +21,7 @@
+ #include <boost/smart_ptr/detail/sp_has_sync.hpp>
+
+ #if defined( __clang__ ) && defined( __has_extension )
+-# if __has_extension( __c_atomic__ )
++# if __has_extension( __c_atomic__ ) && !defined _MSC_VER
+ # define BOOST_SP_HAS_CLANG_C11_ATOMICS
+ # endif
+ #endif
+
+# C:/lo64/core/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