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

Side by Side Diff: base/template_util.h

Issue 2612933003: Enable type_traits fallback for all < gcc 5.0 releases. (Closed)
Patch Set: adjust comment 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. Test for this by consulting compiler major version,
30 // the only reliable option available, so theoretically this could fail should
31 // you attempt to mix an earlier version of libstdc++ with >= GCC5. But
32 // that's unlikely to work out, especially as GCC5 changed ABI.
30 #define CR_GLIBCXX_5_0_0 20150123 33 #define CR_GLIBCXX_5_0_0 20150123
31 #if defined(__GLIBCXX__) && \ 34 #if (defined(__GNUC__) && __GNUC_ < 5) || \
danakj 2017/01/05 19:19:55 This should have two _s right? How is this working
sof 2017/01/05 19:25:18 ouch, good catch - it happens to work out as it ex
32 (__GLIBCXX__ == CR_GLIBCXX_4_8_4 || __GLIBCXX__ == CR_GLIBCXX_4_9_2 || \ 35 (defined(__GLIBCXX__) && __GLIBCXX__ == CR_GLIBCXX_5_0_0)
33 __GLIBCXX__ == CR_GLIBCXX_5_0_0)
34 #define CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX 36 #define CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX
35 #endif 37 #endif
36 38
37 // This hacks around using gcc with libc++ which has some incompatibilies. 39 // 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 40 // - 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 41 // 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 42 // of gcc, or the android ndk is updated to a newer libc++ that works with older
41 // gcc versions. 43 // gcc versions.
42 #if !defined(__clang__) && defined(_LIBCPP_VERSION) 44 #if !defined(__clang__) && defined(_LIBCPP_VERSION)
43 #define CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX 45 #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>; 191 using is_trivially_copyable = std::is_trivially_copyable<T>;
190 #endif 192 #endif
191 193
192 } // namespace base 194 } // namespace base
193 195
194 #undef CR_USE_FALLBACKS_FOR_OLD_GLIBCXX 196 #undef CR_USE_FALLBACKS_FOR_OLD_GLIBCXX
195 #undef CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX 197 #undef CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX
196 #undef CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX 198 #undef CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX
197 199
198 #endif // BASE_TEMPLATE_UTIL_H_ 200 #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