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

Side by Side Diff: util/stdlib/string_number_conversion.cc

Issue 803273002: win: set CXX_LIBRARY_VERSION to 2011 (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: to CXX_LIBRARY_HAS_CONSTEXR Created 6 years 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 | « util/stdlib/cxx.h ('k') | 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 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with 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 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 11 matching lines...) Expand all
22 #include <limits> 22 #include <limits>
23 23
24 #include "base/logging.h" 24 #include "base/logging.h"
25 #include "util/stdlib/cxx.h" 25 #include "util/stdlib/cxx.h"
26 26
27 // CONSTEXPR_STATIC_ASSERT will be a normal static_assert if the C++ library is 27 // CONSTEXPR_STATIC_ASSERT will be a normal static_assert if the C++ library is
28 // the C++11 library. If using an older C++ library when compiling C++11 code, 28 // the C++11 library. If using an older C++ library when compiling C++11 code,
29 // the std::numeric_limits<>::min() and max() functions will not be marked as 29 // the std::numeric_limits<>::min() and max() functions will not be marked as
30 // constexpr, and thus won’t be usable with C++11’s static_assert(). In that 30 // constexpr, and thus won’t be usable with C++11’s static_assert(). In that
31 // case, a run-time CHECK() will have to do. 31 // case, a run-time CHECK() will have to do.
32 #if CXX_LIBRARY_VERSION >= 2011 32 #if CXX_LIBRARY_VERSION >= 2011 && CXX_LIBRARY_HAS_CONSTEXPR
33 #define CONSTEXPR_STATIC_ASSERT(condition, message) \ 33 #define CONSTEXPR_STATIC_ASSERT(condition, message) \
34 static_assert(condition, message) 34 static_assert(condition, message)
35 #else 35 #else
36 #define CONSTEXPR_STATIC_ASSERT(condition, message) CHECK(condition) << message 36 #define CONSTEXPR_STATIC_ASSERT(condition, message) CHECK(condition) << message
37 #endif 37 #endif
38 38
39 namespace { 39 namespace {
40 40
41 template <typename TIntType, typename TLongType> 41 template <typename TIntType, typename TLongType>
42 struct StringToIntegerTraits { 42 struct StringToIntegerTraits {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 147
148 bool StringToNumber(const base::StringPiece& string, int* number) { 148 bool StringToNumber(const base::StringPiece& string, int* number) {
149 return StringToIntegerInternal<StringToIntTraits>(string, number); 149 return StringToIntegerInternal<StringToIntTraits>(string, number);
150 } 150 }
151 151
152 bool StringToNumber(const base::StringPiece& string, unsigned int* number) { 152 bool StringToNumber(const base::StringPiece& string, unsigned int* number) {
153 return StringToIntegerInternal<StringToUnsignedIntTraits>(string, number); 153 return StringToIntegerInternal<StringToUnsignedIntTraits>(string, number);
154 } 154 }
155 155
156 } // namespace crashpad 156 } // namespace crashpad
OLDNEW
« no previous file with comments | « util/stdlib/cxx.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698