Explorar o código

Get the unittests compiling when building with cmake and the setting
-DLLVM_ENABLE_THREADS=false.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181788 91177308-0d34-0410-b5e6-96231b3b80d8

Duncan Sands %!s(int64=12) %!d(string=hai) anos
pai
achega
8305acb200
Modificáronse 2 ficheiros con 6 adicións e 1 borrados
  1. 2 1
      unittests/Support/ManagedStatic.cpp
  2. 4 0
      utils/unittest/CMakeLists.txt

+ 2 - 1
unittests/Support/ManagedStatic.cpp

@@ -19,7 +19,8 @@ using namespace llvm;
 
 
 namespace {
 namespace {
 
 
-#if defined(HAVE_PTHREAD_H) && !__has_feature(memory_sanitizer)
+#if LLVM_ENABLE_THREADS != 0 && defined(HAVE_PTHREAD_H) && \
+  !__has_feature(memory_sanitizer)
 namespace test1 {
 namespace test1 {
   llvm::ManagedStatic<int> ms;
   llvm::ManagedStatic<int> ms;
   void *helper(void*) {
   void *helper(void*) {

+ 4 - 0
utils/unittest/CMakeLists.txt

@@ -27,6 +27,10 @@ endif()
 set(LLVM_REQUIRES_RTTI 1)
 set(LLVM_REQUIRES_RTTI 1)
 add_definitions( -DGTEST_HAS_RTTI=0 )
 add_definitions( -DGTEST_HAS_RTTI=0 )
 
 
+if (NOT LLVM_ENABLE_THREADS)
+  add_definitions( -DGTEST_HAS_PTHREAD=0 )
+endif()
+
 # Visual Studio 2012 only supports up to 8 template parameters in
 # Visual Studio 2012 only supports up to 8 template parameters in
 # std::tr1::tuple by default, but gtest requires 10
 # std::tr1::tuple by default, but gtest requires 10
 if(MSVC AND MSVC_VERSION EQUAL 1700)
 if(MSVC AND MSVC_VERSION EQUAL 1700)