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

Unified Diff: ppapi/tests/all_c_sizes.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/tests/all_c_includes.h ('k') | ppapi/tests/all_cpp_includes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/all_c_sizes.h
===================================================================
--- ppapi/tests/all_c_sizes.h (revision 0)
+++ ppapi/tests/all_c_sizes.h (revision 0)
@@ -0,0 +1,42 @@
+/* Copyright (c) 2010 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * This header ensures (at compile time) that each type has the expected size.
+ * The purpose is to ensure that the ABI of PPAPI is known, consistent, and
+ * stable. If the size of one of these types changes, then it is necessary to
+ * change the version of any interfaces that rely on the changed type(s).
+ *
+ * Note that the ABI only consists of the headers under ppapi/c. But they may
+ * be compiled by either a C or C++ compiler, so we want to make sure they are
+ * consistent regardless of whether a C or C++ compiler is used. See
+ * test_struct_sizes_c.c and test_struct_sizes_cpp.cc for more information.
+ */
+
+#ifndef PPAPI_TESTS_ALL_C_SIZES_H_
+#define PPAPI_TESTS_ALL_C_SIZES_H_
+
+#include "ppapi/tests/all_c_includes.h"
+
+#if !defined(__native_client__) && (defined(_M_X64) || defined(__x86_64__))
+/* These sizes are for 64-bit compilation on Windows, Mac, and Linux. Native
+ client follows ILP32 even if -m64 is used. This means pointers are always
+ 4 bytes in native client, and it matches Win32 (see below).
+
+ Each of these structs uses at least one type which differs in size or
+ alignment between 64-bit and 32-bit (e.g. pointers, int64_t, uint64_t,
+ or double), and they are not padded to keep their size consistent. */
+#include "ppapi/tests/all_sizes_64.h"
+#else
+/* This section is for compilation on 32-bit targets plus native client (in both
+ 32-bit and 64-bit mode, since native client always conforms to ILP32).
+
+ These types all contain pointers and have no types that are 8-byte aligned on
+ Windows/NaCl. The pointers cause the sizes to differ between 32-bit and
+ 64-bit, but the lack of 8-byte-aligned types allows them to be consistent
+ between Windows 32-bit, Native Client, and Mac/Linux 32-bit. */
+#include "ppapi/tests/all_sizes_32.h"
+#endif
+
+#endif // PPAPI_TESTS_ALL_C_SIZES_H_
+
Property changes on: ppapi/tests/all_c_sizes.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « ppapi/tests/all_c_includes.h ('k') | ppapi/tests/all_cpp_includes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698