Add function prototypes.

Modify function calls so the prototypes are checked.
This commit is contained in:
Francois Gouget 2004-10-07 18:53:56 +00:00 committed by Alexandre Julliard
parent f9d6fa9ef4
commit 493d60fe0f
10 changed files with 131 additions and 131 deletions

View file

@ -30,18 +30,18 @@ require Exporter;
use vars qw($modules);
use config qw(
&file_type &files_skip
&file_directory
&get_c_files &get_spec_files
file_type files_skip
file_directory
get_c_files get_spec_files
$current_dir $wine_dir
$winapi_check_dir
);
use options qw($options);
use output qw($output);
sub import {
sub import(@) {
$Exporter::ExportLevel++;
&Exporter::import(@_);
Exporter::import(@_);
$Exporter::ExportLevel--;
if (defined($modules)) {
@ -51,7 +51,7 @@ sub import {
$modules = 'modules'->new;
}
sub get_spec_file_type {
sub get_spec_file_type($) {
my $file = shift;
my $module;
@ -89,19 +89,7 @@ sub get_spec_file_type {
return ($type, $module);
}
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {};
bless ($self, $class);
my $spec_file_found = $self->find_spec_files();
$self->read_spec_files($spec_file_found);
return $self;
}
sub find_spec_files {
sub find_spec_files($) {
my $self = shift;
my $dir2spec_file = \%{$self->{DIR2SPEC_FILE}};
@ -128,9 +116,9 @@ sub find_spec_files {
return $spec_file_found;
}
sub read_spec_files {
sub read_spec_files($$) {
my $self = shift;
my $spec_file_found = shift;
my $dir2spec_file = \%{$self->{DIR2SPEC_FILE}};
@ -178,7 +166,19 @@ sub read_spec_files {
}
}
sub all_modules {
sub new($) {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {};
bless ($self, $class);
my $spec_file_found = $self->find_spec_files();
$self->read_spec_files($spec_file_found);
return $self;
}
sub all_modules($) {
my $self = shift;
my $module2spec_file = \%{$self->{MODULE2SPEC_FILE}};
@ -186,7 +186,7 @@ sub all_modules {
return sort(keys(%$module2spec_file));
}
sub complete_modules {
sub complete_modules($$) {
my $self = shift;
my $c_files = shift;
@ -224,7 +224,7 @@ sub complete_modules {
return @complete_modules;
}
sub is_allowed_module {
sub is_allowed_module($$) {
my $self = shift;
my $module2spec_file = \%{$self->{MODULE2SPEC_FILE}};
@ -234,7 +234,7 @@ sub is_allowed_module {
return defined($$module2spec_file{$module});
}
sub is_allowed_module_in_file {
sub is_allowed_module_in_file($$$) {
my $self = shift;
my $dir2spec_file = \%{$self->{DIR2SPEC_FILE}};
@ -260,7 +260,7 @@ sub is_allowed_module_in_file {
return 0;
}
sub allowed_modules_in_file {
sub allowed_modules_in_file($$) {
my $self = shift;
my $dir2spec_file = \%{$self->{DIR2SPEC_FILE}};
@ -283,7 +283,7 @@ sub allowed_modules_in_file {
return $module;
}
sub allowed_dirs_for_module {
sub allowed_dirs_for_module($$) {
my $self = shift;
my $module2spec_file = \%{$self->{MODULE2SPEC_FILE}};
@ -296,7 +296,7 @@ sub allowed_dirs_for_module {
return sort(keys(%{$$spec_file2dir{$spec_file}}));
}
sub allowed_spec_files16 {
sub allowed_spec_files16($) {
my $self = shift;
my $spec_files16 = \@{$self->{SPEC_FILES16}};
@ -304,7 +304,7 @@ sub allowed_spec_files16 {
return @$spec_files16;
}
sub allowed_spec_files32 {
sub allowed_spec_files32($) {
my $self = shift;
my $spec_files32 = \@{$self->{SPEC_FILES32}};
@ -312,7 +312,7 @@ sub allowed_spec_files32 {
return @$spec_files32;
}
sub found_module_in_dir {
sub found_module_in_dir($$$) {
my $self = shift;
my $module = shift;
@ -326,7 +326,7 @@ sub found_module_in_dir {
$$used_module_dirs{$module}{$dir}++;
}
sub global_report {
sub global_report($) {
my $self = shift;
my $dir2spec_file = \%{$self->{DIR2SPEC_FILE}};

View file

@ -29,13 +29,13 @@ require Exporter;
use vars qw($nativeapi);
use config qw(&file_type $current_dir $wine_dir $winapi_check_dir);
use config qw(file_type $current_dir $wine_dir $winapi_check_dir);
use options qw($options);
use output qw($output);
$nativeapi = 'nativeapi'->new;
sub new {
sub new($) {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {};
@ -153,7 +153,7 @@ sub new {
return $self;
}
sub is_function {
sub is_function($$) {
my $self = shift;
my $functions = \%{$self->{FUNCTIONS}};
@ -162,7 +162,7 @@ sub is_function {
return ($$functions{$name} || 0);
}
sub is_conditional {
sub is_conditional($$) {
my $self = shift;
my $conditionals = \%{$self->{CONDITIONALS}};
@ -171,7 +171,7 @@ sub is_conditional {
return ($$conditionals{$name} || 0);
}
sub found_conditional {
sub found_conditional($$) {
my $self = shift;
my $conditional_found = \%{$self->{CONDITIONAL_FOUND}};
@ -180,7 +180,7 @@ sub found_conditional {
$$conditional_found{$name}++;
}
sub is_conditional_header {
sub is_conditional_header($$) {
my $self = shift;
my $conditional_headers = \%{$self->{CONDITIONAL_HEADERS}};
@ -189,7 +189,7 @@ sub is_conditional_header {
return ($$conditional_headers{$name} || 0);
}
sub is_conditional_function {
sub is_conditional_function($$) {
my $self = shift;
my $conditional_functions = \%{$self->{CONDITIONAL_FUNCTIONS}};
@ -198,7 +198,7 @@ sub is_conditional_function {
return ($$conditional_functions{$name} || 0);
}
sub global_report {
sub global_report($) {
my $self = shift;
my $output = \${$self->{OUTPUT}};

View file

@ -20,7 +20,7 @@ package preprocessor;
use strict;
sub new {
sub new($) {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {};
@ -37,7 +37,7 @@ sub new {
return $self;
}
sub include {
sub include($$) {
my $self = shift;
my $include_found = \${$self->{INCLUDE_FOUND}};
@ -46,7 +46,7 @@ sub include {
&$$include_found($argument);
}
sub define {
sub define($$) {
my $self = shift;
my $state = \%{$self->{STATE}};
my $conditional_found = \${$self->{CONDITIONAL_FOUND}};
@ -58,7 +58,7 @@ sub define {
&$$conditional_found($name);
}
sub undefine {
sub undefine($$) {
my $self = shift;
my $state = \%{$self->{STATE}};
my $conditional_found = \${$self->{CONDITIONAL_FOUND}};
@ -70,7 +70,7 @@ sub undefine {
&$$conditional_found($name);
}
sub begin_if {
sub begin_if($$$) {
my $self = shift;
my $state = \%{$self->{STATE}};
my $stack = \@{$self->{STACK}};
@ -122,7 +122,7 @@ sub begin_if {
}
}
sub else_if {
sub else_if($$) {
my $self = shift;
my $state = \%{$self->{STATE}};
my $stack = \@{$self->{STACK}};
@ -136,7 +136,7 @@ sub else_if {
}
}
sub end_if {
sub end_if($) {
my $self = shift;
my $state = \%{$self->{STATE}};
my $stack = \@{$self->{STACK}};
@ -145,7 +145,7 @@ sub end_if {
delete $$state{$macro} if defined($macro);
}
sub directive {
sub directive($$$) {
my $self = shift;
my $state = \%{$self->{STATE}};
my $stack = \@{$self->{STACK}};
@ -172,7 +172,7 @@ sub directive {
}
}
sub is_def {
sub is_def($$) {
my $self = shift;
my $state = \%{$self->{STATE}};
@ -183,7 +183,7 @@ sub is_def {
return defined($status) && $status eq "def";
}
sub is_undef {
sub is_undef($$) {
my $self = shift;
my $state = \%{$self->{STATE}};
@ -194,7 +194,7 @@ sub is_undef {
return defined($status) && $status eq "undef";
}
sub is_unknown {
sub is_unknown($$) {
my $self = shift;
my $state = \%{$self->{STATE}};

View file

@ -39,7 +39,7 @@ use winapi_parser;
########################################################################
# new
#
sub new {
sub new($$) {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {};
@ -78,7 +78,7 @@ sub new {
########################################################################
# set_found_comment_callback
#
sub set_found_comment_callback {
sub set_found_comment_callback($$) {
my $self = shift;
my $found_comment = \${$self->{FOUND_COMMENT}};
@ -89,7 +89,7 @@ sub set_found_comment_callback {
########################################################################
# set_found_declaration_callback
#
sub set_found_declaration_callback {
sub set_found_declaration_callback($$) {
my $self = shift;
my $found_declaration = \${$self->{FOUND_DECLARATION}};
@ -100,7 +100,7 @@ sub set_found_declaration_callback {
########################################################################
# set_found_function_callback
#
sub set_found_function_callback {
sub set_found_function_callback($$) {
my $self = shift;
my $found_function = \${$self->{FOUND_FUNCTION}};
@ -111,7 +111,7 @@ sub set_found_function_callback {
########################################################################
# set_found_function_call_callback
#
sub set_found_function_call_callback {
sub set_found_function_call_callback($$) {
my $self = shift;
my $found_function_call = \${$self->{FOUND_FUNCTION_CALL}};
@ -122,7 +122,7 @@ sub set_found_function_call_callback {
########################################################################
# set_found_line_callback
#
sub set_found_line_callback {
sub set_found_line_callback($$) {
my $self = shift;
my $found_line = \${$self->{FOUND_LINE}};
@ -133,7 +133,7 @@ sub set_found_line_callback {
########################################################################
# set_found_preprocessor_callback
#
sub set_found_preprocessor_callback {
sub set_found_preprocessor_callback($$) {
my $self = shift;
my $found_preprocessor = \${$self->{FOUND_PREPROCESSOR}};
@ -144,7 +144,7 @@ sub set_found_preprocessor_callback {
########################################################################
# set_found_statement_callback
#
sub set_found_statement_callback {
sub set_found_statement_callback($$) {
my $self = shift;
my $found_statement = \${$self->{FOUND_STATEMENT}};
@ -155,7 +155,7 @@ sub set_found_statement_callback {
########################################################################
# set_found_type_callback
#
sub set_found_type_callback {
sub set_found_type_callback($$) {
my $self = shift;
my $found_type = \${$self->{FOUND_TYPE}};
@ -166,7 +166,7 @@ sub set_found_type_callback {
########################################################################
# set_found_variable_callback
#
sub set_found_variable_callback {
sub set_found_variable_callback($$) {
my $self = shift;
my $found_variable = \${$self->{FOUND_VARIABLE}};
@ -177,7 +177,7 @@ sub set_found_variable_callback {
########################################################################
# parse_c_file
sub parse_c_file {
sub parse_c_file($$$$) {
my $self = shift;
my $file = \${$self->{FILE}};
@ -250,7 +250,7 @@ sub parse_c_file {
my $type = shift;
};
&winapi_parser::parse_c_file($$file, {
winapi_parser::parse_c_file($$file, {
# c_comment_found => $found_c_comment,
# cplusplus_comment_found => $found_cplusplus_comment,
function_create => $_create_function,

View file

@ -35,8 +35,8 @@ BEGIN {
}
use config qw(
&files_filter &files_skip
&get_h_files
files_filter files_skip
get_h_files
$current_dir $wine_dir
);
use output qw($output);
@ -56,7 +56,7 @@ use winapi qw($win16api $win32api @winapis);
use preprocessor;
use type;
use util qw(&is_subset);
use util qw(is_subset);
use winapi_documentation;
use winapi_function;
use winapi_local;
@ -242,7 +242,7 @@ if($options->headers) {
my $argument = shift;
};
&winapi_parser::parse_c_file($file, {
winapi_parser::parse_c_file($file, {
c_comment_found => $found_c_comment,
cplusplus_comment_found => $found_cplusplus_comment,
function_create => $create_function,
@ -377,18 +377,18 @@ foreach my $file (@c_files) {
}
if($options->local && $options->argument && defined($statements)) {
&winapi_local::check_function($function);
winapi_local::check_function($function);
}
if($options->local && $options->statements && defined($statements)) {
&winapi_local::check_statements(\%functions, $function);
winapi_local::check_statements(\%functions, $function);
}
if($options->local && $options->documentation &&
(defined($module16) || defined($module32)) &&
$linkage eq "" && defined($statements))
{
&winapi_documentation::check_documentation($function);
winapi_documentation::check_documentation($function);
}
if(1) {
@ -657,7 +657,7 @@ foreach my $file (@c_files) {
}
};
&winapi_parser::parse_c_file($file, {
winapi_parser::parse_c_file($file, {
c_comment_found => $found_c_comment,
cplusplus_comment_found => $found_cplusplus_comment,
function_create => $create_function,
@ -673,13 +673,13 @@ foreach my $file (@c_files) {
}
}
&winapi_local::check_file($file, \%functions);
winapi_local::check_file($file, \%functions);
}
if($options->global) {
&winapi_global::check_modules(\%complete_module, \%module2functions);
winapi_global::check_modules(\%complete_module, \%module2functions);
if($all_modules) {
&winapi_global::check_all_modules(\%include2info);
winapi_global::check_all_modules(\%include2info);
}
}

View file

@ -31,7 +31,7 @@ my %comment_width;
my %comment_indent;
my %comment_spacing;
sub check_documentation {
sub check_documentation($) {
local $_;
my $function = shift;
@ -137,7 +137,7 @@ sub check_documentation {
} elsif ($ordinal eq "init") {
$ordinal = 0;
} else {
$output->write("documentation: $external_name (\U$module\E.$ordinal) wrong\n");
$output->write("documentation: $external_name (\U$module\E.$ordinal) wrong1\n");
next;
}
@ -165,7 +165,7 @@ sub check_documentation {
}
if (!$found && $external_name ne "DllMain" && $ordinal !~ /^0$/) {
$output->write("documentation: $external_name (\U$module\E.$ordinal) wrong\n");
$output->write("documentation: $external_name (\U$module\E.$ordinal) wrong2\n");
}
}
}
@ -220,7 +220,7 @@ sub check_documentation {
}
}
sub report_documentation {
sub report_documentation() {
if($options->documentation_comment_indent) {
foreach my $indent (sort(keys(%comment_indent))) {
my $count = $comment_indent{$indent};

View file

@ -22,7 +22,7 @@ use base qw(function);
use strict;
use config qw($current_dir $wine_dir);
use util qw(&normalize_set);
use util qw(normalize_set);
my $import = 0;
use vars qw($modules $win16api $win32api @winapis);
@ -31,7 +31,7 @@ use vars qw($modules $win16api $win32api @winapis);
# constructor
#
sub new {
sub new($) {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {};
@ -53,14 +53,14 @@ sub new {
# is_win
#
sub is_win16 { my $self = shift; return defined($self->_module($win16api, @_)); }
sub is_win32 { my $self = shift; return defined($self->_module($win32api, @_)); }
sub is_win16($) { my $self = shift; return defined($self->_module($win16api, @_)); }
sub is_win32($) { my $self = shift; return defined($self->_module($win32api, @_)); }
########################################################################
# external_name
#
sub _external_name {
sub _external_name($$) {
my $self = shift;
my $winapi = shift;
@ -89,7 +89,7 @@ sub _external_name {
return join(" & ", @external_names2);
}
sub _external_names {
sub _external_names($$) {
my $self = shift;
my $winapi = shift;
@ -102,7 +102,7 @@ sub _external_names {
}
}
sub external_name {
sub external_name($) {
my $self = shift;
foreach my $winapi (@winapis) {
@ -116,19 +116,19 @@ sub external_name {
return undef;
}
sub external_name16 { my $self = shift; return $self->_external_name($win16api, @_); }
sub external_name32 { my $self = shift; return $self->_external_name($win32api, @_); }
sub external_name16($) { my $self = shift; return $self->_external_name($win16api, @_); }
sub external_name32($) { my $self = shift; return $self->_external_name($win32api, @_); }
sub external_names16 { my $self = shift; return $self->_external_names($win16api, @_); }
sub external_names32 { my $self = shift; return $self->_external_names($win32api, @_); }
sub external_names16($) { my $self = shift; return $self->_external_names($win16api, @_); }
sub external_names32($) { my $self = shift; return $self->_external_names($win32api, @_); }
sub external_names { my $self = shift; return ($self->external_names16, $self->external_names32); }
sub external_names($) { my $self = shift; return ($self->external_names16, $self->external_names32); }
########################################################################
# module
#
sub _module {
sub _module($$) {
my $self = shift;
my $winapi = shift;
@ -154,7 +154,7 @@ sub _module {
return join(" & ", @modules);
}
sub _modules {
sub _modules($$) {
my $self = shift;
my $winapi = shift;
@ -167,21 +167,21 @@ sub _modules {
}
}
sub module16 { my $self = shift; return $self->_module($win16api, @_); }
sub module32 { my $self = shift; return $self->_module($win32api, @_); }
sub module16($) { my $self = shift; return $self->_module($win16api, @_); }
sub module32($) { my $self = shift; return $self->_module($win32api, @_); }
sub module { my $self = shift; return join (" & ", $self->modules); }
sub module($) { my $self = shift; return join (" & ", $self->modules); }
sub modules16 { my $self = shift; return $self->_modules($win16api, @_); }
sub modules32 { my $self = shift; return $self->_modules($win32api, @_); }
sub modules16($) { my $self = shift; return $self->_modules($win16api, @_); }
sub modules32($) { my $self = shift; return $self->_modules($win32api, @_); }
sub modules { my $self = shift; return ($self->modules16, $self->modules32); }
sub modules($) { my $self = shift; return ($self->modules16, $self->modules32); }
########################################################################
# ordinal
#
sub _ordinal {
sub _ordinal($$) {
my $self = shift;
my $winapi = shift;
@ -210,7 +210,7 @@ sub _ordinal {
return join(" & ", @ordinals2);
}
sub _ordinals {
sub _ordinals($$) {
my $self = shift;
my $winapi = shift;
@ -223,21 +223,21 @@ sub _ordinals {
}
}
sub ordinal16 { my $self = shift; return $self->_ordinal($win16api, @_); }
sub ordinal32 { my $self = shift; return $self->_ordinal($win32api, @_); }
sub ordinal16($) { my $self = shift; return $self->_ordinal($win16api, @_); }
sub ordinal32($) { my $self = shift; return $self->_ordinal($win32api, @_); }
sub ordinal { my $self = shift; return join (" & ", $self->ordinals); }
sub ordinal($) { my $self = shift; return join (" & ", $self->ordinals); }
sub ordinals16 { my $self = shift; return $self->_ordinals($win16api, @_); }
sub ordinals32 { my $self = shift; return $self->_ordinals($win32api, @_); }
sub ordinals16($) { my $self = shift; return $self->_ordinals($win16api, @_); }
sub ordinals32($) { my $self = shift; return $self->_ordinals($win32api, @_); }
sub ordinals { my $self = shift; return ($self->ordinals16, $self->ordinals32); }
sub ordinals($) { my $self = shift; return ($self->ordinals16, $self->ordinals32); }
########################################################################
# prefix
#
sub prefix {
sub prefix($) {
my $self = shift;
my $module16 = $self->module16;
my $module32 = $self->module32;
@ -288,7 +288,7 @@ sub prefix {
# calling_convention
#
sub calling_convention16 {
sub calling_convention16($) {
my $self = shift;
my $return_kind16 = $self->return_kind16;
@ -319,7 +319,7 @@ sub calling_convention16 {
}
}
sub calling_convention32 {
sub calling_convention32($) {
my $self = shift;
local $_ = $self->calling_convention;
@ -336,28 +336,28 @@ sub calling_convention32 {
}
}
sub get_all_module_ordinal16 {
sub get_all_module_ordinal16($) {
my $self = shift;
my $internal_name = $self->internal_name;
return winapi::get_all_module_internal_ordinal16($internal_name);
}
sub get_all_module_ordinal32 {
sub get_all_module_ordinal32($) {
my $self = shift;
my $internal_name = $self->internal_name;
return winapi::get_all_module_internal_ordinal32($internal_name);
}
sub get_all_module_ordinal {
sub get_all_module_ordinal($) {
my $self = shift;
my $internal_name = $self->internal_name;
return winapi::get_all_module_internal_ordinal($internal_name);
}
sub _return_kind {
sub _return_kind($$) {
my $self = shift;
my $winapi = shift;
my $return_type = $self->return_type;
@ -365,15 +365,15 @@ sub _return_kind {
return $winapi->translate_argument($return_type);
}
sub return_kind16 {
sub return_kind16($) {
my $self = shift; return $self->_return_kind($win16api, @_);
}
sub return_kind32 {
sub return_kind32($) {
my $self = shift; return $self->_return_kind($win32api, @_);
}
sub _argument_kinds {
sub _argument_kinds($$) {
my $self = shift;
my $winapi = shift;
my $refargument_types = $self->argument_types;
@ -396,11 +396,11 @@ sub _argument_kinds {
return [@argument_kinds];
}
sub argument_kinds16 {
sub argument_kinds16($) {
my $self = shift; return $self->_argument_kinds($win16api, @_);
}
sub argument_kinds32 {
sub argument_kinds32($) {
my $self = shift; return $self->_argument_kinds($win32api, @_);
}
@ -408,7 +408,7 @@ sub argument_kinds32 {
# Accounting
#
sub function_called {
sub function_called($$) {
my $self = shift;
my $called_function_names = \%{$self->{CALLED_FUNCTION_NAMES}};
@ -417,7 +417,7 @@ sub function_called {
$$called_function_names{$name}++;
}
sub function_called_by {
sub function_called_by($$) {
my $self = shift;
my $called_by_function_names = \%{$self->{CALLED_BY_FUNCTION_NAMES}};
@ -426,14 +426,14 @@ sub function_called_by {
$$called_by_function_names{$name}++;
}
sub called_function_names {
sub called_function_names($) {
my $self = shift;
my $called_function_names = \%{$self->{CALLED_FUNCTION_NAMES}};
return sort(keys(%$called_function_names));
}
sub called_by_function_names {
sub called_by_function_names($) {
my $self = shift;
my $called_by_function_names = \%{$self->{CALLED_BY_FUNCTION_NAMES}};

View file

@ -26,7 +26,7 @@ use options qw($options);
use output qw($output);
use winapi qw(@winapis);
sub check_modules {
sub check_modules($$) {
my $complete_module = shift;
my $module2functions = shift;
@ -67,11 +67,11 @@ sub check_modules {
}
}
sub check_all_modules {
sub check_all_modules($) {
my $include2info = shift;
&winapi_documentation::report_documentation;
winapi_documentation::report_documentation();
if($options->headers_unused && $options->include) {
foreach my $name (sort(keys(%$include2info))) {
if(!$$include2info{$name}{used}) {

View file

@ -25,7 +25,7 @@ use options qw($options);
use output qw($output);
use winapi qw($win16api $win32api @winapis);
sub check_function {
sub check_function($) {
my $function = shift;
my $return_type = $function->return_type;
@ -58,7 +58,7 @@ sub check_function {
}
}
sub _check_function {
sub _check_function($$$$$$) {
my $return_type = shift;
my $calling_convention = shift;
my $external_name = shift;
@ -289,7 +289,7 @@ sub _check_function {
}
}
sub check_statements {
sub check_statements($$) {
my $functions = shift;
my $function = shift;
@ -305,7 +305,7 @@ sub check_statements {
}
}
sub _check_statements {
sub _check_statements($$$) {
my $winapi = shift;
my $functions = shift;
my $function = shift;
@ -384,7 +384,7 @@ sub _check_statements {
}
}
sub check_file {
sub check_file($$) {
my $file = shift;
my $functions = shift;

View file

@ -23,7 +23,7 @@ use strict;
use output qw($output);
use options qw($options);
sub parse_c_file {
sub parse_c_file($$) {
my $file = shift;
my $callbacks = shift;