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

Unified Diff: src/IceTypes.cpp

Issue 618313003: Subzero: Move to C++11 static_assert(). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Remove the dummy wrapper functions around the static_asserts 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 | « src/IceTargetLoweringX8632.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTypes.cpp
diff --git a/src/IceTypes.cpp b/src/IceTypes.cpp
index 29ff4de0799375d870be2385b40c53862dd641cd..11ac5b780e4fe34121b99858d10d675f90b4126c 100644
--- a/src/IceTypes.cpp
+++ b/src/IceTypes.cpp
@@ -18,61 +18,61 @@ namespace Ice {
namespace {
-// Dummy function to make sure the two type tables have the same
-// enumerated types.
-void __attribute__((unused)) xIceTypeMacroIntegrityCheck() {
+// Show tags match between ICETYPE_TABLE and ICETYPE_PROPS_TABLE.
- // Show tags match between ICETYPE_TABLE and ICETYPE_PROPS_TABLE.
-
- // Define a temporary set of enum values based on ICETYPE_TABLE
- enum {
+// Define a temporary set of enum values based on ICETYPE_TABLE
+enum {
#define X(tag, size, align, elts, elty, str) _table_tag_##tag,
- ICETYPE_TABLE
+ ICETYPE_TABLE
#undef X
- _enum_table_tag_Names
- };
- // Define a temporary set of enum values based on ICETYPE_PROPS_TABLE
- enum {
+ _enum_table_tag_Names
+};
+// Define a temporary set of enum values based on ICETYPE_PROPS_TABLE
+enum {
#define X(tag, IsVec, IsInt, IsFloat, IsIntArith, IsLoadStore, CompareResult) \
_props_table_tag_##tag,
- ICETYPE_PROPS_TABLE
+ ICETYPE_PROPS_TABLE
#undef X
- _enum_props_table_tag_Names
- };
+ _enum_props_table_tag_Names
+};
// Assert that tags in ICETYPE_TABLE are also in ICETYPE_PROPS_TABLE.
#define X(tag, size, align, elts, elty, str) \
- STATIC_ASSERT((unsigned)_table_tag_##tag == (unsigned)_props_table_tag_##tag);
- ICETYPE_TABLE;
+ static_assert( \
+ (unsigned)_table_tag_##tag == (unsigned)_props_table_tag_##tag, \
+ "Inconsistency between ICETYPE_PROPS_TABLE and ICETYPE_TABLE");
+ICETYPE_TABLE;
#undef X
// Assert that tags in ICETYPE_PROPS_TABLE is in ICETYPE_TABLE.
#define X(tag, IsVec, IsInt, IsFloat, IsIntArith, IsLoadStore, CompareResult) \
- STATIC_ASSERT((unsigned)_table_tag_##tag == (unsigned)_props_table_tag_##tag);
- ICETYPE_PROPS_TABLE
+ static_assert( \
+ (unsigned)_table_tag_##tag == (unsigned)_props_table_tag_##tag, \
+ "Inconsistency between ICETYPE_PROPS_TABLE and ICETYPE_TABLE");
+ICETYPE_PROPS_TABLE
#undef X
- // Show vector definitions match in ICETYPE_TABLE and
- // ICETYPE_PROPS_TABLE.
+// Show vector definitions match in ICETYPE_TABLE and
+// ICETYPE_PROPS_TABLE.
- // Define constants for each element size in ICETYPE_TABLE.
- enum {
+// Define constants for each element size in ICETYPE_TABLE.
+enum {
#define X(tag, size, align, elts, elty, str) _table_elts_##tag = elts,
- ICETYPE_TABLE
+ ICETYPE_TABLE
#undef X
- _enum_table_elts_Elements = 0
- };
- // Define constants for boolean flag if vector in ICETYPE_PROPS_TABLE.
- enum {
+ _enum_table_elts_Elements = 0
+};
+// Define constants for boolean flag if vector in ICETYPE_PROPS_TABLE.
+enum {
#define X(tag, IsVec, IsInt, IsFloat, IsIntArith, IsLoadStore, CompareResult) \
_props_table_IsVec_##tag = IsVec,
- ICETYPE_PROPS_TABLE
+ ICETYPE_PROPS_TABLE
#undef X
- };
+};
// Verify that the number of vector elements is consistent with IsVec.
#define X(tag, IsVec, IsInt, IsFloat, IsIntArith, IsLoadStore, CompareResult) \
- STATIC_ASSERT((_table_elts_##tag > 1) == _props_table_IsVec_##tag);
- ICETYPE_PROPS_TABLE;
+ static_assert((_table_elts_##tag > 1) == _props_table_IsVec_##tag, \
+ "Inconsistent vector specification in ICETYPE_PROPS_TABLE");
+ICETYPE_PROPS_TABLE;
#undef X
-}
struct TypeAttributeFields {
size_t TypeWidthInBytes;
@@ -86,7 +86,7 @@ const struct TypeAttributeFields TypeAttributes[] = {
#define X(tag, size, align, elts, elty, str) \
{ size, align, elts, elty, str } \
,
- ICETYPE_TABLE
+ ICETYPE_TABLE
#undef X
};
@@ -110,7 +110,7 @@ const TypePropertyFields TypePropertiesTable[] = {
IsFloat && !IsVec, IsFloat && IsVec, IsLoadStore, CompareResult \
} \
,
- ICETYPE_PROPS_TABLE
+ ICETYPE_PROPS_TABLE
#undef X
};
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698