[libcxx-commits] [libcxx] e48849a - [libcxx] [test] Suppress MSVC++ warning 4640 under /Zc:threadSafeInit-

Billy Robert O'Neal III via libcxx-commits libcxx-commits at lists.llvm.org
Sat Feb 22 06:57:47 PST 2020


Author: Billy Robert O'Neal III
Date: 2020-02-22T06:57:37-08:00
New Revision: e48849a2404128175df25168f961a83d6c0a901e

URL: https://github.com/llvm/llvm-project/commit/e48849a2404128175df25168f961a83d6c0a901e
DIFF: https://github.com/llvm/llvm-project/commit/e48849a2404128175df25168f961a83d6c0a901e.diff

LOG: [libcxx] [test] Suppress MSVC++ warning 4640 under /Zc:threadSafeInit-

Added: 
    

Modified: 
    libcxx/test/support/count_new.h
    libcxx/test/support/type_id.h

Removed: 
    


################################################################################
diff  --git a/libcxx/test/support/count_new.h b/libcxx/test/support/count_new.h
index 9313d028bb9a..ed7bd50be209 100644
--- a/libcxx/test/support/count_new.h
+++ b/libcxx/test/support/count_new.h
@@ -347,10 +347,17 @@ class MemCounter
   const bool MemCounter::disable_checking = false;
 #endif
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4640) // '%s' construction of local static object is not thread safe (/Zc:threadSafeInit-)
+#endif // _MSC_VER
 inline MemCounter* getGlobalMemCounter() {
   static MemCounter counter((MemCounter::MemCounterCtorArg_()));
   return &counter;
 }
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
 
 MemCounter &globalMemCounter = *getGlobalMemCounter();
 

diff  --git a/libcxx/test/support/type_id.h b/libcxx/test/support/type_id.h
index 6131d27c900a..0af7df280e44 100644
--- a/libcxx/test/support/type_id.h
+++ b/libcxx/test/support/type_id.h
@@ -49,11 +49,18 @@ struct TypeID {
 };
 
 // makeTypeID - Return the TypeID for the specified type 'T'.
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4640) // '%s' construction of local static object is not thread safe (/Zc:threadSafeInit-)
+#endif // _MSC_VER
 template <class T>
 inline TypeID const& makeTypeIDImp() {
   static const TypeID id(typeid(T).name());
   return id;
 }
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
 
 template <class T>
 struct TypeWrapper {};


        


More information about the libcxx-commits mailing list