Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_TEMPLATE_UTIL_H_ | 5 #ifndef BASE_TEMPLATE_UTIL_H_ |
| 6 #define BASE_TEMPLATE_UTIL_H_ | 6 #define BASE_TEMPLATE_UTIL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <iosfwd> | 9 #include <iosfwd> |
| 10 #include <type_traits> | 10 #include <type_traits> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 | 14 |
| 15 // This hacks around libstdc++ 4.6 missing stuff in type_traits, while we need | 15 // This hacks around libstdc++ 4.6 missing stuff in type_traits, while we need |
| 16 // to support it. | 16 // to support it. |
| 17 #define CR_GLIBCXX_4_7_0 20120322 | 17 #define CR_GLIBCXX_4_7_0 20120322 |
| 18 #define CR_GLIBCXX_4_5_4 20120702 | 18 #define CR_GLIBCXX_4_5_4 20120702 |
| 19 #define CR_GLIBCXX_4_6_4 20121127 | 19 #define CR_GLIBCXX_4_6_4 20121127 |
| 20 #if defined(__GLIBCXX__) && \ | 20 #if defined(__GLIBCXX__) && \ |
| 21 (__GLIBCXX__ < CR_GLIBCXX_4_7_0 || __GLIBCXX__ == CR_GLIBCXX_4_5_4 || \ | 21 (__GLIBCXX__ < CR_GLIBCXX_4_7_0 || __GLIBCXX__ == CR_GLIBCXX_4_5_4 || \ |
| 22 __GLIBCXX__ == CR_GLIBCXX_4_6_4) | 22 __GLIBCXX__ == CR_GLIBCXX_4_6_4) |
| 23 #define CR_USE_FALLBACKS_FOR_OLD_GLIBCXX | 23 #define CR_USE_FALLBACKS_FOR_OLD_GLIBCXX |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 // Some versions of libstdc++ have partial support for type_traits, but misses | 26 // Some versions of libstdc++ have partial support for type_traits, but misses |
| 27 // a smaller subset while removing some of the older non-standard stuff. | 27 // a smaller subset while removing some of the older non-standard stuff. Assume |
| 28 #define CR_GLIBCXX_4_8_4 20141219 | 28 // that all versions below 5.0 fall in this category, along with one 5.0 |
| 29 #define CR_GLIBCXX_4_9_2 20150426 | 29 // experimental release. |
| 30 #define CR_GLIBCXX_5_0_0 20150123 | 30 #define CR_GLIBCXX_5_0_0 20150123 |
| 31 #if defined(__GLIBCXX__) && \ | 31 #if _GNUC_VER < 500 || (defined(__GLIBCXX__) && __GLIBCXX__ == CR_GLIBCXX_5_0_0) |
|
Mostyn Bramley-Moore
2017/01/05 10:53:54
Where is _GNUC_VER defined? It doesn't appear to
sof
2017/01/05 10:57:38
It's used below in this file, so I assume it is we
Mostyn Bramley-Moore
2017/01/05 12:26:32
It looks like _GNUC_VER is a libcxx macro, and sin
sof
2017/01/05 12:35:28
It's been subsequently updated to only rely on __G
| |
| 32 (__GLIBCXX__ == CR_GLIBCXX_4_8_4 || __GLIBCXX__ == CR_GLIBCXX_4_9_2 || \ | |
| 33 __GLIBCXX__ == CR_GLIBCXX_5_0_0) | |
| 34 #define CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX | 32 #define CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX |
| 35 #endif | 33 #endif |
| 36 | 34 |
| 37 // This hacks around using gcc with libc++ which has some incompatibilies. | 35 // This hacks around using gcc with libc++ which has some incompatibilies. |
| 38 // - is_trivially_* doesn't work: https://llvm.org/bugs/show_bug.cgi?id=27538 | 36 // - is_trivially_* doesn't work: https://llvm.org/bugs/show_bug.cgi?id=27538 |
| 39 // TODO(danakj): Remove this when android builders are all using a newer version | 37 // TODO(danakj): Remove this when android builders are all using a newer version |
| 40 // of gcc, or the android ndk is updated to a newer libc++ that works with older | 38 // of gcc, or the android ndk is updated to a newer libc++ that works with older |
| 41 // gcc versions. | 39 // gcc versions. |
| 42 #if !defined(__clang__) && defined(_LIBCPP_VERSION) | 40 #if !defined(__clang__) && defined(_LIBCPP_VERSION) |
| 43 #define CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX | 41 #define CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 using is_trivially_copyable = std::is_trivially_copyable<T>; | 187 using is_trivially_copyable = std::is_trivially_copyable<T>; |
| 190 #endif | 188 #endif |
| 191 | 189 |
| 192 } // namespace base | 190 } // namespace base |
| 193 | 191 |
| 194 #undef CR_USE_FALLBACKS_FOR_OLD_GLIBCXX | 192 #undef CR_USE_FALLBACKS_FOR_OLD_GLIBCXX |
| 195 #undef CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX | 193 #undef CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX |
| 196 #undef CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX | 194 #undef CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX |
| 197 | 195 |
| 198 #endif // BASE_TEMPLATE_UTIL_H_ | 196 #endif // BASE_TEMPLATE_UTIL_H_ |
| OLD | NEW |