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

Unified Diff: ppapi/c/pp_macros.h

Issue 5340003: Make a new test to enforce the sizes of all structs and enums in the C API.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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: ppapi/c/pp_macros.h
===================================================================
--- ppapi/c/pp_macros.h (revision 67297)
+++ ppapi/c/pp_macros.h (working copy)
@@ -53,7 +53,7 @@
SIZE is the expected size in bytes.
*/
#define PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, CTYPENAME, SIZE) \
-struct _dummy_struct_for_##NAME { \
+struct Dummy_Struct_For_##NAME { \
char _COMPILE_ASSERT_FAILED_The_type_named_ \
## NAME ## _is_not_ ## SIZE ## \
_bytes_wide[(sizeof(CTYPENAME) == SIZE) ? 1 : -1]; }
@@ -61,7 +61,7 @@
/* PP_COMPILE_ASSERT_SIZE_IN_BYTES is for typenames that contain no spaces.
E.g.:
PP_COMPILE_ASSERT_SIZE_IN_BYTES(int, 4);
- typedef struct { int a; } Foo;
+ typedef enum { int a; } Foo;
brettw 2010/11/24 22:36:40 What does declaring an int inside an enum mean? Wh
dmichael(do not use this one) 2010/11/24 23:23:15 I changed it to enum just because enums are more l
PP_COMPILE_ASSERT_SIZE_IN_BYTES(Foo, 4);
*/
#define PP_COMPILE_ASSERT_SIZE_IN_BYTES(NAME, SIZE) \
@@ -76,6 +76,15 @@
#define PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(NAME, SIZE) \
PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, struct NAME, SIZE)
+/* PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES is for typenames that contain 'enum'
+ in C. That is, enum names that are not typedefs.
+ E.g.:
+ enum Foo { int a; };
+ PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(Foo, 4);
+ */
+#define PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(NAME, SIZE) \
+PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, enum NAME, SIZE)
+
/**
* @}
* End of addtogroup PP
« no previous file with comments | « ppapi/c/pp_input_event.h ('k') | ppapi/c/pp_var.h » ('j') | ppapi/tests/test_c_sizes.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698