summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2014-09-16 12:42:37 -0700
committerNico Weber <thakis@chromium.org>2014-09-16 19:43:56 +0000
commit83ea589954286349dfb86cbfb0c9337ae5019108 (patch)
tree856ff15471833e1a5789cbca9be9c3c24bc8a101 /base
parentb4e3817fa26c6c53ea930beab249c51d0370bd31 (diff)
downloadchromium_src-83ea589954286349dfb86cbfb0c9337ae5019108.zip
chromium_src-83ea589954286349dfb86cbfb0c9337ae5019108.tar.gz
chromium_src-83ea589954286349dfb86cbfb0c9337ae5019108.tar.bz2
Use a better c++11 readiness check.
This is like https://codereview.chromium.org/443483002/ , but that check wasn't as convincing as it could have been since clang accepts override and final as an extension in c++98 mode. No intended behavior change. If your bot can't deal with this, please let me know! BUG=none R=viettrungluu@chromium.org Review URL: https://codereview.chromium.org/555383004 Cr-Commit-Position: refs/heads/master@{#295128}
Diffstat (limited to 'base')
-rw-r--r--base/macros.h56
1 files changed, 0 insertions, 56 deletions
diff --git a/base/macros.h b/base/macros.h
index 7817515..2741afc 100644
--- a/base/macros.h
+++ b/base/macros.h
@@ -153,64 +153,8 @@ inline To implicit_cast(From const &f) {
// containing the name of the variable.
#undef COMPILE_ASSERT
-
-#if __cplusplus >= 201103L
-
-// Under C++11, just use static_assert.
#define COMPILE_ASSERT(expr, msg) static_assert(expr, #msg)
-#else
-
-template <bool>
-struct CompileAssert {
-};
-
-#define COMPILE_ASSERT(expr, msg) \
- typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] ALLOW_UNUSED
-
-// Implementation details of COMPILE_ASSERT:
-//
-// - COMPILE_ASSERT works by defining an array type that has -1
-// elements (and thus is invalid) when the expression is false.
-//
-// - The simpler definition
-//
-// #define COMPILE_ASSERT(expr, msg) typedef char msg[(expr) ? 1 : -1]
-//
-// does not work, as gcc supports variable-length arrays whose sizes
-// are determined at run-time (this is gcc's extension and not part
-// of the C++ standard). As a result, gcc fails to reject the
-// following code with the simple definition:
-//
-// int foo;
-// COMPILE_ASSERT(foo, msg); // not supposed to compile as foo is
-// // not a compile-time constant.
-//
-// - By using the type CompileAssert<(bool(expr))>, we ensures that
-// expr is a compile-time constant. (Template arguments must be
-// determined at compile-time.)
-//
-// - The outer parentheses in CompileAssert<(bool(expr))> are necessary
-// to work around a bug in gcc 3.4.4 and 4.0.1. If we had written
-//
-// CompileAssert<bool(expr)>
-//
-// instead, these compilers will refuse to compile
-//
-// COMPILE_ASSERT(5 > 0, some_message);
-//
-// (They seem to think the ">" in "5 > 0" marks the end of the
-// template argument list.)
-//
-// - The array size is (bool(expr) ? 1 : -1), instead of simply
-//
-// ((expr) ? 1 : -1).
-//
-// This is to avoid running into a bug in MS VC 7.1, which
-// causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1.
-
-#endif
-
// bit_cast<Dest,Source> is a template function that implements the
// equivalent of "*reinterpret_cast<Dest*>(&source)". We need this in
// very low-level functions like the protobuf library and fast math