| From eef1d2c332be60e4455cbb6e7710ee3c0f8d6f31 Mon Sep 17 00:00:00 2001 |
| From: Andrew Hsieh <andrewhsieh@google.com> |
| Date: Mon, 2 Jun 2014 18:01:55 +0800 |
| Subject: [PATCH 12/12] Relax some __always_inline__ for GCC 4.9 |
| |
| To workaround GCC 4.9 which fails to __always_inline__ some functions |
| --- |
| include/__config | 12 +++++++++++- |
| include/locale | 2 +- |
| include/string | 20 ++++++++++---------- |
| 3 files changed, 22 insertions(+), 12 deletions(-) |
| |
| diff --git a/include/__config b/include/__config |
| index df84ac6..0f443a9 100644 |
| --- a/include/__config |
| +++ b/include/__config |
| @@ -191,6 +191,7 @@ |
| |
| #ifndef _LIBCPP_INLINE_VISIBILITY |
| #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) |
| +#define _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 _LIBCPP_INLINE_VISIBILITY |
| #endif |
| |
| #ifndef _LIBCPP_EXCEPTION_ABI |
| @@ -199,6 +200,7 @@ |
| |
| #ifndef _LIBCPP_ALWAYS_INLINE |
| #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__)) |
| +#define _LIBCPP_ALWAYS_INLINE_EXCEPT_GCC49 _LIBCPP_ALWAYS_INLINE |
| #endif |
| |
| #if defined(__clang__) |
| @@ -358,6 +360,14 @@ namespace std { |
| |
| #elif defined(__GNUC__) |
| |
| +// FixME: GCC4.9 fails some always_inline cases |
| +# if (_GNUC_VER == 409) |
| +#undef _LIBCPP_ALWAYS_INLINE_EXCEPT_GCC49 |
| +#define _LIBCPP_ALWAYS_INLINE_EXCEPT_GCC49 inline |
| +#undef _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 |
| +#define _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 |
| +#endif |
| + |
| #define _ALIGNAS(x) __attribute__((__aligned__(x))) |
| #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) |
| |
| @@ -454,7 +464,7 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__)); |
| #define __gxx__cxx_lambdas !defined(_LIBCPP_HAS_NO_LAMBDAS) |
| #define __gxx__cxx_noexcept 0 // Not sure, doesn't matter. |
| #define __gxx__cxx_nullptr !defined(_LIBCPP_HAS_NO_NULLPTR) |
| -#define __gxx__cxx_reference_qualified_functions (_GNUC_VER >= 408) // Not if 4.7 work. 4.6 certainly not. Also see usage in libcxx/include/type_traits |
| +#define __gxx__cxx_reference_qualified_functions (_GNUC_VER >= 408) // Since 4.8.1 |
| #ifdef _LIBCPP_NO_RTTI |
| #define __gxx__cxx_rtti 0 |
| #else |
| diff --git a/include/locale b/include/locale |
| index 7191290..60c6182 100644 |
| --- a/include/locale |
| +++ b/include/locale |
| @@ -2799,7 +2799,7 @@ public: |
| explicit moneypunct_byname(const char* __nm, size_t __refs = 0) |
| : moneypunct<_CharT, _International>(__refs) {init(__nm);} |
| |
| - _LIBCPP_ALWAYS_INLINE |
| + _LIBCPP_ALWAYS_INLINE_EXCEPT_GCC49 |
| explicit moneypunct_byname(const string& __nm, size_t __refs = 0) |
| : moneypunct<_CharT, _International>(__refs) {init(__nm.c_str());} |
| |
| diff --git a/include/string b/include/string |
| index bb8f111..ba83e22 100644 |
| --- a/include/string |
| +++ b/include/string |
| @@ -1368,26 +1368,26 @@ private: |
| public: |
| static const size_type npos = -1; |
| |
| - _LIBCPP_INLINE_VISIBILITY basic_string() |
| + _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 basic_string() |
| _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value); |
| - _LIBCPP_INLINE_VISIBILITY explicit basic_string(const allocator_type& __a); |
| + _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 explicit basic_string(const allocator_type& __a); |
| basic_string(const basic_string& __str); |
| basic_string(const basic_string& __str, const allocator_type& __a); |
| #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
| - _LIBCPP_INLINE_VISIBILITY |
| + _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 |
| basic_string(basic_string&& __str) |
| _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); |
| _LIBCPP_INLINE_VISIBILITY |
| basic_string(basic_string&& __str, const allocator_type& __a); |
| #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
| - _LIBCPP_INLINE_VISIBILITY basic_string(const value_type* __s); |
| + _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 basic_string(const value_type* __s); |
| _LIBCPP_INLINE_VISIBILITY |
| basic_string(const value_type* __s, const allocator_type& __a); |
| _LIBCPP_INLINE_VISIBILITY |
| basic_string(const value_type* __s, size_type __n); |
| _LIBCPP_INLINE_VISIBILITY |
| basic_string(const value_type* __s, size_type __n, const allocator_type& __a); |
| - _LIBCPP_INLINE_VISIBILITY |
| + _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 |
| basic_string(size_type __n, value_type __c); |
| _LIBCPP_INLINE_VISIBILITY |
| basic_string(size_type __n, value_type __c, const allocator_type& __a); |
| @@ -1972,7 +1972,7 @@ basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type |
| } |
| |
| template <class _CharT, class _Traits, class _Allocator> |
| -inline _LIBCPP_INLINE_VISIBILITY |
| +inline _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 |
| basic_string<_CharT, _Traits, _Allocator>::basic_string() |
| _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) |
| { |
| @@ -1983,7 +1983,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string() |
| } |
| |
| template <class _CharT, class _Traits, class _Allocator> |
| -inline _LIBCPP_INLINE_VISIBILITY |
| +inline _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 |
| basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __a) |
| : __r_(__a) |
| { |
| @@ -2042,7 +2042,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty |
| } |
| |
| template <class _CharT, class _Traits, class _Allocator> |
| -inline _LIBCPP_INLINE_VISIBILITY |
| +inline _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 |
| basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s) |
| { |
| _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr"); |
| @@ -2116,7 +2116,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st |
| #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
| |
| template <class _CharT, class _Traits, class _Allocator> |
| -inline _LIBCPP_INLINE_VISIBILITY |
| +inline _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 |
| basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str) |
| _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) |
| : __r_(_VSTD::move(__str.__r_)) |
| @@ -2173,7 +2173,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c) |
| } |
| |
| template <class _CharT, class _Traits, class _Allocator> |
| -inline _LIBCPP_INLINE_VISIBILITY |
| +inline _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 |
| basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, value_type __c) |
| { |
| __init(__n, __c); |
| -- |
| 1.9.1.423.g4596e3a |
| |