Commit 9f62c9b7 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

winapi_test: Fix TEST_FIELD() so it correctly tests the field size.

parent 43c18c13
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -91,10 +91,10 @@ ...@@ -91,10 +91,10 @@
* Test macros * Test macros
*/ */
#define TEST_FIELD(type, field_type, field_name, field_offset, field_size, field_align) \ #define TEST_FIELD(type, field, field_offset, field_size, field_align) \
TEST_TYPE_SIZE(field_type, field_size); \ TEST_TYPE_SIZE((((type*)0)->field), field_size); \
TEST_FIELD_ALIGNMENT(type, field_name, field_align); \ TEST_FIELD_ALIGNMENT(type, field, field_align); \
TEST_FIELD_OFFSET(type, field_name, field_offset); \ TEST_FIELD_OFFSET(type, field, field_offset)
#define TEST_TYPE(type, size, align) \ #define TEST_TYPE(type, size, align) \
TEST_TYPE_ALIGNMENT(type, align); \ TEST_TYPE_ALIGNMENT(type, align); \
...@@ -127,20 +127,20 @@ static void test_pack_DLLVERSIONINFO(void) ...@@ -127,20 +127,20 @@ static void test_pack_DLLVERSIONINFO(void)
{ {
/* DLLVERSIONINFO (pack 8) */ /* DLLVERSIONINFO (pack 8) */
TEST_TYPE(DLLVERSIONINFO, 20, 4); TEST_TYPE(DLLVERSIONINFO, 20, 4);
TEST_FIELD(DLLVERSIONINFO, DWORD, cbSize, 0, 4, 4); TEST_FIELD(DLLVERSIONINFO, cbSize, 0, 4, 4);
TEST_FIELD(DLLVERSIONINFO, DWORD, dwMajorVersion, 4, 4, 4); TEST_FIELD(DLLVERSIONINFO, dwMajorVersion, 4, 4, 4);
TEST_FIELD(DLLVERSIONINFO, DWORD, dwMinorVersion, 8, 4, 4); TEST_FIELD(DLLVERSIONINFO, dwMinorVersion, 8, 4, 4);
TEST_FIELD(DLLVERSIONINFO, DWORD, dwBuildNumber, 12, 4, 4); TEST_FIELD(DLLVERSIONINFO, dwBuildNumber, 12, 4, 4);
TEST_FIELD(DLLVERSIONINFO, DWORD, dwPlatformID, 16, 4, 4); TEST_FIELD(DLLVERSIONINFO, dwPlatformID, 16, 4, 4);
} }
static void test_pack_DLLVERSIONINFO2(void) static void test_pack_DLLVERSIONINFO2(void)
{ {
/* DLLVERSIONINFO2 (pack 8) */ /* DLLVERSIONINFO2 (pack 8) */
TEST_TYPE(DLLVERSIONINFO2, 32, 8); TEST_TYPE(DLLVERSIONINFO2, 32, 8);
TEST_FIELD(DLLVERSIONINFO2, DLLVERSIONINFO, info1, 0, 20, 4); TEST_FIELD(DLLVERSIONINFO2, info1, 0, 20, 4);
TEST_FIELD(DLLVERSIONINFO2, DWORD, dwFlags, 20, 4, 4); TEST_FIELD(DLLVERSIONINFO2, dwFlags, 20, 4, 4);
TEST_FIELD(DLLVERSIONINFO2, ULONGLONG, ullVersion, 24, 8, 8); TEST_FIELD(DLLVERSIONINFO2, ullVersion, 24, 8, 8);
} }
static void test_pack_HUSKEY(void) static void test_pack_HUSKEY(void)
......
...@@ -89,10 +89,10 @@ ...@@ -89,10 +89,10 @@
* Test macros * Test macros
*/ */
#define TEST_FIELD(type, field_type, field_name, field_offset, field_size, field_align) \ #define TEST_FIELD(type, field, field_offset, field_size, field_align) \
TEST_TYPE_SIZE(field_type, field_size); \ TEST_TYPE_SIZE((((type*)0)->field), field_size); \
TEST_FIELD_ALIGNMENT(type, field_name, field_align); \ TEST_FIELD_ALIGNMENT(type, field, field_align); \
TEST_FIELD_OFFSET(type, field_name, field_offset); \ TEST_FIELD_OFFSET(type, field, field_offset)
#define TEST_TYPE(type, size, align) \ #define TEST_TYPE(type, size, align) \
TEST_TYPE_ALIGNMENT(type, align); \ TEST_TYPE_ALIGNMENT(type, align); \
...@@ -111,8 +111,8 @@ ...@@ -111,8 +111,8 @@
static void test_pack_BINDINFO(void) static void test_pack_BINDINFO(void)
{ {
/* BINDINFO (pack 4) */ /* BINDINFO (pack 4) */
TEST_FIELD(BINDINFO, ULONG, cbSize, 0, 4, 4); TEST_FIELD(BINDINFO, cbSize, 0, 4, 4);
TEST_FIELD(BINDINFO, LPWSTR, szExtraInfo, 4, 4, 4); TEST_FIELD(BINDINFO, szExtraInfo, 4, 4, 4);
} }
static void test_pack_IBindHost(void) static void test_pack_IBindHost(void)
...@@ -265,39 +265,39 @@ static void test_pack_REMSECURITY_ATTRIBUTES(void) ...@@ -265,39 +265,39 @@ static void test_pack_REMSECURITY_ATTRIBUTES(void)
{ {
/* REMSECURITY_ATTRIBUTES (pack 4) */ /* REMSECURITY_ATTRIBUTES (pack 4) */
TEST_TYPE(REMSECURITY_ATTRIBUTES, 12, 4); TEST_TYPE(REMSECURITY_ATTRIBUTES, 12, 4);
TEST_FIELD(REMSECURITY_ATTRIBUTES, DWORD, nLength, 0, 4, 4); TEST_FIELD(REMSECURITY_ATTRIBUTES, nLength, 0, 4, 4);
TEST_FIELD(REMSECURITY_ATTRIBUTES, DWORD, lpSecurityDescriptor, 4, 4, 4); TEST_FIELD(REMSECURITY_ATTRIBUTES, lpSecurityDescriptor, 4, 4, 4);
TEST_FIELD(REMSECURITY_ATTRIBUTES, BOOL, bInheritHandle, 8, 4, 4); TEST_FIELD(REMSECURITY_ATTRIBUTES, bInheritHandle, 8, 4, 4);
} }
static void test_pack_RemBINDINFO(void) static void test_pack_RemBINDINFO(void)
{ {
/* RemBINDINFO (pack 4) */ /* RemBINDINFO (pack 4) */
TEST_TYPE(RemBINDINFO, 72, 4); TEST_TYPE(RemBINDINFO, 72, 4);
TEST_FIELD(RemBINDINFO, ULONG, cbSize, 0, 4, 4); TEST_FIELD(RemBINDINFO, cbSize, 0, 4, 4);
TEST_FIELD(RemBINDINFO, LPWSTR, szExtraInfo, 4, 4, 4); TEST_FIELD(RemBINDINFO, szExtraInfo, 4, 4, 4);
TEST_FIELD(RemBINDINFO, DWORD, grfBindInfoF, 8, 4, 4); TEST_FIELD(RemBINDINFO, grfBindInfoF, 8, 4, 4);
TEST_FIELD(RemBINDINFO, DWORD, dwBindVerb, 12, 4, 4); TEST_FIELD(RemBINDINFO, dwBindVerb, 12, 4, 4);
TEST_FIELD(RemBINDINFO, LPWSTR, szCustomVerb, 16, 4, 4); TEST_FIELD(RemBINDINFO, szCustomVerb, 16, 4, 4);
TEST_FIELD(RemBINDINFO, DWORD, cbstgmedData, 20, 4, 4); TEST_FIELD(RemBINDINFO, cbstgmedData, 20, 4, 4);
TEST_FIELD(RemBINDINFO, DWORD, dwOptions, 24, 4, 4); TEST_FIELD(RemBINDINFO, dwOptions, 24, 4, 4);
TEST_FIELD(RemBINDINFO, DWORD, dwOptionsFlags, 28, 4, 4); TEST_FIELD(RemBINDINFO, dwOptionsFlags, 28, 4, 4);
TEST_FIELD(RemBINDINFO, DWORD, dwCodePage, 32, 4, 4); TEST_FIELD(RemBINDINFO, dwCodePage, 32, 4, 4);
TEST_FIELD(RemBINDINFO, REMSECURITY_ATTRIBUTES, securityAttributes, 36, 12, 4); TEST_FIELD(RemBINDINFO, securityAttributes, 36, 12, 4);
TEST_FIELD(RemBINDINFO, IID, iid, 48, 16, 4); TEST_FIELD(RemBINDINFO, iid, 48, 16, 4);
TEST_FIELD(RemBINDINFO, IUnknown *, pUnk, 64, 4, 4); TEST_FIELD(RemBINDINFO, pUnk, 64, 4, 4);
TEST_FIELD(RemBINDINFO, DWORD, dwReserved, 68, 4, 4); TEST_FIELD(RemBINDINFO, dwReserved, 68, 4, 4);
} }
static void test_pack_RemFORMATETC(void) static void test_pack_RemFORMATETC(void)
{ {
/* RemFORMATETC (pack 4) */ /* RemFORMATETC (pack 4) */
TEST_TYPE(RemFORMATETC, 20, 4); TEST_TYPE(RemFORMATETC, 20, 4);
TEST_FIELD(RemFORMATETC, DWORD, cfFormat, 0, 4, 4); TEST_FIELD(RemFORMATETC, cfFormat, 0, 4, 4);
TEST_FIELD(RemFORMATETC, DWORD, ptd, 4, 4, 4); TEST_FIELD(RemFORMATETC, ptd, 4, 4, 4);
TEST_FIELD(RemFORMATETC, DWORD, dwAspect, 8, 4, 4); TEST_FIELD(RemFORMATETC, dwAspect, 8, 4, 4);
TEST_FIELD(RemFORMATETC, LONG, lindex, 12, 4, 4); TEST_FIELD(RemFORMATETC, lindex, 12, 4, 4);
TEST_FIELD(RemFORMATETC, DWORD, tymed, 16, 4, 4); TEST_FIELD(RemFORMATETC, tymed, 16, 4, 4);
} }
static void test_pack(void) static void test_pack(void)
......
...@@ -571,10 +571,10 @@ sub output_header($$$) { ...@@ -571,10 +571,10 @@ sub output_header($$$) {
print OUT " * Test macros\n"; print OUT " * Test macros\n";
print OUT " */\n"; print OUT " */\n";
print OUT "\n"; print OUT "\n";
print OUT "#define TEST_FIELD(type, field_type, field_name, field_offset, field_size, field_align) \\\n"; print OUT "#define TEST_FIELD(type, field, field_offset, field_size, field_align) \\\n";
print OUT " TEST_TYPE_SIZE(field_type, field_size); \\\n"; print OUT " TEST_TYPE_SIZE((((type*)0)->field), field_size); \\\n";
print OUT " TEST_FIELD_ALIGNMENT(type, field_name, field_align); \\\n"; print OUT " TEST_FIELD_ALIGNMENT(type, field, field_align); \\\n";
print OUT " TEST_FIELD_OFFSET(type, field_name, field_offset); \\\n"; print OUT " TEST_FIELD_OFFSET(type, field, field_offset)\n";
print OUT "\n"; print OUT "\n";
print OUT "#define TEST_TYPE(type, size, align) \\\n"; print OUT "#define TEST_TYPE(type, size, align) \\\n";
print OUT " TEST_TYPE_ALIGNMENT(type, align); \\\n"; print OUT " TEST_TYPE_ALIGNMENT(type, align); \\\n";
...@@ -727,14 +727,14 @@ sub output_test_pack_fields($$$$$$$) { ...@@ -727,14 +727,14 @@ sub output_test_pack_fields($$$$$$$) {
$field_offset += $offset; $field_offset += $offset;
if ($field_name eq "DUMMYSTRUCTNAME") { if ($field_name eq "DUMMYSTRUCTNAME") {
print OUT "#ifdef NONAMELESSSTRUCT\n"; print OUT "#ifdef NONAMELESSSTRUCT\n";
print OUT " TEST_FIELD($type_name, $field_type_name, $field_name, "; print OUT " TEST_FIELD($type_name, $field_name, ";
print OUT "$field_offset, $field_size, $field_align);\n"; print OUT "$field_offset, $field_size, $field_align);\n";
print OUT "#else\n"; print OUT "#else\n";
output_test_pack_fields(\*OUT, $type_name2type, $type_name2optional, $type_name2optional_fields, output_test_pack_fields(\*OUT, $type_name2type, $type_name2optional, $type_name2optional_fields,
$type_name, $$type_name2type{$field_type_name}, $field_offset); $type_name, $$type_name2type{$field_type_name}, $field_offset);
print OUT "#endif\n"; print OUT "#endif\n";
} else { } else {
print OUT " TEST_FIELD($type_name, $field_type_name, $field_name, "; print OUT " TEST_FIELD($type_name, $field_name, ";
print OUT "$field_offset, $field_size, $field_align);\n"; print OUT "$field_offset, $field_size, $field_align);\n";
} }
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment