[libcxx] Enable noexcept for GCC 4.6 and greater

Summary:
This patch allows GCC 4.6 and above to use `noexcept` as opposed to `throw()`. 

Is it an ABI safe change to suddenly switch on `noexcept`? I imagine it must be because it's disabled in w/ clang in C++03 but not C++11.


Reviewers: danalbert, jroelofs, mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D15516

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@255683 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier 2015-12-15 22:16:47 +00:00
parent 6ba21565bd
commit a3d6b126d2

View File

@ -401,14 +401,8 @@ typedef __char32_t char32_t;
#endif // __linux__ #endif // __linux__
#endif #endif
#if (__has_feature(cxx_noexcept)) #if !(__has_feature(cxx_noexcept))
# define _NOEXCEPT noexcept #define _LIBCPP_HAS_NO_NOEXCEPT
# define _NOEXCEPT_(x) noexcept(x)
# define _NOEXCEPT_OR_FALSE(x) noexcept(x)
#else
# define _NOEXCEPT throw()
# define _NOEXCEPT_(x)
# define _NOEXCEPT_OR_FALSE(x) false
#endif #endif
#if __has_feature(underlying_type) #if __has_feature(underlying_type)
@ -476,10 +470,6 @@ namespace std {
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
#endif #endif
#define _NOEXCEPT throw()
#define _NOEXCEPT_(x)
#define _NOEXCEPT_OR_FALSE(x) false
#ifndef __GXX_EXPERIMENTAL_CXX0X__ #ifndef __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
@ -493,6 +483,7 @@ namespace std {
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS #define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#define _LIBCPP_HAS_NO_STRONG_ENUMS #define _LIBCPP_HAS_NO_STRONG_ENUMS
#define _LIBCPP_HAS_NO_NOEXCEPT
#else // __GXX_EXPERIMENTAL_CXX0X__ #else // __GXX_EXPERIMENTAL_CXX0X__
@ -516,6 +507,7 @@ namespace std {
#endif // _GNUC_VER < 404 #endif // _GNUC_VER < 404
#if _GNUC_VER < 406 #if _GNUC_VER < 406
#define _LIBCPP_HAS_NO_NOEXCEPT
#define _LIBCPP_HAS_NO_NULLPTR #define _LIBCPP_HAS_NO_NULLPTR
#endif #endif
@ -549,15 +541,14 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
#define _LIBCPP_HAS_NO_UNICODE_CHARS #define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define _LIBCPP_HAS_NO_NOEXCEPT
#define __alignof__ __alignof #define __alignof__ __alignof
#define _LIBCPP_NORETURN __declspec(noreturn) #define _LIBCPP_NORETURN __declspec(noreturn)
#define _LIBCPP_UNUSED #define _LIBCPP_UNUSED
#define _ALIGNAS(x) __declspec(align(x)) #define _ALIGNAS(x) __declspec(align(x))
#define _LIBCPP_HAS_NO_VARIADICS #define _LIBCPP_HAS_NO_VARIADICS
#define _NOEXCEPT throw ()
#define _NOEXCEPT_(x)
#define _NOEXCEPT_OR_FALSE(x) false
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
#define _LIBCPP_END_NAMESPACE_STD } #define _LIBCPP_END_NAMESPACE_STD }
@ -577,14 +568,11 @@ namespace std {
#define _LIBCPP_NORETURN __attribute__((noreturn)) #define _LIBCPP_NORETURN __attribute__((noreturn))
#define _LIBCPP_UNUSED #define _LIBCPP_UNUSED
#define _NOEXCEPT throw()
#define _NOEXCEPT_(x)
#define _NOEXCEPT_OR_FALSE(x) false
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS #define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#define _LIBCPP_HAS_NO_NOEXCEPT
#define _LIBCPP_HAS_NO_NULLPTR #define _LIBCPP_HAS_NO_NULLPTR
#define _LIBCPP_HAS_NO_UNICODE_CHARS #define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_IS_BASE_OF #define _LIBCPP_HAS_IS_BASE_OF
@ -608,6 +596,14 @@ namespace std {
#endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__ #endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
#ifndef _LIBCPP_HAS_NO_NOEXCEPT
# define _NOEXCEPT noexcept
# define _NOEXCEPT_(x) noexcept(x)
#else
# define _NOEXCEPT throw()
# define _NOEXCEPT_(x)
#endif
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef unsigned short char16_t; typedef unsigned short char16_t;
typedef unsigned int char32_t; typedef unsigned int char32_t;