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

Unified Diff: mojo/converters/surfaces/surfaces_type_converters.cc

Issue 1468803002: Switch to static_assert. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@assert1
Patch Set: win Created 5 years, 1 month 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
Index: mojo/converters/surfaces/surfaces_type_converters.cc
diff --git a/mojo/converters/surfaces/surfaces_type_converters.cc b/mojo/converters/surfaces/surfaces_type_converters.cc
index 8908fc807f7189b4cbc3aa2af08a2b12fdb018a6..d8d8acb3baf1a2b6b30c632dfa8c58b2506eac47 100644
--- a/mojo/converters/surfaces/surfaces_type_converters.cc
+++ b/mojo/converters/surfaces/surfaces_type_converters.cc
@@ -69,10 +69,10 @@ using mus::mojom::YUVVideoQuadStatePtr;
namespace mojo {
-#define ASSERT_ENUM_VALUES_EQUAL(value) \
- COMPILE_ASSERT(cc::DrawQuad::value == static_cast<cc::DrawQuad::Material>( \
- mus::mojom::MATERIAL_##value), \
- value##_enum_value_matches)
+#define ASSERT_ENUM_VALUES_EQUAL(value) \
+ static_assert(cc::DrawQuad::value == static_cast<cc::DrawQuad::Material>( \
+ mus::mojom::MATERIAL_##value), \
+ #value "_enum_value_matches")
ASSERT_ENUM_VALUES_EQUAL(DEBUG_BORDER);
ASSERT_ENUM_VALUES_EQUAL(IO_SURFACE_CONTENT);
@@ -85,10 +85,10 @@ ASSERT_ENUM_VALUES_EQUAL(TEXTURE_CONTENT);
ASSERT_ENUM_VALUES_EQUAL(TILED_CONTENT);
ASSERT_ENUM_VALUES_EQUAL(YUV_VIDEO_CONTENT);
-COMPILE_ASSERT(cc::YUVVideoDrawQuad::REC_601 ==
- static_cast<cc::YUVVideoDrawQuad::ColorSpace>(
- mus::mojom::YUV_COLOR_SPACE_REC_601),
- rec_601_enum_matches);
+static_assert(cc::YUVVideoDrawQuad::REC_601 ==
+ static_cast<cc::YUVVideoDrawQuad::ColorSpace>(
+ mus::mojom::YUV_COLOR_SPACE_REC_601),
+ "rec_601_enum_matches");
// TODO(jamesr): Add REC_709 and JPEG to the YUVColorSpace enum upstream in
// mojo.

Powered by Google App Engine
This is Rietveld 408576698