OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at |
| 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. |
| 14 |
| 15 #ifndef CRASHPAD_UTIL_STDLIB_CXX_H_ |
| 16 #define CRASHPAD_UTIL_STDLIB_CXX_H_ |
| 17 |
| 18 // <ciso646> doesn’t do very much, and under libc++, it will cause the |
| 19 // _LIBCPP_VERSION macro to be defined properly. Under libstdc++, it doesn’t |
| 20 // cause __GLIBCXX__ to be defined, but if _LIBCPP_VERSION isn’t defined after |
| 21 // #including <ciso646>, assume libstdc++ and #include libstdc++’s internal |
| 22 // header that defines __GLIBCXX__. |
| 23 |
| 24 #include <ciso646> |
| 25 |
| 26 #if !defined(_LIBCPP_VERSION) |
| 27 #if defined(__has_include) |
| 28 #if __has_include(<bits/c++config.h>) |
| 29 #include <bits/c++config.h> |
| 30 #endif |
| 31 #else |
| 32 #include <bits/c++config.h> |
| 33 #endif |
| 34 #endif |
| 35 |
| 36 // libstdc++ does not identify its version directly, but identifies the GCC |
| 37 // package it is a part of via the __GLIBCXX__ macro, which is based on the date |
| 38 // of the GCC release. libstdc++ had sufficient C++11 support as of GCC 4.6.0, |
| 39 // __GLIBCXX__ 20110325, but maintenance releases in the 4.4 an 4.5 series |
| 40 // followed this date, so check for those versions by their date stamps. |
| 41 // http://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html#abi.versioning |
| 42 // |
| 43 // libc++, identified by _LIBCPP_VERSION, always supports C++11. |
| 44 #if __cplusplus >= 201103l && \ |
| 45 ((defined(__GLIBCXX__) && \ |
| 46 __GLIBCXX__ >= 20110325ul && /* GCC >= 4.6.0 */ \ |
| 47 __GLIBCXX__ != 20110416ul && /* GCC 4.4.6 */ \ |
| 48 __GLIBCXX__ != 20120313ul && /* GCC 4.4.7 */ \ |
| 49 __GLIBCXX__ != 20110428ul && /* GCC 4.5.3 */ \ |
| 50 __GLIBCXX__ != 20120702ul) || /* GCC 4.5.4 */ \ |
| 51 (defined(_LIBCPP_VERSION))) |
| 52 #define CXX_LIBRARY_VERSION 2011 |
| 53 #else |
| 54 #define CXX_LIBRARY_VERSION 2003 |
| 55 #endif |
| 56 |
| 57 #endif // CRASHPAD_UTIL_STDLIB_CXX_H_ |
OLD | NEW |