mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-14 01:32:07 +08:00
Merge pull request #330 from PMExtra/master
Use the feature checking macros to detect thread_local support in clang.
This commit is contained in:
commit
af35f9c086
@ -50,6 +50,10 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __has_feature // Clang - feature checking macros.
|
||||||
|
#define __has_feature(x) 0 // Compatibility with non-clang compilers.
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace spdlog
|
namespace spdlog
|
||||||
{
|
{
|
||||||
namespace details
|
namespace details
|
||||||
@ -317,7 +321,7 @@ inline size_t _thread_id()
|
|||||||
//Return current thread id as size_t (from thread local storage)
|
//Return current thread id as size_t (from thread local storage)
|
||||||
inline size_t thread_id()
|
inline size_t thread_id()
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1900) || defined(__clang_major__) && (__clang_major__ < 8)
|
#if defined(_MSC_VER) && (_MSC_VER < 1900) || defined(__clang__) && !__has_feature(cxx_thread_local)
|
||||||
return _thread_id();
|
return _thread_id();
|
||||||
#else
|
#else
|
||||||
static thread_local const size_t tid = _thread_id();
|
static thread_local const size_t tid = _thread_id();
|
||||||
|
Loading…
Reference in New Issue
Block a user