1From eef1d2c332be60e4455cbb6e7710ee3c0f8d6f31 Mon Sep 17 00:00:00 2001 2From: Andrew Hsieh <andrewhsieh@google.com> 3Date: Mon, 2 Jun 2014 18:01:55 +0800 4Subject: [PATCH 12/12] Relax some __always_inline__ for GCC 4.9 5 6To workaround GCC 4.9 which fails to __always_inline__ some functions 7--- 8 include/__config | 12 +++++++++++- 9 include/locale | 2 +- 10 include/string | 20 ++++++++++---------- 11 3 files changed, 22 insertions(+), 12 deletions(-) 12 13diff --git a/include/__config b/include/__config 14index df84ac6..0f443a9 100644 15--- a/include/__config 16+++ b/include/__config 17@@ -191,6 +191,7 @@ 18 19 #ifndef _LIBCPP_INLINE_VISIBILITY 20 #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) 21+#define _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 _LIBCPP_INLINE_VISIBILITY 22 #endif 23 24 #ifndef _LIBCPP_EXCEPTION_ABI 25@@ -199,6 +200,7 @@ 26 27 #ifndef _LIBCPP_ALWAYS_INLINE 28 #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__)) 29+#define _LIBCPP_ALWAYS_INLINE_EXCEPT_GCC49 _LIBCPP_ALWAYS_INLINE 30 #endif 31 32 #if defined(__clang__) 33@@ -358,6 +360,14 @@ namespace std { 34 35 #elif defined(__GNUC__) 36 37+// FixME: GCC4.9 fails some always_inline cases 38+# if (_GNUC_VER == 409) 39+#undef _LIBCPP_ALWAYS_INLINE_EXCEPT_GCC49 40+#define _LIBCPP_ALWAYS_INLINE_EXCEPT_GCC49 inline 41+#undef _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 42+#define _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 43+#endif 44+ 45 #define _ALIGNAS(x) __attribute__((__aligned__(x))) 46 #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) 47 48@@ -454,7 +464,7 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__)); 49 #define __gxx__cxx_lambdas !defined(_LIBCPP_HAS_NO_LAMBDAS) 50 #define __gxx__cxx_noexcept 0 // Not sure, doesn't matter. 51 #define __gxx__cxx_nullptr !defined(_LIBCPP_HAS_NO_NULLPTR) 52-#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 53+#define __gxx__cxx_reference_qualified_functions (_GNUC_VER >= 408) // Since 4.8.1 54 #ifdef _LIBCPP_NO_RTTI 55 #define __gxx__cxx_rtti 0 56 #else 57diff --git a/include/locale b/include/locale 58index 7191290..60c6182 100644 59--- a/include/locale 60+++ b/include/locale 61@@ -2799,7 +2799,7 @@ public: 62 explicit moneypunct_byname(const char* __nm, size_t __refs = 0) 63 : moneypunct<_CharT, _International>(__refs) {init(__nm);} 64 65- _LIBCPP_ALWAYS_INLINE 66+ _LIBCPP_ALWAYS_INLINE_EXCEPT_GCC49 67 explicit moneypunct_byname(const string& __nm, size_t __refs = 0) 68 : moneypunct<_CharT, _International>(__refs) {init(__nm.c_str());} 69 70diff --git a/include/string b/include/string 71index bb8f111..ba83e22 100644 72--- a/include/string 73+++ b/include/string 74@@ -1368,26 +1368,26 @@ private: 75 public: 76 static const size_type npos = -1; 77 78- _LIBCPP_INLINE_VISIBILITY basic_string() 79+ _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 basic_string() 80 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value); 81- _LIBCPP_INLINE_VISIBILITY explicit basic_string(const allocator_type& __a); 82+ _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 explicit basic_string(const allocator_type& __a); 83 basic_string(const basic_string& __str); 84 basic_string(const basic_string& __str, const allocator_type& __a); 85 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 86- _LIBCPP_INLINE_VISIBILITY 87+ _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 88 basic_string(basic_string&& __str) 89 _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); 90 _LIBCPP_INLINE_VISIBILITY 91 basic_string(basic_string&& __str, const allocator_type& __a); 92 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 93- _LIBCPP_INLINE_VISIBILITY basic_string(const value_type* __s); 94+ _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 basic_string(const value_type* __s); 95 _LIBCPP_INLINE_VISIBILITY 96 basic_string(const value_type* __s, const allocator_type& __a); 97 _LIBCPP_INLINE_VISIBILITY 98 basic_string(const value_type* __s, size_type __n); 99 _LIBCPP_INLINE_VISIBILITY 100 basic_string(const value_type* __s, size_type __n, const allocator_type& __a); 101- _LIBCPP_INLINE_VISIBILITY 102+ _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 103 basic_string(size_type __n, value_type __c); 104 _LIBCPP_INLINE_VISIBILITY 105 basic_string(size_type __n, value_type __c, const allocator_type& __a); 106@@ -1972,7 +1972,7 @@ basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type 107 } 108 109 template <class _CharT, class _Traits, class _Allocator> 110-inline _LIBCPP_INLINE_VISIBILITY 111+inline _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 112 basic_string<_CharT, _Traits, _Allocator>::basic_string() 113 _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) 114 { 115@@ -1983,7 +1983,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string() 116 } 117 118 template <class _CharT, class _Traits, class _Allocator> 119-inline _LIBCPP_INLINE_VISIBILITY 120+inline _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 121 basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __a) 122 : __r_(__a) 123 { 124@@ -2042,7 +2042,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty 125 } 126 127 template <class _CharT, class _Traits, class _Allocator> 128-inline _LIBCPP_INLINE_VISIBILITY 129+inline _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 130 basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s) 131 { 132 _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr"); 133@@ -2116,7 +2116,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st 134 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 135 136 template <class _CharT, class _Traits, class _Allocator> 137-inline _LIBCPP_INLINE_VISIBILITY 138+inline _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 139 basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str) 140 _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) 141 : __r_(_VSTD::move(__str.__r_)) 142@@ -2173,7 +2173,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c) 143 } 144 145 template <class _CharT, class _Traits, class _Allocator> 146-inline _LIBCPP_INLINE_VISIBILITY 147+inline _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 148 basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, value_type __c) 149 { 150 __init(__n, __c); 151-- 1521.9.1.423.g4596e3a 153 154