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