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

Unified Diff: base/strings/safe_sprintf.cc

Issue 98403005: Disable kSSizeMaxConst COMPILE_ASSERT() for Android / Mac / IOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comment and add cast Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/strings/safe_sprintf.cc
diff --git a/base/strings/safe_sprintf.cc b/base/strings/safe_sprintf.cc
index 2d4d93c947bd0514ce4ac8e45c1f1bdbabbf3884..1e09b6e899e3c4a9524b725e4f697913ee8689bc 100644
--- a/base/strings/safe_sprintf.cc
+++ b/base/strings/safe_sprintf.cc
@@ -107,12 +107,13 @@ class Buffer {
: buffer_(buffer),
size_(size - 1), // Account for trailing NUL byte
count_(0) {
-// This test should work on all C++11 compilers, but apparently something is
-// not working on all versions of clang just yet (e.g. on Mac, IOS, and
-// Android). We are conservative and exclude all of clang for the time being.
-// TODO(markus): Check if this restriction can be lifted.
-#if __cplusplus >= 201103 && !defined(__clang__)
- COMPILE_ASSERT(kSSizeMaxConst == std::numeric_limits<ssize_t>::max(),
+// The following assertion does not build on Mac and Android. This is because
+// static_assert only works with compile-time constants, but mac uses
+// libstdc++4.2 and android uses stlport, which both don't mark
+// numeric_limits::max() as constexp.
+#if __cplusplus >= 201103 && !defined(OS_ANDROID) && !defined(OS_MACOSX) && !defined(OS_IOS)
+ COMPILE_ASSERT(kSSizeMaxConst == \
+ static_cast<size_t>(std::numeric_limits<ssize_t>::max()),
kSSizeMax_is_the_max_value_of_an_ssize_t);
#endif
DEBUG_CHECK(size > 0);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698