3 # Copyright 2002 Patrik Stridvall
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 $0 =~ m
%^(.*?
/?tools)/winapi
/winapi_test
$%;
25 require "$1/winapi/setup.pm";
29 file_type files_skip files_filter
30 $current_dir $wine_dir $winapi_dir
32 use output qw($output);
33 use winapi_test_options qw($options);
35 if($options->progress) {
36 $output->enable_progress;
38 $output->disable_progress;
44 use util qw(replace_file);
57 foreach my $test (@tests)
59 foreach my $test_dir ($tests->get_test_dirs($test))
61 foreach my $header ($tests->get_section($test_dir, $test, "header"))
65 push @files, "include/$header";
74 my $file = "tests.dat";
76 $file .= "2"; # FIXME: For tests
78 open(OUT
, "> $winapi_dir/$file") || die "Error: Can't open $winapi_dir/$file: $!\n";
81 my @test_dirs = $tests->get_test_dirs();
82 foreach my $test_dir (@test_dirs) {
83 print OUT
"\n" if $x++;
84 print OUT
"%%%$test_dir\n";
88 my @tests = $tests->get_tests($test_dir);
89 foreach my $test (@tests) {
90 print OUT
"\n" if $y++;
91 print OUT
"%%$test\n";
97 my @sections = $tests->get_sections($test_dir, $test);
98 foreach my $section (@sections) {
99 my @lines = $tests->get_section($test_dir, $test, $section);
101 if ($section =~ /^(?:struct|type)$/) {
102 foreach my $line (@lines) {
108 print OUT
"\n" if $z++;
109 print OUT
"%$section\n";
111 foreach my $line (@lines) {
116 @types = sort { $x = $a; $y = $b; $x =~ s/^!//; $y =~ s/^!//; $x cmp $y } @types;
118 print OUT
"\n" if $z++;
121 foreach my $type (@types) {
135 my $progress_current = 0;
136 my $progress_max = scalar(@files);
138 ########################################################################
144 "ANYSIZE_ARRAY" => 1,
145 "CCHDEVICENAME" => 32,
146 "CCHILDREN_TITLEBAR+1" => 6,
147 "ELF_VENDOR_SIZE" => 4,
148 "EXCEPTION_MAXIMUM_PARAMETERS" => 15,
149 "HW_PROFILE_GUIDLEN" => 39,
150 "IMAGE_NUMBEROF_DIRECTORY_ENTRIES" => 16,
151 "IMAGE_SIZEOF_SHORT_NAME" => 8,
153 "LF_FULLFACESIZE" => 64,
154 "MAXIMUM_SUPPORTED_EXTENSION" => 512,
155 "MAX_GOPHER_DISPLAY_TEXT + 1" => 129,
156 "MAX_GOPHER_LOCATOR_LENGTH + 1" => 654,
158 "MAX_PROFILE_LEN" => 80,
160 "OFS_MAXPATHNAME" => 128,
161 "SIZE_OF_80387_REGISTERS" => 80,
162 "TOKEN_SOURCE_LENGTH" => 8,
165 my %align_kludge_reported = ("FILETIME" => 1, "LARGE_INTEGER" => 1);
166 my %size_kludge_reported = ("FILETIME" => 1, "LARGE_INTEGER" => 1);
167 my %size_parse_reported;
169 sub _find_align_kind_size
($) {
170 my $type_name = shift;
172 local $_ = $type_name;
178 $align = $pointer_size;
180 $size = $pointer_size;
181 } elsif (/^(?:void|VOID)$/) {
189 } elsif(/^(?:(signed|unsigned)\s+)?(?:__int8|char)$/) {
191 $kind = defined($1) ?
$1 : "signed";
197 } elsif(/^(?:byte|BOOLEAN|BYTE|UCHAR)$/) {
201 } elsif (/^(?:(signed|unsigned)\s+)?(?:__int16|short(?:\s+int)?)$/) {
203 $kind = defined($1) ?
$1 : "signed";
205 } elsif (/^SHORT$/) {
209 } elsif (/^(?:char16_t|wchar_t|USHORT|WCHAR|WORD)$/) {
213 } elsif (/^(signed|unsigned)$/) {
217 } elsif (/^(?:(signed|unsigned)\s+)?(?:__int32|int)$/) {
219 $kind = defined($1) ?
$1 : "signed";
221 } elsif (/^(?:BOOL|INT|LONG)$/) {
225 } elsif (/^(?:DWORD|FOURCC|LCID|UINT|ULONG)$/) {
229 } elsif (/^(?:float|FLOAT)$/) {
233 } elsif (/^(?:(signed|unsigned)\s+)?(?:long(?:\s+int)?)$/) {
234 # 'long' is always 4 bytes on Windows.
236 $kind = defined($1) ?
$1 : "signed";
238 } elsif (/^(?:(signed|unsigned)\s+)?__int64$/) {
240 $kind = defined($1) ?
$1 : "signed";
242 } elsif (/^(?:INT64|LONG64|LONGLONG)$/) {
246 } elsif (/^(?:UINT64|ULONG64|DWORD64|ULONGLONG|DWORDLONG)$/) {
250 } elsif (/^(?:double|DOUBLE|DATE)$/) {
254 } elsif (/^(?:long\s+double)$/) {
258 } elsif (/^(?:INT|LONG)_PTR$/) {
259 $align = $pointer_size;
261 $size = $pointer_size;
262 } elsif (/^(?:UINT|MMVERSION|ULONG|DWORD)_PTR$/) {
263 $align = $pointer_size;
265 $size = $pointer_size;
266 } elsif (/^H(?:ANDLE|DC|BITMAP|BRUSH|ICON|INSTANCE|KEY|MENU|METAFILE|MMIO|TASK|WND)$/) {
267 $align = $pointer_size;
269 $size = $pointer_size;
270 } elsif (/^(?:HPSTR|LP[A-Z0-9_]+|PVOID)$/) {
271 $align = $pointer_size;
273 $size = $pointer_size;
274 } elsif (/^POINTS$/) {
278 } elsif (/^(?:FILETIME|LUID|POINT|POINTL)$/) {
282 } elsif (/^(?:CLSID|GUID|RECT|RECTL)$/) {
286 } elsif (/^(?:LARGE_INTEGER)$/) {
290 } elsif (/^(struct|union)$/) {
292 if (!$size_parse_reported{$_}) {
293 $output->write("cannot compute the size and alignment of $type_name types\n");
294 $size_parse_reported{$_} = 1;
296 } elsif (/^\w+\s*\((?:\s*CALLBACK|\s*NTAPI|\s*WINAPI)?\s*\*\s*\)\s*\(.*?\)$/) {
297 $align = $pointer_size;
299 $size = $pointer_size;
303 if (defined(my $type = $type_name2type{$pointer_size}{$_})) {
304 $align2 = $type->align;
307 if (!defined($align)) {
309 } elsif (defined($align2) && !$align_kludge_reported{$_}) {
310 $align_kludge_reported{$_} = 1;
311 $output->write("$type_name: type needn't be kludged\n");
314 if (!defined($align)) {
315 # $output->write("$type_name: can't find type\n");
319 if (defined(my $type = $type_name2type{$pointer_size}{$_})) {
320 $size2 = $type->size;
323 if (!defined($size)) {
325 } elsif (defined($size2) && !$size_kludge_reported{$_}) {
326 $size_kludge_reported{$_} = 1;
327 $output->write("$type_name: type needn't be kludged\n");
330 return ($align, $kind, $size);
334 my $type_name = shift;
335 (my $align, my $kind, my $size) = _find_align_kind_size
($type_name);
340 my $type_name = shift;
341 (my $align, my $kind, my $size) = _find_align_kind_size
($type_name);
347 my $type_name = shift;
348 (my $align, my $kind, my $size) = _find_align_kind_size
($type_name);
354 return $defines{$count};
357 foreach my $file (@files) {
359 foreach my $ptr (4, 8) {
360 $pointer_size = $ptr;
363 open(IN
, "< $wine_dir/$file") || die "Error: Can't open $wine_dir/$file: $!\n";
372 while(s/^.*?\n//) { $max_line++; }
373 if($_) { $max_line++; }
376 my $parser = new c_parser
($file);
383 my $update_output = sub {
387 $progress .= "$file (file $progress_current of $progress_max" . sprintf ", %u-bit)", $pointer_size * 8;
388 $prefix .= "$file: ";
391 $progress .= ": line $line of $max_line";
394 $output->progress($progress);
395 $output->prefix($prefix);
400 my $found_line = sub {
405 $parser->set_found_line_callback($found_line);
407 my $found_preprocessor = sub {
408 my $begin_line = shift;
409 my $begin_column = shift;
410 my $preprocessor = shift;
412 #print "found_preprocessor: $begin_line: [$_]\n";
413 if ($preprocessor =~ /^\#\s*include\s+[\"<]pshpack(\d)\.h[\">]$/) {
414 push @packs, $1 unless @ifdefs && !$ifdefs[$#ifdefs];
415 #print "found pack $1 on line $begin_line\n";
416 } elsif($preprocessor =~ /^\#\s*include\s+[\"<]poppack\.h[\">]$/) {
417 pop @packs unless @ifdefs && !$ifdefs[$#ifdefs];
418 #print "found poppack on line $begin_line\n";
419 } elsif ($preprocessor =~ /^\#\s*ifdef\s+_WIN64/) {
420 push @ifdefs, ($pointer_size == 8);
421 } elsif ($preprocessor =~ /^\#\s*ifndef\s+_WIN64/) {
422 push @ifdefs, ($pointer_size != 8);
423 } elsif ($preprocessor =~ /^\#\s*elif\s+defined\s*\(\s*_WIN64\s*\)/) {
424 $ifdefs[$#ifdefs] = ($pointer_size == 8);
425 } elsif ($preprocessor =~ /^\#\s*ifdef\s/) {
427 } elsif ($preprocessor =~ /^\#\s*ifndef\s/) {
429 } elsif ($preprocessor =~ /^\#\s*if/) {
431 } elsif ($preprocessor =~ /^\#\s*else/) {
432 $ifdefs[$#ifdefs] = $ifdefs[$#ifdefs] ^ 1;
433 } elsif ($preprocessor =~ /^\#\s*elif/) {
434 $ifdefs[$#ifdefs] = 2;
435 } elsif ($preprocessor =~ /^\#\s*endif/) {
440 $parser->set_found_preprocessor_callback($found_preprocessor);
442 my $found_type = sub {
444 return if @ifdefs && !$ifdefs[$#ifdefs];
448 my $name = $type->name;
449 $file2types{$pointer_size}{$file}{$name} = $type;
451 $type->set_find_align_callback(\
&find_align
);
452 $type->set_find_kind_callback(\
&find_kind
);
453 $type->set_find_size_callback(\
&find_size
);
454 $type->set_find_count_callback(\
&find_count
);
456 my $pack = $packs[$#packs];
457 if (!defined($type->pack) && $type->kind =~ /^(?:struct|union)$/) {
460 my $size = $type->size();
461 if (defined($size)) {
462 my $max_field_base_size = 0;
464 foreach my $field ($type->fields()) {
465 my $field_type_name = $field->type_name;
466 my $field_name = $field->name;
467 my $field_size = $field->size;
468 my $field_base_size = $field->base_size;
469 my $field_offset = $field->offset;
470 my $field_align = $field->align;
472 # $output->write("$name: $field_type_name: $field_name: $field_offset: $field_size($field_base_size): $field_align\n");
474 # $output->write("$name: $size\n");
476 $type_name2type{$pointer_size}{$name} = $type;
478 # $output->write("$name: can't find size\n");
483 $parser->set_found_type_callback($found_type);
488 if(!$parser->parse_c_file(\
$_, \
$line, \
$column)) {
489 $output->write("can't parse file\n");
497 ########################################################################
500 sub output_header
($$$) {
503 my $test_dir = shift;
504 my @tests = @
{(shift)};
506 print OUT
"/* File generated automatically from tools/winapi/tests.dat; do not edit! */\n";
507 print OUT
"/* This file can be copied, modified and distributed without restriction. */\n";
511 foreach my $test (@tests) {
512 my @description = $tests->get_section($test_dir, $test, "description");
513 foreach my $description (@description) {
514 print OUT
" * $description\n";
520 foreach my $test (@tests) {
521 my @includes = $tests->get_section($test_dir, $test, "include");
522 foreach my $include (@includes) {
523 print OUT
"#include $include\n";
527 print OUT
"#include \"wine/test.h\"\n";
530 print OUT
"/***********************************************************************\n";
531 print OUT
" * Compatibility macros\n";
534 print OUT
"#define DWORD_PTR UINT_PTR\n";
535 print OUT
"#define LONG_PTR INT_PTR\n";
536 print OUT
"#define ULONG_PTR UINT_PTR\n";
539 print OUT
"/***********************************************************************\n";
540 print OUT
" * Windows API extension\n";
543 print OUT
"#if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)\n";
544 print OUT
"# define _TYPE_ALIGNMENT(type) __alignof(type)\n";
545 print OUT
"#elif defined(__GNUC__) || defined(__clang__)\n";
546 print OUT
"# define _TYPE_ALIGNMENT(type) __alignof__(type)\n";
549 print OUT
" * FIXME: May not be possible without a compiler extension\n";
550 print OUT
" * (if type is not just a name that is, otherwise the normal\n";
551 print OUT
" * TYPE_ALIGNMENT can be used)\n";
553 print OUT
"#endif\n";
555 print OUT
"#if defined(TYPE_ALIGNMENT) && defined(_MSC_VER) && _MSC_VER >= 800 && !defined(__cplusplus)\n";
556 print OUT
"#pragma warning(disable:4116)\n";
557 print OUT
"#endif\n";
559 print OUT
"#if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT)\n";
560 print OUT
"# define TYPE_ALIGNMENT _TYPE_ALIGNMENT\n";
561 print OUT
"#endif\n";
564 print OUT
"/***********************************************************************\n";
565 print OUT
" * Test helper macros\n";
568 print OUT
"#define TEST_TYPE_SIZE(type, size) C_ASSERT(sizeof(type) == size);\n";
570 print OUT
"#ifdef TYPE_ALIGNMENT\n";
571 print OUT
"# define TEST_TYPE_ALIGN(type, align) C_ASSERT(TYPE_ALIGNMENT(type) == align);\n";
573 print OUT
"# define TEST_TYPE_ALIGN(type, align)\n";
574 print OUT
"#endif\n";
576 print OUT
"#ifdef _TYPE_ALIGNMENT\n";
577 print OUT
"# define TEST_TARGET_ALIGN(type, align) C_ASSERT(_TYPE_ALIGNMENT(*(type)0) == align);\n";
578 print OUT
"# define TEST_FIELD_ALIGN(type, field, align) C_ASSERT(_TYPE_ALIGNMENT(((type*)0)->field) == align);\n";
580 print OUT
"# define TEST_TARGET_ALIGN(type, align)\n";
581 print OUT
"# define TEST_FIELD_ALIGN(type, field, align)\n";
582 print OUT
"#endif\n";
584 print OUT
"#define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) == offset);\n";
586 print OUT
"#define TEST_TARGET_SIZE(type, size) TEST_TYPE_SIZE(*(type)0, size)\n";
587 print OUT
"#define TEST_FIELD_SIZE(type, field, size) TEST_TYPE_SIZE((((type*)0)->field), size)\n";
588 print OUT
"#define TEST_TYPE_SIGNED(type) C_ASSERT((type) -1 < 0);\n";
589 print OUT
"#define TEST_TYPE_UNSIGNED(type) C_ASSERT((type) -1 > 0);\n";
594 ########################################################################
597 sub output_footer
($$$) {
600 my $test_dir = shift;
601 my @tests = @
{(shift)};
603 print OUT
"START_TEST(generated)\n";
605 foreach my $test (@tests) {
606 print OUT
" test_$test();\n";
611 ########################################################################
612 # output_test_pack_type
614 sub output_test_pack_type
($$$$$$) {
617 my $type_name2type = shift;
618 my $type_name2optional = shift;
619 my $type_name2optional_fields = shift;
620 my $type_name = shift;
623 my $optional_fields = $$type_name2optional_fields{$type_name};
625 my $type_align = $type->align;
626 my $type_pack = $type->pack;
627 my $type_size = $type->size;
628 my $type_kind = $type->kind;
630 if (defined($type_pack)) {
631 print OUT
" /* $type_name (pack $type_pack) */\n";
633 print OUT
" /* $type_name */\n";
636 if (!scalar(keys(%$optional_fields)) && defined($type_align) && defined($type_size)) {
637 print OUT
" TEST_TYPE_SIZE ($type_name, $type_size)\n";
638 print OUT
" TEST_TYPE_ALIGN ($type_name, $type_align)\n";
641 if ($type_kind eq "float") {
643 } elsif ($type_kind eq "pointer") {
644 my $dereference_type;
645 $dereference_type = sub {
648 my @fields = $type->fields;
649 my $type_name2 =$fields[0]->type_name;
651 if ($type_name2 =~ s/\s*\*$//) {
652 my $type2 = $$type_name2type{$type_name2};
653 if (defined($type2)) {
656 if ($type_name2 !~ /^(?:PVOID|VOID|void)$/) {
657 $output->write("$type_name2: warning: type not found 1\n");
661 } elsif ($type_name2 =~ /^\w+$/) {
662 my $type2 = $$type_name2type{$type_name2};
663 if (defined($type2)) {
664 return &$dereference_type($type2);
666 $output->write("$type_name2: warning: type not found\n");
669 } elsif ($type_name2 =~ /^\w+\s*\((?:\s*CALLBACK|\s*NTAPI|\s*WINAPI)?\s*\*\s*\)\s*\(.*?\)$/) {
672 $output->write("$type_name2: warning: type can't be parsed\n");
677 my $type2 = &$dereference_type($type);
678 if (defined($type2)) {
679 my $type_name2 = $type2->name;
680 my $type_align2 = $type2->align;
681 my $type_size2 = $type2->size;
683 my $optional = $$type_name2optional{$type_name};
684 my $optional_fields2 = $$type_name2optional_fields{$type_name2};
686 if (!$optional && !scalar(keys(%$optional_fields2)) && defined($type_align2) && defined($type_size2)) {
687 print OUT
" TEST_TARGET_SIZE ($type_name, $type_size2)\n";
688 print OUT
" TEST_TARGET_ALIGN($type_name, $type_align2)\n";
690 # $output->write("$type_name: warning: type size not found\n");
693 } elsif ($type_kind eq "signed") {
694 print OUT
" TEST_TYPE_SIGNED ($type_name)\n";
695 } elsif ($type_kind eq "unsigned") {
696 print OUT
" TEST_TYPE_UNSIGNED($type_name)\n";
700 sub output_test_pack_fields
($$$$$$$);
701 sub output_test_pack_fields
($$$$$$$) {
704 my $type_name2type = shift;
705 my $type_name2optional = shift;
706 my $type_name2optional_fields = shift;
707 my $type_name = shift;
711 my $optional_fields = $$type_name2optional_fields{$type_name};
713 foreach my $field ($type->fields()) {
714 my $field_type_name = $field->type_name;
715 $field_type_name =~ s/\s+DECLSPEC_ALIGN\(\d+\)//;
716 my $field_name = $field->name;
717 my $field_size = $field->size;
718 my $field_offset = $field->offset;
719 my $field_align = $field->align;
721 next if $field_name eq "" || (defined($field_size) && $field_size < 0);
722 # We cannot take the address of a bitfield with MSVC
723 next if ($field_type_name =~ /:/);
725 if ($$optional_fields{$field_name}) {
727 } elsif (defined($field_size) && defined($field_offset)) {
728 $field_offset += $offset;
729 if ($field_name eq "DUMMYSTRUCTNAME") {
730 print OUT
"#ifdef NONAMELESSSTRUCT\n";
731 print OUT
" TEST_TYPE_SIZE ($type_name.$field_name, $field_size)\n";
732 print OUT
" TEST_FIELD_ALIGN ($type_name, $field_name, $field_align)\n";
733 print OUT
" TEST_FIELD_OFFSET($type_name, $field_name, $field_offset)\n";
735 output_test_pack_fields
(\
*OUT
, $type_name2type, $type_name2optional, $type_name2optional_fields,
736 $type_name, $$type_name2type{$field_type_name}, $field_offset);
737 print OUT
"#endif\n";
739 print OUT
" TEST_FIELD_SIZE ($type_name, $field_name, $field_size)\n";
740 print OUT
" TEST_FIELD_ALIGN ($type_name, $field_name, $field_align)\n";
741 print OUT
" TEST_FIELD_OFFSET($type_name, $field_name, $field_offset)\n";
744 # $output->write("$type_name: $field_type_name: $field_name: test not generated (offset not defined)\n");
749 ########################################################################
752 sub output_test_pack
($$$$) {
755 my $test_dir = shift;
758 my $type_names_used = shift;
760 $output->prefix("$test_dir: $test: ");
762 my @headers = $tests->get_section($test_dir, $test, "header");
763 my @type_names = $tests->get_section($test_dir, $test, "type");
765 my %type_name2optional;
766 my %type_name2optional_fields;
768 foreach my $_type_name (@type_names) {
769 my $type_name = $_type_name;
771 if ($type_name =~ s/^!//) {
772 $type_name2optional{$type_name}++;
775 my $optional_fields = {};
776 if ($type_name =~ s/:\s*(.*?)$//) {
777 my @fields = split /\s+/, $1;
778 foreach my $field (@fields) {
779 if ($field =~ s/^!//) {
780 $$optional_fields{$field}++;
785 $type_name2optional_fields{$type_name} = $optional_fields;
788 foreach my $header (@headers) {
789 my $type_name2type = $file2types{$pointer_size}{"include/$header"};
791 foreach my $_type_name (@type_names) {
792 my $type_name = $_type_name;
794 my $skip = ($type_name =~ s/^!//);
795 $type_name =~ s/:.*?$//;
796 my $type = $$type_name2type{$type_name};
797 if (!defined($type)) {
800 $$type_names_used{$type_name} = $skip ?
-1 : 1;
803 print OUT
"static void test_${test}_$type_name(void)\n";
805 output_test_pack_type
(\
*OUT
, $type_name2type, \
%type_name2optional, \
%type_name2optional_fields,
807 output_test_pack_fields
(\
*OUT
, $type_name2type, \
%type_name2optional, \
%type_name2optional_fields,
808 $type_name, $type, 0);
816 ########################################################################
819 sub output_file
($$$$) {
822 my $test_dir = shift;
823 my @tests = @
{(shift)};
825 my $type_names_used = shift;
827 output_header
(\
*OUT
, $test_dir, \
@tests);
829 foreach my $test (@tests) {
830 my %type_names_used2;
832 if ($test eq "pack") {
833 print OUT
"#ifdef _WIN64\n\n";
835 output_test_pack
(\
*OUT
, $test_dir, $test, \
%type_names_used2);
836 print OUT
"#else /* _WIN64 */\n\n";
838 output_test_pack
(\
*OUT
, $test_dir, $test, \
%type_names_used2);
839 print OUT
"#endif /* _WIN64 */\n\n";
841 die "no such test ($test)\n";
844 print OUT
"static void test_$test(void)\n";
846 foreach my $type_name (sort(keys(%type_names_used2))) {
847 $$type_names_used{$type_name} = $type_names_used2{$type_name};
848 if ($type_names_used2{$type_name} > 0) {
849 print OUT
" test_${test}_$type_name();\n";
856 output_footer
(\
*OUT
, $test_dir, \
@tests);
861 ########################################################################
864 my %type_names_used = ();
866 my @test_dirs = $tests->get_test_dirs();
867 foreach my $test_dir (@test_dirs) {
868 my $file = "$wine_dir/$test_dir/generated.c";
869 replace_file
($file, \
&output_file
, $test_dir, \
@tests, \
%type_names_used);
872 foreach my $header (sort(keys(%{$file2types{$pointer_size}}))) {
873 $output->prefix("$header: ");
874 my $type_name2type = $file2types{$pointer_size}{$header};
875 foreach my $_type_name (sort(keys(%$type_name2type))) {
876 my $type_name = $_type_name;
878 if (!exists($type_names_used{$type_name})) {
879 $output->write("$type_name: type not used\n");
884 $output->prefix("$winapi_dir/tests.dat: ");
885 foreach my $type_name (sort(keys(%type_names_used))) {
887 foreach my $header (sort(keys(%{$file2types{$pointer_size}}))) {
888 if (exists($file2types{$pointer_size}{$header}{$type_name})) {
895 $output->write("$type_name: type not used\n");