 Chromium Code Reviews
 Chromium Code Reviews 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/
    
  
    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/| 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 |