diff --git a/util/stdlib/cxx.h b/util/stdlib/cxx.h index 261a6c11..0e1cc435 100644 --- a/util/stdlib/cxx.h +++ b/util/stdlib/cxx.h @@ -15,6 +15,15 @@ #ifndef 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 + // doesn’t do very much, and under libc++, it will cause the // _LIBCPP_VERSION macro to be defined properly. Under libstdc++, it doesn’t // cause __GLIBCXX__ to be defined, but if _LIBCPP_VERSION isn’t defined after @@ -50,8 +59,12 @@ __GLIBCXX__ != 20120702ul) || /* GCC 4.5.4 */ \ (defined(_LIBCPP_VERSION))) #define CXX_LIBRARY_VERSION 2011 +#define CXX_LIBRARY_HAS_CONSTEXPR 1 #else #define CXX_LIBRARY_VERSION 2003 +#define CXX_LIBRARY_HAS_CONSTEXPR 0 #endif +#endif // COMPILER_MSVC + #endif // CRASHPAD_UTIL_STDLIB_CXX_H_ diff --git a/util/stdlib/string_number_conversion.cc b/util/stdlib/string_number_conversion.cc index a7c7d519..de8b5788 100644 --- a/util/stdlib/string_number_conversion.cc +++ b/util/stdlib/string_number_conversion.cc @@ -29,7 +29,7 @@ // the std::numeric_limits<>::min() and max() functions will not be marked as // constexpr, and thus won’t be usable with C++11’s static_assert(). In that // 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) \ static_assert(condition, message) #else