Commit 55548382 authored by Patrik Stridvall's avatar Patrik Stridvall Committed by Alexandre Julliard

Added tests for normal types (not just structures).

parent 7e18d733
......@@ -1186,8 +1186,8 @@ sub parse_c_function {
my $match;
while($self->_parse_c('(?:const|inline|extern(?:\s+\"C\")?|EXTERN_C|static|volatile|' .
'signed(?=\s+__int64\b|\s+char\b|\s+int\b|\s+long(?:\s+long)?\b|\s+short\b)|' .
'unsigned(?=\s+__int64\b|\s+char\b|\s+int\b|\s+long(?:\s+long)?\b|\s+short\b)|' .
'signed(?=\s+__int(?:8|16|32|64)\b|\s+char\b|\s+int\b|\s+long(?:\s+long)?\b|\s+short\b)|' .
'unsigned(?=\s+__int(?:8|16|32|64)\b|\s+char\b|\s+int\b|\s+long(?:\s+long)?\b|\s+short\b)|' .
'long(?=\s+double\b|\s+int\b|\s+long\b))(?=\b)',
\$_, \$line, \$column, \$match))
{
......@@ -1933,6 +1933,7 @@ sub parse_c_variable {
my $begin_column = $column + 1;
my $linkage = "";
my $sign = "";
my $type = "";
my $name = "";
......@@ -1940,14 +1941,22 @@ sub parse_c_variable {
my $match;
while($self->_parse_c('(?:const|inline|extern(?:\s+\"C\")?|EXTERN_C|static|volatile|' .
'signed(?=\s+__int64\b|\s+char\b|\s+int\b|\s+long(?:\s+long)?\b|\s+short\b)|' .
'unsigned(?=\s+__int64\b|\s+char\b|\s+int\b|\s+long(?:\s+long)?\b|\s+short\b)|' .
'signed(?=\s+__int(?:8|16|32|64)\b|\s+char\b|\s+int\b|\s+long(?:\s+long)?\b|\s+short\b)|' .
'unsigned(?=\s+__int(?:8|16|32|64)\b|\s+char\b|\s+int\b|\s+long(?:\s+long)?\b|\s+short\b)|' .
'long(?=\s+double\b|\s+int\b|\s+long\b))(?=\b)',
\$_, \$line, \$column, \$match))
{
if($match =~ /^extern|static$/) {
if(!$linkage) {
if ($match =~ /^extern|static$/) {
if (!$linkage) {
$linkage = $match;
} else {
$self->_parse_c_warning($_, $line, $column, "repeated linkage (ignored): $match");
}
} elsif ($match =~ /^signed|unsigned$/) {
if (!$sign) {
$sign = "$match ";
} else {
$self->_parse_c_warning($_, $line, $column, "repeated sign (ignored): $match");
}
}
}
......@@ -1970,8 +1979,8 @@ sub parse_c_variable {
}
$finished = 1;
} elsif(s/^((?:enum\s+|struct\s+|union\s+)?\w+(?:\s*\*)*)\s*(\w+)\s*(\[.*?\]$|:\s*(\d+)$|\{)?//s) {
$type = $1;
} elsif(s/^((?:enum\s+|struct\s+|union\s+)?\w+\b(?:\s*\*)*)\s*(\w+)\s*(\[.*?\]$|:\s*(\d+)$|\{)?//s) {
$type = "$sign$1";
$name = $2;
if (defined($3)) {
......@@ -1989,13 +1998,8 @@ sub parse_c_variable {
$type = $self->_format_c_type($type);
$finished = 1;
} elsif(s/^((?:enum\s+|struct\s+|union\s+)?\w+(?:\s*\*)*\s*\(\s*(?:\*\s*)*)(\w+)\s*(\)\(.*?\))$//s) {
$type = $self->_format_c_type("$1$3");
$name = $2;
$finished = 1;
$type = $self->_format_c_type("$1$3");
} elsif(s/^((?:enum\s+|struct\s+|union\s+)?\w+\b(?:\s*\*)*\s*\((?:\s*CALLBACK|\s*NTAPI|\s*WINAPI)?(?:\s*\*)*)\s*(\w+)\s*(\)\s*\(.*?\))$//s) {
$type = $self->_format_c_type("$sign$1$3");
$name = $2;
$finished = 1;
......
......@@ -43,6 +43,17 @@ sub set_find_align_callback {
}
########################################################################
# set_find_kind_callback
#
sub set_find_kind_callback {
my $self = shift;
my $find_kind = \${$self->{FIND_KIND}};
$$find_kind = shift;
}
########################################################################
# set_find_size_callback
#
sub set_find_size_callback {
......@@ -62,6 +73,10 @@ sub kind {
if(defined($_)) { $$kind = $_; $$dirty = 1; }
if (!defined($$kind)) {
$self->_refresh();
}
return $$kind;
}
......@@ -219,6 +234,7 @@ sub _refresh {
return if !$$dirty;
my $find_align = \${$self->{FIND_ALIGN}};
my $find_kind = \${$self->{FIND_KIND}};
my $find_size = \${$self->{FIND_SIZE}};
my $align = \${$self->{ALIGN}};
......@@ -230,6 +246,7 @@ sub _refresh {
my $field_sizes = \${$self->{FIELD_SIZES}};
my $pack = $self->pack;
$pack = 4 if !defined($pack);
my $max_field_align = 0;
......@@ -258,6 +275,10 @@ sub _refresh {
}
}
if ($$kind !~ /^(?:struct|union)$/) {
$$kind = &$$find_kind($type_name) || "";
}
if (!defined($size)) {
$$align = undef;
$$size = undef;
......
......@@ -135,6 +135,46 @@ sub get_test_dirs {
return sort(keys(%test_dirs));
}
sub get_sections {
my $self = shift;
my $tests = \%{$self->{TESTS}};
my $test_dir = shift;
my $test = shift;
my %sections = ();
if (defined($test_dir)) {
if (defined($test)) {
foreach my $section (sort(keys(%{$$tests{$test_dir}{$test}}))) {
$sections{$section}++;
}
} else {
foreach my $test (sort(keys(%{$$tests{$test_dir}}))) {
foreach my $section (sort(keys(%{$$tests{$test_dir}{$test}}))) {
$sections{$section}++;
}
}
}
} elsif (defined($test)) {
foreach my $test_dir (sort(keys(%$tests))) {
foreach my $section (sort(keys(%{$$tests{$test_dir}{$test}}))) {
$sections{$section}++;
}
}
} else {
foreach my $test_dir (sort(keys(%$tests))) {
foreach my $test (sort(keys(%{$$tests{$test_dir}}))) {
foreach my $section (sort(keys(%{$$tests{$test_dir}{$test}}))) {
$sections{$section}++;
}
}
}
}
return sort(keys(%sections));
}
sub get_section {
my $self = shift;
......@@ -144,7 +184,12 @@ sub get_section {
my $test = shift;
my $section = shift;
return @{$$tests{$test_dir}{$test}{$section}};
my $array = $$tests{$test_dir}{$test}{$section};
if (defined($array)) {
return @$array;
} else {
return ();
}
}
1;
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