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

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 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 | « ppapi/c/pp_instance.h ('k') | ppapi/c/pp_module.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/c/pp_macros.h
===================================================================
--- ppapi/c/pp_macros.h (revision 68374)
+++ 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 PP_Dummy_Struct_For_##NAME { \
char _COMPILE_ASSERT_FAILED_The_type_named_ \
## NAME ## _is_not_ ## SIZE ## \
_bytes_wide[(sizeof(CTYPENAME) == SIZE) ? 1 : -1]; }
@@ -76,6 +76,39 @@
#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 Bar { A = 0, B = 1 };
+ 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)
+
+/* Processor architecture detection. This was copied from:
+ chromium/src/build/build_config.h
+ For more info on what's defined, see:
+ http://msdn.microsoft.com/en-us/library/b0084kay.aspx
+ http://www.agner.org/optimize/calling_conventions.pdf
+ or with gcc, run: "echo | gcc -E -dM -"
+ */
+#if defined(_M_X64) || defined(__x86_64__)
+#define ARCH_CPU_X86_FAMILY 1
+#define ARCH_CPU_X86_64 1
+#define ARCH_CPU_64_BITS 1
+#elif defined(_M_IX86) || defined(__i386__)
+#define ARCH_CPU_X86_FAMILY 1
+#define ARCH_CPU_X86 1
+#define ARCH_CPU_32_BITS 1
+#elif defined(__ARMEL__)
+#define ARCH_CPU_ARM_FAMILY 1
+#define ARCH_CPU_ARMEL 1
+#define ARCH_CPU_32_BITS 1
+#define WCHAR_T_IS_UNSIGNED 1
+#else
+#error Please add support for your architecture in ppapi/c/pp_macros.h
+#endif
+
/**
* @}
* End of addtogroup PP
« no previous file with comments | « ppapi/c/pp_instance.h ('k') | ppapi/c/pp_module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698