diff options
Diffstat (limited to 'contrib/llvm/lib/Support/ThreadLocal.cpp')
| -rw-r--r-- | contrib/llvm/lib/Support/ThreadLocal.cpp | 9 | 
1 files changed, 5 insertions, 4 deletions
| diff --git a/contrib/llvm/lib/Support/ThreadLocal.cpp b/contrib/llvm/lib/Support/ThreadLocal.cpp index 868b6ea566a9..2dec9eb417f5 100644 --- a/contrib/llvm/lib/Support/ThreadLocal.cpp +++ b/contrib/llvm/lib/Support/ThreadLocal.cpp @@ -12,6 +12,7 @@  //===----------------------------------------------------------------------===//  #include "llvm/Config/config.h" +#include "llvm/Support/Compiler.h"  #include "llvm/Support/ThreadLocal.h"  //===----------------------------------------------------------------------===// @@ -26,7 +27,7 @@ using namespace sys;  ThreadLocalImpl::ThreadLocalImpl() : data() { }  ThreadLocalImpl::~ThreadLocalImpl() { }  void ThreadLocalImpl::setInstance(const void* d) { -  typedef int SIZE_TOO_BIG[sizeof(d) <= sizeof(data) ? 1 : -1]; +  static_assert(sizeof(d) <= sizeof(data), "size too big");    void **pd = reinterpret_cast<void**>(&data);    *pd = const_cast<void*>(d);  } @@ -50,9 +51,9 @@ namespace llvm {  using namespace sys;  ThreadLocalImpl::ThreadLocalImpl() : data() { -  typedef int SIZE_TOO_BIG[sizeof(pthread_key_t) <= sizeof(data) ? 1 : -1]; +  static_assert(sizeof(pthread_key_t) <= sizeof(data), "size too big");    pthread_key_t* key = reinterpret_cast<pthread_key_t*>(&data); -  int errorcode = pthread_key_create(key, NULL); +  int errorcode = pthread_key_create(key, nullptr);    assert(errorcode == 0);    (void) errorcode;  } @@ -77,7 +78,7 @@ const void* ThreadLocalImpl::getInstance() {  }  void ThreadLocalImpl::removeInstance() { -  setInstance(0); +  setInstance(nullptr);  }  } | 
