Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: base/template_util.h

Issue 2612933003: Enable type_traits fallback for all < gcc 5.0 releases. (Closed)
Patch Set: only need __GNUC__ Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 (defined(__GNUC__) && __GNUC_ < 5) || \
danakj 2017/01/05 16:30:15 I agree that it's odd to check the compiler versio
sof 2017/01/05 18:59:44 ok, tried to do so. ABI skew is one reason why it
32 (__GLIBCXX__ == CR_GLIBCXX_4_8_4 || __GLIBCXX__ == CR_GLIBCXX_4_9_2 || \ 32 (defined(__GLIBCXX__) && __GLIBCXX__ == CR_GLIBCXX_5_0_0)
33 __GLIBCXX__ == CR_GLIBCXX_5_0_0)
34 #define CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX 33 #define CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX
35 #endif 34 #endif
36 35
37 // This hacks around using gcc with libc++ which has some incompatibilies. 36 // 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 37 // - 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 38 // 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 39 // of gcc, or the android ndk is updated to a newer libc++ that works with older
41 // gcc versions. 40 // gcc versions.
42 #if !defined(__clang__) && defined(_LIBCPP_VERSION) 41 #if !defined(__clang__) && defined(_LIBCPP_VERSION)
43 #define CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX 42 #define CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 using is_trivially_copyable = std::is_trivially_copyable<T>; 188 using is_trivially_copyable = std::is_trivially_copyable<T>;
190 #endif 189 #endif
191 190
192 } // namespace base 191 } // namespace base
193 192
194 #undef CR_USE_FALLBACKS_FOR_OLD_GLIBCXX 193 #undef CR_USE_FALLBACKS_FOR_OLD_GLIBCXX
195 #undef CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX 194 #undef CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX
196 #undef CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX 195 #undef CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX
197 196
198 #endif // BASE_TEMPLATE_UTIL_H_ 197 #endif // BASE_TEMPLATE_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698