[libc++] Use __extension__ in a portable manner
authorLouis Dionne <ldionne@apple.com>
Wed, 4 Sep 2019 12:44:19 +0000 (12:44 +0000)
committerLouis Dionne <ldionne@apple.com>
Wed, 4 Sep 2019 12:44:19 +0000 (12:44 +0000)
llvm-svn: 370889

libcxx/include/__config
libcxx/include/atomic

index 0d9d723..03725e2 100644 (file)
@@ -485,6 +485,8 @@ typedef __char32_t char32_t;
 #define _LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS
 #endif
 
+#define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
+
 #elif defined(_LIBCPP_COMPILER_GCC)
 
 #define _ALIGNAS(x) __attribute__((__aligned__(x)))
@@ -520,6 +522,8 @@ typedef __char32_t char32_t;
 
 #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
 
+#define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
+
 #elif defined(_LIBCPP_COMPILER_MSVC)
 
 #define _LIBCPP_TOSTRING2(x) #x
@@ -545,6 +549,8 @@ typedef __char32_t char32_t;
 
 #define _LIBCPP_HAS_NO_VECTOR_EXTENSION
 
+#define _LIBCPP_DISABLE_EXTENSION_WARNING
+
 #elif defined(_LIBCPP_COMPILER_IBM)
 
 #define _ALIGNAS(x) __attribute__((__aligned__(x)))
@@ -565,6 +571,8 @@ typedef __char32_t char32_t;
 
 #define _LIBCPP_HAS_NO_VECTOR_EXTENSION
 
+#define _LIBCPP_DISABLE_EXTENSION_WARNING
+
 #endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]
 
 #if defined(_LIBCPP_OBJECT_FORMAT_COFF)
index 0118ab5..6904dd4 100644 (file)
@@ -920,7 +920,7 @@ struct __cxx_atomic_base_impl {
 #endif // _LIBCPP_CXX03_LANG
   _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT
     : __a_value(value) {}
-  __extension__ _Atomic(_Tp) __a_value;
+  _LIBCPP_DISABLE_EXTENSION_WARNING _Atomic(_Tp) __a_value;
 };
 
 #define __cxx_atomic_is_lock_free(__s) __c11_atomic_is_lock_free(__s)