Commit 14fa6594 authored by Patrik Stridvall's avatar Patrik Stridvall Committed by Alexandre Julliard

- API files update.

- Fixed options --cross-call-{unicode-ascii,win32-win16}. - Minor reorganization of the global checks.
parent 1ab0ee30
...@@ -1173,8 +1173,8 @@ HANDLE ...@@ -1173,8 +1173,8 @@ HANDLE
LPCVOID LPCVOID
LPDWORD LPDWORD
LPMEMORY_BASIC_INFORMATION
LPVOID LPVOID
PMEMORY_BASIC_INFORMATION
%segptr %segptr
......
...@@ -857,7 +857,6 @@ LPFILETIME ...@@ -857,7 +857,6 @@ LPFILETIME
LPINPUT_RECORD LPINPUT_RECORD
LPLDT_ENTRY LPLDT_ENTRY
LPMEMORYSTATUS LPMEMORYSTATUS
LPMEMORY_BASIC_INFORMATION
LPMODULEENTRY32 LPMODULEENTRY32
LPOSVERSIONINFOEXA LPOSVERSIONINFOEXA
LPOSVERSIONINFOEXW LPOSVERSIONINFOEXW
...@@ -897,6 +896,7 @@ PHANDLE ...@@ -897,6 +896,7 @@ PHANDLE
PHANDLER_ROUTINE PHANDLER_ROUTINE
PLARGE_INTEGER PLARGE_INTEGER
PLONG PLONG
PMEMORY_BASIC_INFORMATION
PSIZE_T PSIZE_T
PVOID PVOID
PTIMERAPCROUTINE PTIMERAPCROUTINE
...@@ -1688,6 +1688,7 @@ double ...@@ -1688,6 +1688,7 @@ double
BOOL BOOL
BYTE BYTE
CALLCONV
CHAR CHAR
DISPID DISPID
DWORD DWORD
...@@ -1765,6 +1766,7 @@ ULONG * ...@@ -1765,6 +1766,7 @@ ULONG *
USHORT * USHORT *
VARIANT * VARIANT *
VARIANTARG * VARIANTARG *
VARIANTARG **
VARIANT_BOOL * VARIANT_BOOL *
VARTYPE * VARTYPE *
VOID * VOID *
...@@ -1987,21 +1989,26 @@ HRASCONN ...@@ -1987,21 +1989,26 @@ HRASCONN
%ptr %ptr
LPBOOL LPBOOL
LPBYTE
LPCSTR * LPCSTR *
LPCWSTR * LPCWSTR *
LPDWORD LPDWORD
LPRASAUTODIALENTRYA LPRASAUTODIALENTRYA
LPRASAUTODIALENTRYW LPRASAUTODIALENTRYW
LPRASCONNA LPRASCONNA
LPRASCONNW
LPRASDEVINFOA LPRASDEVINFOA
LPRASDEVINFOW LPRASDEVINFOW
LPRASDIALPARAMSA LPRASDIALPARAMSA
LPRASENTRYA
LPRASENTRYW
LPRASENTRYNAMEA LPRASENTRYNAMEA
LPVOID LPVOID
%str %str
LPCSTR LPCSTR
LPSTR
%wstr %wstr
......
...@@ -252,7 +252,6 @@ if($options->headers) { ...@@ -252,7 +252,6 @@ if($options->headers) {
} }
my %module2functions = (); my %module2functions = ();
my %type_found = ();
foreach my $file (@c_files) { foreach my $file (@c_files) {
my %functions = (); my %functions = ();
...@@ -350,10 +349,6 @@ foreach my $file (@c_files) { ...@@ -350,10 +349,6 @@ foreach my $file (@c_files) {
if(defined($refargument_types)) { if(defined($refargument_types)) {
push @types, @$refargument_types; push @types, @$refargument_types;
} }
for my $type (@types) {
$type_found{$module}{$type}++;
}
} }
foreach my $module ($function->modules) { foreach my $module ($function->modules) {
...@@ -663,56 +658,9 @@ foreach my $file (@c_files) { ...@@ -663,56 +658,9 @@ foreach my $file (@c_files) {
} }
if($options->global) { if($options->global) {
my @complete_modules = sort(keys(%complete_module)); &winapi_global::check_modules(\%complete_module, \%module2functions);
if($options->declared) {
foreach my $module (@complete_modules) {
foreach my $winapi (@winapis) {
if(!$winapi->is_module($module)) { next; }
my $functions = $module2functions{$module};
foreach my $internal_name ($winapi->all_internal_functions_in_module($module)) {
my $function = $functions->{$internal_name};
if(!defined($function) && !$nativeapi->is_function($internal_name) &&
!($module eq "user" && $internal_name =~
/^(?:GlobalAddAtomA|GlobalDeleteAtom|GlobalFindAtomA|
GlobalGetAtomNameA|lstrcmpiA)$/x))
{
$output->write("*.c: $module: $internal_name: " .
"function declared but not implemented or declared external\n");
}
}
}
}
}
if($options->argument && $options->argument_forbidden) {
foreach my $winapi (@winapis) {
my $types_not_used = $winapi->types_not_used;
foreach my $module (sort(keys(%$types_not_used))) {
if(!$complete_module{$module}) { next; }
foreach my $type (sort(keys(%{$$types_not_used{$module}}))) {
$output->write("*.c: $module: type ($type) not used\n");
}
}
}
}
if($all_modules) { if($all_modules) {
&winapi_documentation::report_documentation; &winapi_global::check_all_modules(\%include2info);
if($options->headers_unused) {
foreach my $name (sort(keys(%include2info))) {
if(!$include2info{$name}{used}) {
if($options->include) {
$output->write("*.c: $name: include file is never used\n");
}
}
}
}
&winapi_global::check(\%type_found);
$modules->global_report;
$nativeapi->global_report;
} }
} }
...@@ -140,6 +140,10 @@ sub _module { ...@@ -140,6 +140,10 @@ sub _module {
return undef; return undef;
} }
if(!defined($file)) {
return undef;
}
my @modules; my @modules;
foreach my $module (split(/\s*&\s*/, $module)) { foreach my $module (split(/\s*&\s*/, $module)) {
if($modules->is_allowed_module_in_file($module, "$current_dir/$file")) { if($modules->is_allowed_module_in_file($module, "$current_dir/$file")) {
......
...@@ -20,52 +20,66 @@ package winapi_global; ...@@ -20,52 +20,66 @@ package winapi_global;
use strict; use strict;
use modules qw($modules);
use nativeapi qw($nativeapi); use nativeapi qw($nativeapi);
use options qw($options); use options qw($options);
use output qw($output); use output qw($output);
use winapi qw($win16api $win32api @winapis); use winapi qw(@winapis);
sub check { sub check_modules {
my $type_found = shift; my $complete_module = shift;
my $module2functions = shift;
if($options->win16) { my @complete_modules = sort(keys(%$complete_module));
_check($win16api, $type_found);
}
if($options->win32) { if($options->declared) {
_check($win32api, $type_found); foreach my $module (@complete_modules) {
foreach my $winapi (@winapis) {
if(!$winapi->is_module($module)) { next; }
my $functions = $$module2functions{$module};
foreach my $internal_name ($winapi->all_internal_functions_in_module($module)) {
my $function = $functions->{$internal_name};
if(!defined($function) && !$nativeapi->is_function($internal_name) &&
!($module eq "user" && $internal_name =~
/^(?:GlobalAddAtomA|GlobalDeleteAtom|GlobalFindAtomA|
GlobalGetAtomNameA|lstrcmpiA)$/x))
{
$output->write("*.c: $module: $internal_name: " .
"function declared but not implemented or declared external\n");
}
}
}
}
} }
}
sub _check {
my $winapi = shift;
my $type_found = shift;
my $winver = $winapi->name; if($options->argument && $options->argument_forbidden) {
foreach my $winapi (@winapis) {
if($options->argument) { my $types_not_used = $winapi->types_not_used;
foreach my $type ($winapi->all_declared_types) { foreach my $module (sort(keys(%$types_not_used))) {
if(!$$type_found{$type} && !$winapi->is_limited_type($type) && $type ne "CONTEXT86 *") { if(!$$complete_module{$module}) { next; }
$output->write("*.c: $winver: "); foreach my $type (sort(keys(%{$$types_not_used{$module}}))) {
$output->write("type ($type) not used\n"); $output->write("*.c: $module: type ($type) not used\n");
}
} }
} }
} }
}
if($options->argument && $options->argument_forbidden) { sub check_all_modules {
my $types_used = $winapi->types_unlimited_used_in_modules; my $include2info = shift;
foreach my $type (sort(keys(%$types_used))) { &winapi_documentation::report_documentation;
$output->write("*.c: type ($type) only used in module[s] (");
my $count = 0; if($options->headers_unused && $options->include) {
foreach my $module (sort(keys(%{$$types_used{$type}}))) { foreach my $name (sort(keys(%$include2info))) {
if($count++) { $output->write(", "); } if(!$$include2info{$name}{used}) {
$output->write("$module"); $output->write("*.c: $name: include file is never used\n");
} }
$output->write(")\n");
} }
} }
$modules->global_report;
$nativeapi->global_report;
} }
1; 1;
...@@ -351,9 +351,14 @@ sub _check_statements { ...@@ -351,9 +351,14 @@ sub _check_statements {
} }
} }
} elsif($options->cross_call) { } elsif($options->cross_call) {
# $output->write("$internal_name: called $called_name\n");
$$functions{$internal_name}->function_called($called_name); $$functions{$internal_name}->function_called($called_name);
if(!defined($$functions{$called_name})) { if(!defined($$functions{$called_name})) {
$$functions{$called_name} = 'winapi_function'->new; my $called_function = 'winapi_function'->new;
$called_function->internal_name($called_name);
$$functions{$called_name} = $called_function;
} }
$$functions{$called_name}->function_called_by($internal_name); $$functions{$called_name}->function_called_by($internal_name);
} }
...@@ -370,18 +375,22 @@ sub check_file { ...@@ -370,18 +375,22 @@ sub check_file {
if($options->cross_call) { if($options->cross_call) {
my @names = sort(keys(%$functions)); my @names = sort(keys(%$functions));
for my $name (@names) { for my $name (@names) {
my @called_names = $$functions{$name}->called_function_names; my $function = $$functions{$name};
my @called_by_names = $$functions{$name}->called_by_function_names;
my $module = $$functions{$name}->module; my @called_names = $function->called_function_names;
my @called_by_names = $function->called_by_function_names;
my $module = $function->module;
if($options->cross_call_win32_win16) { if($options->cross_call_win32_win16) {
my $module16 = $$functions{$name}->module16; my $module16 = $function->module16;
my $module32 = $$functions{$name}->module32; my $module32 = $function->module32;
if($#called_names >= 0 && (defined($module16) || defined($module32)) ) { if($#called_names >= 0 && (defined($module16) || defined($module32)) ) {
for my $called_name (@called_names) { for my $called_name (@called_names) {
my $called_module16 = $$functions{$called_name}->module16; my $called_function = $$functions{$called_name};
my $called_module32 = $$functions{$called_name}->module32;
my $called_module16 = $called_function->module16;
my $called_module32 = $called_function->module32;
if(defined($module32) && if(defined($module32) &&
defined($called_module16) && !defined($called_module32) && defined($called_module16) && !defined($called_module32) &&
$name ne $called_name) $name ne $called_name)
......
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