external/boost: Adapt to clang-cl

Change-Id: Ib07e85bd1a157b6fa78f07a17f8cf5033b01bddf
This commit is contained in:
Stephan Bergmann 2015-11-12 18:17:51 +01:00
parent 5d201bc490
commit 9b421ef6de
3 changed files with 64 additions and 0 deletions

View File

@ -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))

View File

@ -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)))

42
external/boost/clang-cl.patch.0 vendored Normal file
View File

@ -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