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

Unified Diff: mojo/system/options_validation.h

Issue 603983003: Mojo: COMPILE_ASSERT -> static_assert in mojo/system and mojo/embedder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « mojo/system/message_in_transit.cc ('k') | mojo/system/transport_data.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/options_validation.h
diff --git a/mojo/system/options_validation.h b/mojo/system/options_validation.h
index 3bb0d471ef5a2849fd53557bdc0bbd193ef4aa2b..25be7c0d518ffbd4b9cd15d33c34bab8a21443b1 100644
--- a/mojo/system/options_validation.h
+++ b/mojo/system/options_validation.h
@@ -37,10 +37,12 @@ class UserOptionsReader {
: options_reader_(UserPointer<const char>::Reader::NoCheck(),
options.template ReinterpretCast<const char>(),
GetSizeForReader(options)) {
- COMPILE_ASSERT(offsetof(Options, struct_size) == 0,
- Options_struct_size_not_first_member);
- // TODO(vtl): With C++11, compile-assert that |sizeof(Options::struct_size)
- // == sizeof(uint32_t)| somewhere.
+ static_assert(offsetof(Options, struct_size) == 0,
+ "struct_size not first member of Options");
+ // TODO(vtl): Enable when MSVC supports this (C++11 extended sizeof):
+ // static_assert(sizeof(Options::struct_size) == sizeof(uint32_t),
+ // "Options::struct_size not a uint32_t");
+ // (Or maybe assert that its type is uint32_t?)
}
bool is_valid() const { return !!options_reader_.GetPointer(); }
« no previous file with comments | « mojo/system/message_in_transit.cc ('k') | mojo/system/transport_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698