From 789b7f0828b08f5c4bf9ff1ff7ef733c73ecdc0a Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Thu, 30 May 2019 04:40:21 +0000 Subject: [runtimes] Check if pragma comment(lib, ...) is supported first This fixes the issue introduced by r362048 where we always use pragma comment(lib, ...) for dependent libraries when the compiler is Clang, but older Clang versions don't support this pragma so we need to check first if it's supported before using it. llvm-svn: 362055 --- libcxx/src/algorithm.cpp | 2 +- libcxx/src/chrono.cpp | 2 +- libcxx/src/debug.cpp | 2 +- libcxx/src/experimental/memory_resource.cpp | 2 +- libcxx/src/filesystem/operations.cpp | 2 +- libcxx/src/mutex.cpp | 2 +- libcxx/src/shared_mutex.cpp | 2 +- libcxx/src/thread.cpp | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) (limited to 'libcxx/src') diff --git a/libcxx/src/algorithm.cpp b/libcxx/src/algorithm.cpp index 5ce2a23b464..a110ae8b1a6 100644 --- a/libcxx/src/algorithm.cpp +++ b/libcxx/src/algorithm.cpp @@ -10,7 +10,7 @@ #include "random" #ifndef _LIBCPP_HAS_NO_THREADS #include "mutex" -#if defined(__unix__) && defined(__ELF__) && defined(__clang__) +#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA) #pragma comment(lib, "pthread") #endif #endif diff --git a/libcxx/src/chrono.cpp b/libcxx/src/chrono.cpp index a2f88c94c07..8f533f1059e 100644 --- a/libcxx/src/chrono.cpp +++ b/libcxx/src/chrono.cpp @@ -37,7 +37,7 @@ #endif #endif -#if defined(__unix__) && defined(__ELF__) && defined(__clang__) +#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA) #pragma comment(lib, "rt") #endif diff --git a/libcxx/src/debug.cpp b/libcxx/src/debug.cpp index 95024131011..c4cc281d586 100644 --- a/libcxx/src/debug.cpp +++ b/libcxx/src/debug.cpp @@ -15,7 +15,7 @@ #include "__hash_table" #ifndef _LIBCPP_HAS_NO_THREADS #include "mutex" -#if defined(__unix__) && defined(__ELF__) && defined(__clang__) +#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA) #pragma comment(lib, "pthread") #endif #endif diff --git a/libcxx/src/experimental/memory_resource.cpp b/libcxx/src/experimental/memory_resource.cpp index 84c95080496..9aa077942b0 100644 --- a/libcxx/src/experimental/memory_resource.cpp +++ b/libcxx/src/experimental/memory_resource.cpp @@ -12,7 +12,7 @@ #include "atomic" #elif !defined(_LIBCPP_HAS_NO_THREADS) #include "mutex" -#if defined(__unix__) && defined(__ELF__) && defined(__clang__) +#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA) #pragma comment(lib, "pthread") #endif #endif diff --git a/libcxx/src/filesystem/operations.cpp b/libcxx/src/filesystem/operations.cpp index 319d9f65d73..69350ddfe9d 100644 --- a/libcxx/src/filesystem/operations.cpp +++ b/libcxx/src/filesystem/operations.cpp @@ -44,7 +44,7 @@ #include // for gettimeofday and timeval #endif // !defined(CLOCK_REALTIME) -#if defined(__unix__) && defined(__ELF__) && defined(__clang__) +#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA) #pragma comment(lib, "rt") #endif diff --git a/libcxx/src/mutex.cpp b/libcxx/src/mutex.cpp index d100f2df233..33a8197dadf 100644 --- a/libcxx/src/mutex.cpp +++ b/libcxx/src/mutex.cpp @@ -13,7 +13,7 @@ #include "__undef_macros" #ifndef _LIBCPP_HAS_NO_THREADS -#if defined(__unix__) && defined(__ELF__) && defined(__clang__) +#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA) #pragma comment(lib, "pthread") #endif #endif diff --git a/libcxx/src/shared_mutex.cpp b/libcxx/src/shared_mutex.cpp index 3f1aecfdfe1..eb3f5f3506f 100644 --- a/libcxx/src/shared_mutex.cpp +++ b/libcxx/src/shared_mutex.cpp @@ -10,7 +10,7 @@ #ifndef _LIBCPP_HAS_NO_THREADS #include "shared_mutex" -#if defined(__unix__) && defined(__ELF__) && defined(__clang__) +#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA) #pragma comment(lib, "pthread") #endif diff --git a/libcxx/src/thread.cpp b/libcxx/src/thread.cpp index 92690f66798..39bb9e9bac6 100644 --- a/libcxx/src/thread.cpp +++ b/libcxx/src/thread.cpp @@ -35,7 +35,7 @@ #include #endif -#if defined(__unix__) && defined(__ELF__) && defined(__clang__) +#if defined(__unix__) && defined(__ELF__) && defined(_LIBCPP_HAS_COMMENT_LIB_PRAGMA) #pragma comment(lib, "pthread") #endif -- cgit v1.2.3