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

Unified Diff: mojo/public/c/system/macros.h

Issue 267963003: mojo: Use static_assert for MOJO_COMPILE_ASSERT in C++11 mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tweak Created 6 years, 8 months 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: mojo/public/c/system/macros.h
diff --git a/mojo/public/c/system/macros.h b/mojo/public/c/system/macros.h
index 4be024900aedb48c87de3865161c8338520df0ad..322c3be61f7cb8f7d9cac345770504537964df97 100644
--- a/mojo/public/c/system/macros.h
+++ b/mojo/public/c/system/macros.h
@@ -27,8 +27,10 @@
#endif
// This macro is currently C++-only, but we want to use it in the C core.h.
-#ifdef __cplusplus
// Used to assert things at compile time.
+#if __cplusplus >= 201103L
darin (slow to review) 2014/05/04 03:15:15 this header is intended to be seen by a C compiler
Nico 2014/05/04 04:20:12 I think that's fine; undefined symbols evaluate to
+#define MOJO_COMPILE_ASSERT(expr, msg) static_assert(expr, #msg)
+#elif defined(__cplusplus)
namespace mojo { template <bool> struct CompileAssert {}; }
#define MOJO_COMPILE_ASSERT(expr, msg) \
typedef ::mojo::CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
« 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