summaryrefslogtreecommitdiffstats
path: root/ppapi/c/ppb_var.h
diff options
context:
space:
mode:
authordmichael@google.com <dmichael@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-13 20:04:31 +0000
committerdmichael@google.com <dmichael@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-13 20:04:31 +0000
commit1ad2a1dbcde42412bb92c83fe5e0d6999ed00311 (patch)
treebec94376d42b1943e2830e695956252232283b4d /ppapi/c/ppb_var.h
parentf68fbd1b300401c79df8df9773bbe7aa36ff6062 (diff)
downloadchromium_src-1ad2a1dbcde42412bb92c83fe5e0d6999ed00311.zip
chromium_src-1ad2a1dbcde42412bb92c83fe5e0d6999ed00311.tar.gz
chromium_src-1ad2a1dbcde42412bb92c83fe5e0d6999ed00311.tar.bz2
Add compile assertions to enforce the sizes of all structs and enums in the C API. Adjust some structs to make their sizes consistent across architectures. Note that some structs contain pointers, so are difficult to make consistent between 32-bit and 64-bit. Those types are in test_struct_sizes.c. Other types have a compile assertion immediately after their definition.
This was broken off from a bigger CL: http://codereview.chromium.org/5340003/ BUG=61004,92983 TEST=test_struct_sizes.c, compile assertions throughout See this CL for the code that helped generate the static assertions and find affected interfaces: http://codereview.chromium.org/5730003 Review URL: http://codereview.chromium.org/5674004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69038 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/c/ppb_var.h')
-rw-r--r--ppapi/c/ppb_var.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/ppapi/c/ppb_var.h b/ppapi/c/ppb_var.h
index fe4c1ef..a4a1f25 100644
--- a/ppapi/c/ppb_var.h
+++ b/ppapi/c/ppb_var.h
@@ -13,7 +13,7 @@
#include "ppapi/c/pp_stdint.h"
#include "ppapi/c/pp_var.h"
-#define PPB_VAR_INTERFACE "PPB_Var;0.2"
+#define PPB_VAR_INTERFACE "PPB_Var;0.3"
/**
* @file
@@ -33,6 +33,7 @@ enum PP_ObjectProperty_Modifier {
PP_OBJECTPROPERTY_MODIFIER_DONTDELETE = 1 << 2,
PP_OBJECTPROPERTY_MODIFIER_HASVALUE = 1 << 3
};
+PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_ObjectProperty_Modifier, 4);
struct PP_ObjectProperty {
struct PP_Var name;
@@ -40,7 +41,16 @@ struct PP_ObjectProperty {
struct PP_Var getter;
struct PP_Var setter;
uint32_t modifiers;
+
+ /** Ensure that this struct is 72 bytes wide by padding the end. In some
+ * compilers, PP_Var is 8-byte aligned, so those compilers align this struct
+ * on 8-byte boundaries as well and pad it to 72 bytes even without this
+ * padding attribute. This padding makes its size consistent across
+ * compilers.
+ */
+ int32_t padding;
};
+PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_ObjectProperty, 72);
/**
* PPB_Var API