win: set CXX_LIBRARY_VERSION to 2011

Unfortunately VS2013's support of C++11 is partial. It supports the
extended union definition, but does not fully support constexpr.

So, update some locations where CXX_LIBRARY_VERSION is used where
toolchain support is lacking. It works correctly in the locations
where std::is_standard_layout is used.

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/803273002
This commit is contained in:
Scott Graham 2014-12-15 15:55:41 -08:00
parent 22cf9e28d5
commit c23dcdc88a
2 changed files with 14 additions and 1 deletions

View File

@ -15,6 +15,15 @@
#ifndef CRASHPAD_UTIL_STDLIB_CXX_H_ #ifndef CRASHPAD_UTIL_STDLIB_CXX_H_
#define CRASHPAD_UTIL_STDLIB_CXX_H_ #define CRASHPAD_UTIL_STDLIB_CXX_H_
#include "build/build_config.h"
#if defined(COMPILER_MSVC)
#define CXX_LIBRARY_VERSION 2011
#define CXX_LIBRARY_HAS_CONSTEXPR 0
#else // !COMPILER_MSVC
// <ciso646> doesnt do very much, and under libc++, it will cause the // <ciso646> doesnt do very much, and under libc++, it will cause the
// _LIBCPP_VERSION macro to be defined properly. Under libstdc++, it doesnt // _LIBCPP_VERSION macro to be defined properly. Under libstdc++, it doesnt
// cause __GLIBCXX__ to be defined, but if _LIBCPP_VERSION isnt defined after // cause __GLIBCXX__ to be defined, but if _LIBCPP_VERSION isnt defined after
@ -50,8 +59,12 @@
__GLIBCXX__ != 20120702ul) || /* GCC 4.5.4 */ \ __GLIBCXX__ != 20120702ul) || /* GCC 4.5.4 */ \
(defined(_LIBCPP_VERSION))) (defined(_LIBCPP_VERSION)))
#define CXX_LIBRARY_VERSION 2011 #define CXX_LIBRARY_VERSION 2011
#define CXX_LIBRARY_HAS_CONSTEXPR 1
#else #else
#define CXX_LIBRARY_VERSION 2003 #define CXX_LIBRARY_VERSION 2003
#define CXX_LIBRARY_HAS_CONSTEXPR 0
#endif #endif
#endif // COMPILER_MSVC
#endif // CRASHPAD_UTIL_STDLIB_CXX_H_ #endif // CRASHPAD_UTIL_STDLIB_CXX_H_

View File

@ -29,7 +29,7 @@
// the std::numeric_limits<>::min() and max() functions will not be marked as // the std::numeric_limits<>::min() and max() functions will not be marked as
// constexpr, and thus wont be usable with C++11s static_assert(). In that // constexpr, and thus wont be usable with C++11s static_assert(). In that
// case, a run-time CHECK() will have to do. // case, a run-time CHECK() will have to do.
#if CXX_LIBRARY_VERSION >= 2011 #if CXX_LIBRARY_VERSION >= 2011 && CXX_LIBRARY_HAS_CONSTEXPR
#define CONSTEXPR_STATIC_ASSERT(condition, message) \ #define CONSTEXPR_STATIC_ASSERT(condition, message) \
static_assert(condition, message) static_assert(condition, message)
#else #else