Index: util/stdlib/string_number_conversion.cc |
diff --git a/util/stdlib/string_number_conversion.cc b/util/stdlib/string_number_conversion.cc |
index 76c80fdd5ec179f6b495122f4db9bf7c72e92c6f..b1a1f3dc089a642b3aec6d013db9f80da1d8ae33 100644 |
--- a/util/stdlib/string_number_conversion.cc |
+++ b/util/stdlib/string_number_conversion.cc |
@@ -32,7 +32,7 @@ |
// In that case, a run-time CHECK() will have to do. |
#if CXX_LIBRARY_VERSION >= 2011 |
#define CONSTEXPR_COMPILE_ASSERT(condition, message) \ |
Mark Mentovai
2014/10/01 03:55:12
Probably you should rename this to CONSTEXPR_STATI
scottmg
2014/10/01 16:37:19
Done.
|
- COMPILE_ASSERT(condition, message) |
+ static_assert(condition, #message) |
#else |
#define CONSTEXPR_COMPILE_ASSERT(condition, message) CHECK(condition) |
Mark Mentovai
2014/10/01 03:55:12
You can make this CHECK(condition) << message, nuk
scottmg
2014/10/01 16:37:19
Done.
|
#endif |
@@ -44,17 +44,17 @@ struct StringToIntegerTraits { |
typedef TIntType IntType; |
typedef TLongType LongType; |
static void TypeCheck() { |
- COMPILE_ASSERT(std::numeric_limits<TIntType>::is_integer && |
- std::numeric_limits<TLongType>::is_integer, |
- IntType_and_LongType_must_be_integer); |
- COMPILE_ASSERT(std::numeric_limits<TIntType>::is_signed == |
- std::numeric_limits<TLongType>::is_signed, |
- IntType_and_LongType_signedness_must_agree); |
+ static_assert(std::numeric_limits<TIntType>::is_integer && |
+ std::numeric_limits<TLongType>::is_integer, |
+ "IntType and LongType must be integer"); |
+ static_assert(std::numeric_limits<TIntType>::is_signed == |
+ std::numeric_limits<TLongType>::is_signed, |
+ "IntType and LongType signedness must agree"); |
CONSTEXPR_COMPILE_ASSERT(std::numeric_limits<TIntType>::min() >= |
std::numeric_limits<TLongType>::min() && |
std::numeric_limits<TIntType>::min() < |
std::numeric_limits<TLongType>::max(), |
- IntType_min_must_be_in_LongType_range); |
+ "IntType min must be in LongType range"); |
CONSTEXPR_COMPILE_ASSERT(std::numeric_limits<TIntType>::max() > |
std::numeric_limits<TLongType>::min() && |
std::numeric_limits<TIntType>::max() <= |
@@ -67,8 +67,8 @@ template <typename TIntType, typename TLongType> |
struct StringToSignedIntegerTraits |
: public StringToIntegerTraits<TIntType, TLongType> { |
static void TypeCheck() { |
- COMPILE_ASSERT(std::numeric_limits<TIntType>::is_signed, |
- StringToSignedTraits_IntType_must_be_signed); |
+ static_assert(std::numeric_limits<TIntType>::is_signed, |
+ "StringToSignedTraits IntType must be signed"); |
return super::TypeCheck(); |
} |
static bool IsNegativeOverflow(TLongType value) { |
@@ -83,8 +83,8 @@ template <typename TIntType, typename TLongType> |
struct StringToUnsignedIntegerTraits |
: public StringToIntegerTraits<TIntType, TLongType> { |
static void TypeCheck() { |
- COMPILE_ASSERT(!std::numeric_limits<TIntType>::is_signed, |
- StringToUnsignedTraits_IntType_must_be_unsigned); |
+ static_assert(!std::numeric_limits<TIntType>::is_signed, |
+ "StringToUnsignedTraits IntType must be unsigned"); |
return super::TypeCheck(); |
} |
static bool IsNegativeOverflow(TLongType value) { return false; } |