icheck-0.9.7/0002755000175000017500000000000010273455727013461 5ustar asuffieldasuffieldicheck-0.9.7/make_tests.pl0000755000175000017500000000077410273204214016145 0ustar asuffieldasuffield#!/usr/bin/perl use strict; use 5.6.0; use warnings; use IO::Dir; use File::Spec; use POSIX; my $dirname = shift or die "No test directory supplied\n"; my $dir = new IO::Dir $dirname or die "Failed to open dir $dirname: $!\n"; my @tests; push @tests, $_ while defined($_ = $dir->read); undef $dir; @tests = grep {-d $_} map {File::Spec->catdir($dirname, $_)} grep {!/^\./ and !/~$/} @tests; foreach my $test (sort @tests) { print "Processing $test...\n"; system('./make_test.pl', $test); } icheck-0.9.7/CType.pm0000644000175000017500000001610410273455727015043 0ustar asuffieldasuffieldpackage CType; use 5.6.0; use strict; use warnings; use Carp; sub type { my $self = shift; return $self; } sub set_location { my $self = shift; my $location = shift; $self->{file} = $location->{file}; $self->{line} = $location->{line}; $self->{pos} = $location->{pos}; } sub file { my $self = shift; return $self->{file}; } sub location { my $self = shift; return '' unless $self->{file}; return "$self->{file}:$self->{line}"; } sub dump_location { my $self = shift; my $skip_cpp = shift; return '' if $skip_cpp; return '' unless $self->{file}; return "# $self->{line} \"$self->{file}\"\n"; } sub set_qualifiers { my $self = shift; my $qualifiers = shift; my %qualifiers = map {$_=>1} @$qualifiers; $self->{const} = $qualifiers{const} || 0; $self->{volatile} = $qualifiers{volatile} || 0; $self->{restrict} = $qualifiers{restrict} || 0; } sub check_sizes { my $self = shift; my $other = shift; return 'abi' unless $other->width == $self->width; return 'abi' unless $other->signed == $self->signed; return 'ok'; } sub check_qualifiers { my $self = shift; my $other = shift; if ($self->{const} != $other->{const}) { return 'both'; } if ($self->{volatile} != $other->{volatile}) { return 'abi'; } if ($self->{restrict} != $other->{restrict}) { return 'both'; } return 'ok'; } sub const { my $self = shift; return $self->{const}; } sub volatile { my $self = shift; return $self->{volatile}; } sub restrict { my $self = shift; return $self->{restrict}; } sub dump_c_qualifiers { my $self = shift; my @qualifiers; push @qualifiers, 'const' if $self->const; push @qualifiers, 'volatile' if $self->volatile; push @qualifiers, 'restrict' if $self->restrict; my @attributes; # We emit alignment expressions iff the analysis logic decided # that this object had an interesting alignment. if ($self->{alignment}) { my @alignments = $self->alignment_exprs; if (scalar @alignments) { push @attributes, map {'aligned(' . $_->dump_c . ')'} @alignments; } } if ($self->{packed}) { push @attributes, 'packed'; } if (scalar @attributes) { push @qualifiers, '__attribute__((' . join(', ', @attributes) . '))'; } return join(' ', @qualifiers); } sub describe_qualifiers { my $self = shift; my @qualifiers; push @qualifiers, 'const' if $self->const; push @qualifiers, 'volatile' if $self->volatile; push @qualifiers, 'restrict' if $self->restrict; push @qualifiers, ($self->alignment . "-bit aligned") if $self->{alignment}; return join(' ', @qualifiers); } sub width { my $self = shift; unless (defined $self->{width}) { confess "Width of type is unknown (for $self)"; } return $self->{width}; } sub alignment { my $self = shift; unless (defined $self->{alignment}) { confess "Alignment of type is unknown (for $self)"; } return $self->{alignment}; } sub signed { my $self = shift; unless (defined $self->{signed}) { confess "Signedness of type is unknown (for $self)"; } return $self->{signed}; } sub set_packed { my $self = shift; $self->{packed} = shift; } sub packed { my $self = shift; return $self->{packed}; } sub process_attributes { my $self = shift; my $attributes = shift; foreach my $attribute (@$attributes) { if ($attribute->name eq 'aligned') { if (scalar @{$attribute->args}) { if ($self->can("add_alignment")) { $self->add_alignment($attribute->args->[0]->get_expr); } else { my $arg = $attribute->args->[0]->get_expr->compute; $self->{alignment} = $arg * 8; } } else { confess "Automatic alignment is not supported"; } } } } sub capture_declarator { return 0; } sub best_type_for_comparison { my $self = shift; return $self; } sub check_interface { my $self = shift; my $other = shift; my ($self_type, $other_type); if ($self->isa('CType::Ref') and $other->isa('CType::Ref') and $self->kind eq $other->kind and $self->name eq $other->name) { # These are strictly matching references, so we'll not bother # looking through them $self_type = $self; $other_type = $other; } else { # Anything else, we look through just to be sure we know # what's going on $self_type = $self->best_type_for_comparison; $other_type = $other->best_type_for_comparison; } my @ret = $self_type->_check_interface($other_type); my $ret = {}; my ($local_api, $local_abi); foreach (@ret) { if (ref $_) { foreach my $key (keys %$_) { $ret->{$key} = 1 if $_->{$key}; } } elsif ($_ eq 'ok') { } elsif ($_ eq 'abi') { $ret->{abi_forward} = 1; $ret->{abi_backward} = 1; $local_abi = 1; } elsif ($_ eq 'api') { $ret->{api_forward} = 1; $ret->{api_backward} = 1; $local_api = 1; } elsif ($_ eq 'both') { $ret->{abi_forward} = 1; $ret->{abi_backward} = 1; $ret->{api_forward} = 1; $ret->{api_backward} = 1; $local_abi = 1; $local_api = 1; } } if ($local_abi and $local_api) { print "ABI and API mismatch between:\n"; my $dump = $self_type->dump_c(1); $dump =~ s/\n?$/\n/; $dump =~ s/^/ /mg; print $dump; print "and:\n"; my $other_dump = $other_type->dump_c(1); $other_dump =~ s/\n?$/\n/; $other_dump =~ s/^/ /mg; print $other_dump; } elsif ($local_abi) { print "ABI mismatch between:\n"; my $dump = $self_type->dump_c(1); $dump =~ s/\n?$/\n/; $dump =~ s/^/ /mg; print $dump; print "and:\n"; my $other_dump = $other_type->dump_c(1); $other_dump =~ s/\n?$/\n/; $other_dump =~ s/^/ /mg; print $other_dump; } elsif ($local_api) { print "API mismatch between:\n"; my $dump = $self_type->dump_c(1); $dump =~ s/\n?$/\n/; $dump =~ s/^/ /mg; print $dump; print "and:\n"; my $other_dump = $other_type->dump_c(1); $other_dump =~ s/\n?$/\n/; $other_dump =~ s/^/ /mg; print $other_dump; } return $ret; } sub complete { 1; } 1; icheck-0.9.7/CDecl/0000755000175000017500000000000010273204213014407 5ustar asuffieldasuffieldicheck-0.9.7/CDecl/.arch-ids/0000755000175000017500000000000010273204213016157 5ustar asuffieldasuffieldicheck-0.9.7/CDecl/.arch-ids/=id0000644000175000017500000000010710273204213016571 0ustar asuffieldasuffieldAndrew Suffield Sun Mar 13 05:29:19 2005 7691.0 icheck-0.9.7/CDecl/.arch-ids/Enumerator.pm.id0000644000175000017500000000010710273204213021227 0ustar asuffieldasuffieldAndrew Suffield Sun Mar 13 05:29:19 2005 7691.1 icheck-0.9.7/CDecl/Enumerator.pm0000644000175000017500000000227510273204213017074 0ustar asuffieldasuffieldpackage CDecl::Enumerator; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $class = ref($this) || $this; my $enum = shift; my $name = shift; my $self = {enum => $enum, name => $name, }; bless $self, $class; return $self; } sub identifier { my $self = shift; return $self->{name}; } sub enum { my $self = shift; return $self->{enum}; } sub value { my $self = shift; return $self->enum->get_value($self->{name}); } sub file { my $self = shift; return $self->enum->{file}; } sub location { my $self = shift; return '' unless $self->enum->{file}; return $self->enum->{file} . ':' . $self->enum->{line}; } sub describe_name { my $self = shift; return "enumerator $self->{name}"; } sub dump_c { my $self = shift; my $skip_cpp = shift; return $self->{name}; } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; } sub describe { my $self = shift; return "enumerator $self->{name}"; } sub get_refs { my $self = shift; return $self->value->get_refs; } 1; icheck-0.9.7/LICENSE0000644000175000017500000000152710273204214014450 0ustar asuffieldasuffieldThis is icheck, a C interface checker Copyright (C) Andrew Suffield Additional copyrights may be owned by other people; see the list of authors for full details. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2 only. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -- You should have received a copy of both the GNU General Public License and the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA icheck-0.9.7/make_test.pl0000755000175000017500000001163110273204214015754 0ustar asuffieldasuffield#!/usr/bin/perl use strict; use 5.6.0; use warnings; use File::Spec; use POSIX; use Text::Diff; use File::Find; use IO::Handle; use IPC::Open3; use IO::File; my $test = shift or die "No test supplied\n"; -d $test or die "No such directory $test\n"; my $args = File::Spec->catfile($test, 'args'); my $args_canonify = File::Spec->catfile($test, 'args.canonify'); my $args_compare = File::Spec->catfile($test, 'args.compare'); my $baseline = File::Spec->catfile($test, 'baseline'); my $canonical = File::Spec->catfile($test, 'canonical'); my $errors_canonify = File::Spec->catfile($test, 'errors.canonify'); my $errors_compare = File::Spec->catfile($test, 'errors.compare'); my $original = File::Spec->catfile($test, 'original'); my $result_canonify = File::Spec->catfile($test, 'result.canonify'); my $result_compare = File::Spec->catfile($test, 'result.compare'); my $source = File::Spec->catfile($test, 'source'); my $diff = File::Spec->catfile($test, 'diff'); my @sources; if (-d $source) { find(sub {return $File::Find::prune = 1 if /^\../ or /~$/; push @sources, $File::Find::name if -f $_}, $source); } elsif (-f $source) { push @sources, $source; } else { undef $source; } undef $args unless -f $args; undef $args_canonify unless -f $args_canonify; undef $args_compare unless -f $args_compare; undef $baseline unless -f $baseline; undef $original unless -f $original; my $canonify = 0; $canonify = 1 if $source and not -f $canonical; my $compare = 0; $compare = 1 if $original and ($canonical or $canonify) and not -f $diff; my $canonical_data; if ($canonify) { my @args; if ($args_canonify) { my $fh = new IO::File $args_canonify, 'r'; while (<$fh>) {chomp; push @args, $_} } elsif ($args) { my $fh = new IO::File $args, 'r'; while (<$fh>) {chomp; push @args, $_} } my $canonify_output = ""; my $canonify_errors = ""; my $canonify_result; { my ($write, $read, $err) = (new IO::Handle, new IO::Handle, new IO::Handle); my $pid = open3($write, $read, $err, './icheck', '--canonify', $baseline ? ('--baseline', $baseline) : (), @sources, @args); close $write; $canonify_output .= $_ while <$read>; close $read; $canonify_errors .= $_ while <$err>; close $err; waitpid $pid, 0; if (WIFSIGNALED($?)) { die "icheck killed by signal " . WTERMSIG($?) . "\n"; } unless (WIFEXITED($?)) { die "icheck died wierdly (waitpid gave $?)\n"; } $canonify_result = WEXITSTATUS($?); } if (not -f $errors_canonify and $canonify_errors) { print "Had errors when canonifying\n"; my $fh = new IO::File $errors_canonify, 'w'; print $fh $canonify_errors; } if (not -f $result_canonify and $canonify_result) { print "Had non-zero result when canonifying\n"; my $fh = new IO::File $result_canonify, 'w'; print $fh "$canonify_result\n"; } print "Generated canonical output\n"; my $fh = new IO::File $canonical, 'w'; print $fh $canonify_output; } if ($compare) { my @args; if ($args_compare) { my $fh = new IO::File $args_compare, 'r'; while (<$fh>) {chomp; push @args, $_} } elsif ($args) { my $fh = new IO::File $args, 'r'; while (<$fh>) {chomp; push @args, $_} } my $compare_output = ""; my $compare_errors = ""; my $compare_result; { my ($write, $read, $err) = (new IO::Handle, new IO::Handle, new IO::Handle); my @cmd = ('./icheck', '--compare', $original, $canonical ? $canonical : '-', @args); if ($ENV{TEST_VERBOSE}) { print join(' ', @cmd) . "\n"; } my $pid = open3($write, $read, $err, @cmd); if (not $canonical) { print $write $canonical_data; } close $write; $compare_output .= $_ while <$read>; close $read; $compare_errors .= $_ while <$err>; close $err; waitpid $pid, 0; if (WIFSIGNALED($?)) { die "icheck killed by signal " . WTERMSIG($?) . "\n"; } unless (WIFEXITED($?)) { die "icheck died wierdly (waitpid gave $?)\n"; } $compare_result = WEXITSTATUS($?); } if (not -f $errors_compare and $compare_errors) { print "Had errors when compareing\n"; my $fh = new IO::File $errors_compare, 'w'; print $fh $compare_errors; } if (not -f $result_compare and $compare_result) { print "Had non-zero result when compareing\n"; my $fh = new IO::File $result_compare, 'w'; print $fh "$compare_result\n"; } print "Generated diff output\n"; my $fh = new IO::File $diff, 'w'; print $fh $compare_output; } exit 0; icheck-0.9.7/CExpr.pm0000644000175000017500000000007110273204213015012 0ustar asuffieldasuffieldpackage CExpr; use 5.6.0; use strict; use warnings; 1; icheck-0.9.7/.arch-ids/0000755000175000017500000000000010273204251015207 5ustar asuffieldasuffieldicheck-0.9.7/.arch-ids/CExpr.pm.id0000644000175000017500000000011010273204213017147 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:20 2005 28700.2 icheck-0.9.7/.arch-ids/README.id0000644000175000017500000000011010273204213016450 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 19 15:44:32 2005 15761.3 icheck-0.9.7/.arch-ids/LICENSE.id0000644000175000017500000000011010273204213016575 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 19 15:44:32 2005 15761.1 icheck-0.9.7/.arch-ids/CType.pm.id0000644000175000017500000000011010273204213017152 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:20 2005 28700.6 icheck-0.9.7/.arch-ids/make_test.pl.id0000644000175000017500000000011010273204213020101 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:15:21 2005 13069.0 icheck-0.9.7/.arch-ids/.arch-inventory.id0000644000175000017500000000011010273204213020541 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:48:14 2005 28777.0 icheck-0.9.7/.arch-ids/make_tests.pl.id0000644000175000017500000000011010273204213020264 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:15:21 2005 13069.1 icheck-0.9.7/.arch-ids/ChangeLog.id0000644000175000017500000000010610273204213017347 0ustar asuffieldasuffieldautomatic-ChangeLog--asuffield@debian.org--gluck-2005/icheck--main--0 icheck-0.9.7/.arch-ids/icheck.1.id0000644000175000017500000000011010273204213017100 0ustar asuffieldasuffieldAndrew Suffield Wed Jul 6 19:45:24 2005 25816.0 icheck-0.9.7/.arch-ids/typegen.pl.id0000644000175000017500000000011110273204213017601 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:20 2005 28700.13 icheck-0.9.7/.arch-ids/CParse.pm.id0000644000175000017500000000011010273204213017303 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:20 2005 28700.4 icheck-0.9.7/.arch-ids/test.pl.id0000644000175000017500000000011110273204213017105 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:15:21 2005 13069.17 icheck-0.9.7/.arch-ids/CDecl.pm.id0000644000175000017500000000011010273204213017100 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:20 2005 28700.0 icheck-0.9.7/.arch-ids/NEWS.id0000644000175000017500000000011010273204213016267 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 19 15:44:32 2005 15761.2 icheck-0.9.7/.arch-ids/Makefile.id0000644000175000017500000000011010273204213017230 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:20 2005 28700.7 icheck-0.9.7/.arch-ids/icheck.id0000644000175000017500000000011010273204213016741 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:20 2005 28700.9 icheck-0.9.7/.arch-ids/run_test.pl.id0000644000175000017500000000011010273204213017770 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:15:21 2005 13069.2 icheck-0.9.7/.arch-ids/test_xsub.pl.id0000644000175000017500000000010710273204251020155 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 31 02:58:44 2005 6874.0 icheck-0.9.7/.arch-ids/COPYING.id0000644000175000017500000000011010273204213016623 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 19 15:44:32 2005 15761.0 icheck-0.9.7/icheck.10000644000175000017500000001465610273204214014762 0ustar asuffieldasuffield.TH icheck 1 .SH NAME icheck \- C interface ABI/API checker .SH SYNOPSIS .I icheck .B --canonify [[\fB\-\-baseline\fR \fBFILE\fR] ...] [\fBOPTIONS\fR] [\fBGCC_OPTIONS\fR] [\-\-] .B files .PP .I icheck .B \-\-compare [\fBOPTIONS\fR] .B old_file .B new_file .SH DESCRIPTION A tool for statically checking C interfaces for API and ABI changes. All changes to type declarations that can cause ABI changes should be detected, along with most API changes. .PP icheck is intended for use with libraries, as a method of preventing ABI drift. .SH COMMANDS Reduce a set of source files to a canonical interface file with \-\-canonify, then compare two such interface files with \-\-compare. If there are interface changes between them, icheck will describe the changes and fail. .PP .B --canonify [[\fB\-\-baseline\fR \fBFILE\fR] ...] [\fBOPTIONS\fR] [\fBGCC_OPTIONS\fR] [\-\-] .B files .PP .RS Canonify the source code files (typically .h headers) to be compared later with \fB\-\-compare\fR. Usually used with the \fB\-o\fR option to save the summary to a file. .RE .PP .B \-\-compare [\fBOPTIONS\fR] .B old_file .B new_file .PP .RS Reads two canonical interface files generated with \fB\-\-canonify\fR and compares the structure of the source code to the changes in the Application Public Interface (the developer interface or API) and the Application Binary Interface (ABI) used to link against other programs or libraries. .RE .SH OPTIONS .SS "ICHECK OPTIONS" \fB\-o\fR, \fB\-\-output\fR \fBFILE\fR .PP .RS Emit output to FILE, rather than stdout. .RE .PP \fB\-\-debug\fR \fBN\fR .PP .RS Dump debugging information. .RE .PP \fB\-\-only\fR \fBTHING\fR .PP .RS Only process the given THING. .RE .PP \fB\-\-skip\-from\fR \fBFILE\fR .PP .RS Skip unnecessary things from \fBFILE\fR. .RE .PP \fB\-\-skip\-from\-re\fR \fBregexp\fR .PP .RS Skip unnecessary things from files matching the regular expression. .RE .PP \fB\-\-only\-from\fR \fBFILE\fR .PP .RS Only take things from \fBFILE\fR. .RE .PP \fB\-\-only\-from\-re\fR \fBregexp\fR .PP .RS Only take things from files matching the regular expression. .RE .PP \fBGCC_OPTIONS\fR .PP .RS GCC_OPTIONS are passed through to gcc \-E .RE .SS "HELP OPTIONS" \fB\-\-help\fR .RS Display the help synopsis for \fIicheck\fR. .RE .SH EXAMPLES All source files are preprocessed with gcc, so canonify needs the same include information as the source code \- follow the syntax from the Makefile to include \-I options to \fBcpp\fR (or \fBgcc\fR) so that all necessary headers can be located. \fBicheck\fR will abort if any required headers cannot be found. The source must be compileable; icheck cannot process files which cannot be directly compiled. If a header is missing #include statements, or otherwise requires being used in a special way, then it cannot be directly processed with icheck. Instead, write a stub C file that sets things up appropriately and then #includes the header. .PP .I icheck .B \-\-canonify \fB\-o\fR \fB~/icheck/oldversion\fR .B \-I/usr/include/foo\-2.0 .B /usr/src/bar/src/foobar.h .PP Prepare a text summary of the foobar.h file and all files it includes. The summary is written out to \fB~/icheck/oldversion\fR. Repeat for \fB/usr/src/bar1/src/foobar.h\fR \- the same file in the newer source directory, outputting to a new file, e.g. \fB~/icheck/newversion\fR. .PP \fIicheck\fR .B \-\-compare \fB\-o\fR \fB~/icheck/results.txt\fR .B ~/icheck/oldversion .B ~/icheck/newversion .PP Writes the report of the comparison of the two summary files. The report indicates all the changes in the ABI and/or API found during the comparison. .PP .I icheck .B \-\-canonify \fB\-o\fR \fBdebian/icheck.canonical\fR .B \-Idebian/foo-dev/usr/include .B debian/foo-dev/usr/include/foobar.h .PP .I icheck .B \-\-compare .B debian/icheck.manifest .B debian/icheck.canonical .PP These two statements, included in a \fBdebian/rules\fR file, will cause the package build to fail if the API or ABI has changed in unexpected ways, where icheck.manifest is a copy of the expected interface, included in the package. .PP Note that the arguments to --compare are themselves valid C files which are preprocessed, so icheck.manifest can contain C preprocessor logic. This can be useful when a package exports different interfaces depending on the host architecture. In this case, you can't replace it with a new copy of icheck.canonical when the interface changes and you need to update the manifest. Rather than updating the entire manifest by hand, put the hand-written interface descriptions in one file (\fBicheck.static-manifest\fR) and then use: .PP .I icheck .B \-\-canonify \fB\-\-baseline\fR \fBdebian/icheck.static-manifest\fR \fB\-o\fR \fBdebian/icheck.dynamic-manifest\fR .PP Lastly, create icheck.manifest containing: .nf #include "icheck.static-manifest" #include "icheck.dynamic-manifest" .fi This allows you to update some parts of the manifest by hand, while still automatically generating the rest. .SH OUTPUT icheck generates a lengthly description of every possible API or ABI change, based on type information. It does not investigate the actual program code, and so it is possible that some type changes it detects are not actual ABI or API changes. However, this normally only happens when the program code was explicitly written for it. If in doubt, assume it's changed. .PP At the end, icheck provides a summary of the changes. Note that the directions here are dependent on the order of the arguments to --compare: the older interface must come first, or the directions will be the other way around. The meanings of the various terms are as follows: .RS .IP ABI The ABI is compatible if things compiled against one version of the interface will work when run using the other version. .IP API The API is compatible if things compiled against one version of the interface can be compiled against the other. .IP forwards-compatible An interface is forwards-compatible if things compiled against the old version will work with the new. This is the important feature for \fBsoname\fR changes. .IP backwards-compatible An interface is backwards-compatible if things compiled against the new version will work with the old. This is the important feature for \fBshlibs version\fR changes. If you aren't building Debian packages, you probably don't care about changes which aren't backwards-compatible. .RE .SH AUTHOR \fIicheck\fR was written by Andrew Suffield . .PP This manual page was written by Neil Williams and Andrew Suffield . icheck-0.9.7/README0000644000175000017500000000161610273204214014322 0ustar asuffieldasuffieldBasic usage looks like this: icheck --canonify -o foo.ic foo/a.h foo/b.h foo/c.h Then store foo.ic, and later compare it with: icheck --compare foo_old.ic foo_new.ic This will report on all changes to the API and ABI between foo_old.ic and foo_new.ic. Report bugs to . Limitations ----------- There is no support for C++. Only the type interface is checked. Logical ABI changes, such as changes to the meaning of function parameters, on-disk file formats, or other changes to the behaviour, are outside the scope of icheck (and probably aren't computable). icheck cannot tell the difference between significant and insignificant interface changes. It is perfectly possible to write the actual code such that the interface change is not an issue. It is your job, as the person reading the output, to make this distinction; icheck merely points out the things you *need* to check. icheck-0.9.7/ext/0000755000175000017500000000000010273204251014237 5ustar asuffieldasuffieldicheck-0.9.7/ext/.arch-ids/0000755000175000017500000000000010273204251016007 5ustar asuffieldasuffieldicheck-0.9.7/ext/.arch-ids/=id0000644000175000017500000000010710273204251016421 0ustar asuffieldasuffieldAndrew Suffield Sat Jul 23 15:30:26 2005 2562.0 icheck-0.9.7/ext/CParse-Parser-PerlXS/0000755000175000017500000000000010273204251020021 5ustar asuffieldasuffieldicheck-0.9.7/ext/CParse-Parser-PerlXS/.arch-ids/0000755000175000017500000000000010273204251021571 5ustar asuffieldasuffieldicheck-0.9.7/ext/CParse-Parser-PerlXS/.arch-ids/.arch-inventory.id0000644000175000017500000000010710273204251025133 0ustar asuffieldasuffieldAndrew Suffield Sat Jul 23 15:30:26 2005 2562.2 icheck-0.9.7/ext/CParse-Parser-PerlXS/.arch-ids/PerlXS.pm.id0000644000175000017500000000010710273204251023675 0ustar asuffieldasuffieldAndrew Suffield Sat Jul 23 15:30:26 2005 2562.4 icheck-0.9.7/ext/CParse-Parser-PerlXS/.arch-ids/Makefile.PL.id0000644000175000017500000000010710273204251024134 0ustar asuffieldasuffieldAndrew Suffield Sat Jul 23 15:30:26 2005 2562.3 icheck-0.9.7/ext/CParse-Parser-PerlXS/.arch-ids/PerlXS.xs.id0000644000175000017500000000010710273204251023713 0ustar asuffieldasuffieldAndrew Suffield Sat Jul 23 15:30:26 2005 2562.5 icheck-0.9.7/ext/CParse-Parser-PerlXS/.arch-ids/=id0000644000175000017500000000010710273204251022203 0ustar asuffieldasuffieldAndrew Suffield Sat Jul 23 15:30:26 2005 2562.1 icheck-0.9.7/ext/CParse-Parser-PerlXS/PerlXS.xs0000644000175000017500000015616710273204251021572 0ustar asuffieldasuffield#include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include #include =pod static void data_dumper (SV *sv) { dSP; PUSHMARK(SP); XPUSHs(sv); PUTBACK; SV *cvrv = eval_pv("sub {use Data::Dumper; print Dumper($_[0])}", TRUE); call_sv(cvrv, G_VOID); } =cut static void retry_tokens (SV *self, AV *tokens) { int i; dSP; PUSHMARK(SP); XPUSHs(self); if (tokens) { int l = av_len(tokens); for (i = 0; i <= l; i++) { SV **token = av_fetch(tokens, i, 0); XPUSHs(*token); } } PUTBACK; call_method("retry_tokens", G_DISCARD); } static void syntax_error (SV *self, char *thing) { dSP; PUSHMARK(SP); XPUSHs(self); XPUSHs(sv_2mortal(newSVpv(thing, 0))); PUTBACK; call_method("syntax_error", G_DISCARD); } static bool commit = false; static AV * try_parse_setup (SV *self) { SV **trying_tokens = hv_fetch((HV *)SvRV(self), "trying_tokens", strlen("trying_tokens"), 0); AV *old_trying_tokens = (AV *)SvRV(*trying_tokens); /* Keep this for later - we'll put it back into the hash */ SvREFCNT_inc((SV *)old_trying_tokens); SV *new_trying_tokens = newRV_noinc((SV *)newAV()); hv_store((HV *)SvRV(self), "trying_tokens", strlen("trying_tokens"), new_trying_tokens, 0); return old_trying_tokens; } static void try_parse_cleanup (SV *self, char *thing, SV *parsed, AV *old_trying_tokens) { if (parsed) { int i; SV **trying_tokens = hv_fetch((HV *)SvRV(self), "trying_tokens", strlen("trying_tokens"), 0); AV *new_tokens = (AV *)SvRV(*trying_tokens); for (i = 0; i <= av_len(new_tokens); i++) { SV **token = av_fetch(new_tokens, i, 0); SvREFCNT_inc(*token); av_push(old_trying_tokens, *token); } hv_store((HV *)SvRV(self), "trying_tokens", strlen("trying_tokens"), newRV_noinc((SV *)old_trying_tokens), 0); } else { if (commit) { syntax_error(self, thing); hv_store((HV *)SvRV(self), "skip_errors", strlen("skip_errors"), newSViv(1), 0); } SV **trying_tokens = hv_fetch((HV *)SvRV(self), "trying_tokens", strlen("trying_tokens"), 0); retry_tokens(self, (AV *)SvRV(*trying_tokens)); hv_store((HV *)SvRV(self), "trying_tokens", strlen("trying_tokens"), newRV_noinc((SV *)old_trying_tokens), 0); } } #define try_parse(self, thing, ...) ({ \ bool old_commit = commit; \ commit = false; \ AV *old_trying_tokens = try_parse_setup(self); \ SV *parsed = try_ ## thing (self, ##__VA_ARGS__); \ try_parse_cleanup(self, #thing, parsed, old_trying_tokens); \ commit = old_commit; \ parsed; }) #define try_op_list_(self, thing, end, op, ...) ({ \ SV *arg1 = try_parse(self, thing); \ AV *av = NULL; \ SV *res = NULL; \ if (arg1) \ { \ av = newAV(); \ SvREFCNT_inc(arg1); \ av_push(av, arg1); \ while (1) \ { \ if (end) \ { \ if (try_parse(self, punctuator, end)) \ break; \ \ SV *operand = try_parse(self, op, ##__VA_ARGS__); \ if (!operand) \ { \ SvREFCNT_dec(av); \ av = NULL; \ break; \ } \ SvREFCNT_inc(operand); \ av_push(av, operand); \ } \ else \ { \ SV *operand = try_parse(self, op, ##__VA_ARGS__); \ if (!operand) \ break; \ SvREFCNT_inc(operand); \ av_push(av, operand); \ } \ \ SV *arg = try_parse(self, thing); \ if (!arg) \ { \ SvREFCNT_dec(av); \ av = NULL; \ break; \ } \ SvREFCNT_inc(arg); \ av_push(av, arg); \ } \ if (av) \ { \ SV *ref = newRV_noinc((SV *)av); \ res = ref; \ } \ } \ res;}) #define try_op_list(self, thing, end, op, ...) ({ \ bool old_commit = commit; \ AV *old_trying_tokens = try_parse_setup(self); \ SV *parsed = try_op_list_(self, thing, end, op, ##__VA_ARGS__); \ try_parse_cleanup(self, #thing, parsed, old_trying_tokens); \ commit = old_commit; \ parsed; }) static SV * new_obj4 (char *class, SV *arg1, SV *arg2, SV *arg3, SV *arg4) { dSP; PUSHMARK(SP); XPUSHs(sv_2mortal(newSVpv(class, 0))); if (arg1) XPUSHs(arg1); if (arg2) XPUSHs(arg2); if (arg3) XPUSHs(arg3); if (arg4) XPUSHs(arg4); PUTBACK; int count = call_method("new", G_SCALAR); if (count != 1) croak("Bad return count from new"); SPAGAIN; SV *obj = POPs; if (!SvOK(obj)) return NULL; else return obj; } #define new_obj(class, arg1) new_obj4(class, arg1, NULL, NULL, NULL) #define new_obj2(class, arg1, arg2) new_obj4(class, arg1, arg2, NULL, NULL) #define new_obj3(class, arg1, arg2, arg3) new_obj4(class, arg1, arg2, arg3, NULL) static SV *try_logical_or_expression(SV *self); static SV *try_unary_expression(SV *self); static SV *try_type_name(SV *self); static SV *try_declarator(SV *self); static SV *try_abstract_declarator(SV *self); static SV *try_assignment_expression(SV *self); static SV *try_designated_initialiser (SV *self); static SV *try_cast_expression (SV *self); static SV *try_type_specifier(SV *self); static SV *try_statement(SV *self); static SV *try_compound_statement(SV *self); static SV * try_token (SV *self) { dSP; PUSHMARK(SP); XPUSHs(self); PUTBACK; int count = call_method("try_token", G_SCALAR); if (count != 1) croak("Bad return count from try_token"); SPAGAIN; SV *token = POPs; if (!SvOK(token)) return NULL; else return token; } static SV * get_string (SV *token) { dSP; PUSHMARK(SP); XPUSHs(token); PUTBACK; int count = call_method("string", G_SCALAR); if (count != 1) croak("Bad result count"); SPAGAIN; SV *string = POPs; return string; } static bool check_string (SV *token, char *name) { if (!name) return true; SV *token_string_sv = get_string(token); if (!SvOK(token_string_sv)) croak("Bad result value"); char *token_string = SvPV_nolen(token_string_sv); return strcmp(name, token_string) == 0; } static SV * try_identifier (SV *self) { SV *token = try_token(self); if (!token) return NULL; if (!sv_derived_from(token, "CParse::Parser::Token::Identifier")) return NULL; return token; } static SV * try_keyword (SV *self, char *name) { SV *token = try_token(self); if (!token) return NULL; if (!sv_derived_from(token, "CParse::Parser::Token::Keyword")) return NULL; if (!check_string(token, name)) return NULL; return token; } static SV * try_punctuator (SV *self, char *name) { SV *token = try_token(self); if (!token) return NULL; if (!sv_derived_from(token, "CParse::Parser::Token::Punctuator")) return NULL; if (!check_string(token, name)) return NULL; return token; } static SV * try_integer_constant (SV *self) { SV *token = try_token(self); if (!token) return NULL; if (!sv_derived_from(token, "CParse::Parser::Token::Integer")) return NULL; return token; } static SV * try_floating_constant (SV *self) { SV *token = try_token(self); if (!token) return NULL; if (!sv_derived_from(token, "CParse::Parser::Token::Float")) return NULL; return token; } static SV * try_character_constant (SV *self) { SV *token = try_token(self); if (!token) return NULL; if (!sv_derived_from(token, "CParse::Parser::Token::Character")) return NULL; return token; } static SV * try_one_string_literal (SV *self) { SV *token = try_token(self); if (!token) return NULL; if (!sv_derived_from(token, "CParse::Parser::Token::String")) return NULL; return token; } static void concatenate (SV *str, SV *tail) { dSP; PUSHMARK(SP); XPUSHs(str); XPUSHs(tail); PUTBACK; call_method("concatenate", G_DISCARD); } static SV * try_string_literal (SV *self) { SV *str = try_parse(self, one_string_literal); if (!SvTRUE(str)) return NULL; SV *next; while ((next = try_parse(self, one_string_literal))) { concatenate(str, next); } return str; } static void push_arrayref(AV *dest, SV *source) { int i; AV *list = (AV *)SvRV(source); for (i = 0; i <= av_len(list); i++) { SV **elem = av_fetch(list, i, 0); SvREFCNT_inc(*elem); av_push(dest, *elem); } } static SV * process (SV *token) { dSP; PUSHMARK(SP); XPUSHs(token); PUTBACK; int count = call_method("process", G_SCALAR); if (count != 1) croak("Bad result count"); SPAGAIN; SV *obj = POPs; return obj; } static SV * try_attribute_name (SV *self) { SV *keyword = try_parse(self, keyword, NULL); if (keyword) return get_string(keyword); SV *identifier = try_parse(self, identifier); if (identifier) return get_string(identifier); return NULL; } static SV * try_attribute (SV *self) { SV *name = try_parse(self, attribute_name); if (!name) return NULL; AV *args = newAV(); if (try_parse(self, punctuator, "(")) { if (!try_parse(self, punctuator, ")")) { SV *identifier = try_parse(self, identifier); if (identifier) { av_push(args, process(identifier)); SV *p = try_parse(self, punctuator, NULL); char *pstr = SvPV_nolen(get_string(p)); if (strcmp(pstr, ",") == 0) { SV *list = try_op_list(self, assignment_expression, ")", punctuator, ","); if (!list) { SvREFCNT_dec(args); return NULL; } push_arrayref(args, list); SvREFCNT_dec(list); } else if (strcmp(pstr, ")") != 0) { SvREFCNT_dec(args); return NULL; } } else { SV *list = try_op_list(self, assignment_expression, ")", punctuator, ","); if (!list) { SvREFCNT_dec(args); return NULL; } push_arrayref(args, list); SvREFCNT_dec(list); } } } return new_obj2("CParse::Attribute", name, newRV_noinc((SV *)args)); } static SV * try_attribute_specifier (SV *self) { if (try_parse(self, keyword, "__asm__")) { commit = true; if (!try_parse(self, punctuator, "(")) return NULL; SV *name = try_parse(self, string_literal); if (!try_parse(self, punctuator, ")")) return NULL; SV *attr = new_obj2("CParse::Attribute", sv_2mortal(newSVpv("asm_name", 0)), name); return new_obj("CParse::AttributeList", newRV_noinc((SV *)av_make(1, &attr))); } if (!try_parse(self, keyword, "__attribute__")) return NULL; commit = true; if (!try_parse(self, punctuator, "(")) return NULL; if (!try_parse(self, punctuator, "(")) return NULL; SV *list = try_op_list(self, attribute, ")", punctuator, ","); if (!list) return NULL; if (!try_parse(self, punctuator, ")")) return NULL; /* We're going to discard this list, and build a new one out of some * of its members */ AV *attrs = newAV(); AV *alist = (AV *)SvRV(list); int i; for (i = 0; i <= av_len(alist); i++) { SV **arg = av_fetch(alist, i, 0); if (!sv_isa(*arg, "CParse::Parser::Token::Punctuator")) { SvREFCNT_inc(*arg); av_push(attrs, *arg); } } SvREFCNT_dec(list); return new_obj("CParse::AttributeList", newRV_noinc((SV *)attrs)); } static SV * try_attribute_specifier_list (SV *self) { dSP; I32 ax; AV *specs = newAV(); while (1) { SV *spec = try_parse(self, attribute_specifier); if (!spec) break; ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(spec); PUTBACK; int count = call_method("attributes", G_ARRAY); /* Evil duplicated from perlcall. I don't want to understand this. It makes ST work, and thusly lets me access the list returned by that method call using a loop. */ SPAGAIN; SP -= count; ax = (SP - PL_stack_base) + 1; int i; for (i = 0; i < count; i++) { SV *s = ST(i); SvREFCNT_inc(s); av_push(specs, s); } PUTBACK; FREETMPS; LEAVE; } if (av_len(specs) == -1) { SvREFCNT_dec(specs); return NULL; } return new_obj("CParse::AttributeList", newRV_noinc((SV *)specs)); } static SV * try_storage_class_specifier (SV *self, char *name) { SV *keyword = try_parse(self, keyword, name); if (!SvTRUE(keyword)) return NULL; SV *str = get_string(keyword); char *pstr = SvPV_nolen(str); if (strcmp(pstr, "typedef") != 0 && strcmp(pstr, "extern") != 0 && strcmp(pstr, "static") != 0 && strcmp(pstr, "auto") != 0 && strcmp(pstr, "register") != 0) return NULL; SV *obj = new_obj("CParse::StorageClass", str); return obj; } static SV * try_type_qualifier (SV *self, char *name) { SV *keyword = try_parse(self, keyword, name); if (!SvTRUE(keyword)) return NULL; SV *str = get_string(keyword); char *pstr = SvPV_nolen(str); if (strcmp(pstr, "const") != 0 && strcmp(pstr, "restrict") != 0 && strcmp(pstr, "volatile") != 0) return NULL; SV *obj = new_obj("CParse::TypeQualifier", str); return obj; } static SV * try_function_specifier (SV *self, char *name) { SV *keyword = try_parse(self, keyword, name); if (!SvTRUE(keyword)) return NULL; SV *str = get_string(keyword); char *pstr = SvPV_nolen(str); if (strcmp(pstr, "inline") != 0) return NULL; SV *obj = new_obj("CParse::FunctionSpecifier", str); return obj; } static SV * try_assignment_operator (SV *self) { SV *punctuator = try_parse(self, punctuator, NULL); if (!SvTRUE(punctuator)) return NULL; SV *str = get_string(punctuator); char *pstr = SvPV_nolen(str); if (strcmp(pstr, "=") != 0 && strcmp(pstr, "*=") != 0 && strcmp(pstr, "/=") != 0 && strcmp(pstr, "%=") != 0 && strcmp(pstr, "+=") != 0 && strcmp(pstr, "-=") != 0 && strcmp(pstr, "<<=") != 0 && strcmp(pstr, ">>=") != 0 && strcmp(pstr, "&=") != 0 && strcmp(pstr, "^=") != 0 && strcmp(pstr, "|=") != 0) return NULL; return get_string(punctuator); } static SV * try_unary_operator (SV *self) { SV *punctuator = try_parse(self, punctuator, NULL); if (!SvTRUE(punctuator)) return NULL; SV *str = get_string(punctuator); char *pstr = SvPV_nolen(str); if (strcmp(pstr, "&") != 0 && strcmp(pstr, "*") != 0 && strcmp(pstr, "+") != 0 && strcmp(pstr, "-") != 0 && strcmp(pstr, "~") != 0 && strcmp(pstr, "!") != 0) return NULL; return get_string(punctuator); } static SV * try_equality_operator (SV *self) { SV *punctuator = try_parse(self, punctuator, NULL); if (!SvTRUE(punctuator)) return NULL; SV *str = get_string(punctuator); char *pstr = SvPV_nolen(str); if (strcmp(pstr, "==") != 0 && strcmp(pstr, "!=") != 0) return NULL; return get_string(punctuator); } static SV * try_relational_operator (SV *self) { SV *punctuator = try_parse(self, punctuator, NULL); if (!SvTRUE(punctuator)) return NULL; SV *str = get_string(punctuator); char *pstr = SvPV_nolen(str); if (strcmp(pstr, "<") != 0 && strcmp(pstr, ">") != 0 && strcmp(pstr, "<=") != 0 && strcmp(pstr, ">=") != 0) return NULL; return get_string(punctuator); } static SV * try_shift_operator (SV *self) { SV *punctuator = try_parse(self, punctuator, NULL); if (!SvTRUE(punctuator)) return NULL; SV *str = get_string(punctuator); char *pstr = SvPV_nolen(str); if (strcmp(pstr, "<<") != 0 && strcmp(pstr, ">>") != 0) return NULL; return get_string(punctuator); } static SV * try_additive_operator (SV *self) { SV *punctuator = try_parse(self, punctuator, NULL); if (!SvTRUE(punctuator)) return NULL; SV *str = get_string(punctuator); char *pstr = SvPV_nolen(str); if (strcmp(pstr, "+") != 0 && strcmp(pstr, "-") != 0) return NULL; return get_string(punctuator); } static SV * try_multiplicative_operator (SV *self) { SV *punctuator = try_parse(self, punctuator, NULL); if (!SvTRUE(punctuator)) return NULL; SV *str = get_string(punctuator); char *pstr = SvPV_nolen(str); if (strcmp(pstr, "*") != 0 && strcmp(pstr, "%") != 0 && strcmp(pstr, "/") != 0) return NULL; return get_string(punctuator); } static SV * try_expression (SV *self) { SV *list = try_op_list(self, assignment_expression, NULL, punctuator, ","); if (!SvTRUE(list)) return NULL; return new_obj2("CParse::Op", list, sv_2mortal(newSVpv("CParse::Op::Expression", 0))); } static SV * try_conditional_expression (SV *self) { SV *cond_expr = try_parse(self, logical_or_expression); if (!cond_expr) return NULL; if (try_parse(self, punctuator, "?")) { commit = true; SV *true_expr = try_parse(self, expression); if (!true_expr) return NULL; if (!try_parse(self, punctuator, ":")) return NULL; SV *false_expr = try_parse(self, conditional_expression); if (!false_expr) return NULL; return new_obj3("CParse::Op::Conditional", cond_expr, true_expr, false_expr); } else { return cond_expr; } } static SV * try_assignment (SV *self) { SV *left_exp = try_parse(self, unary_expression); if (!left_exp) return NULL; SV *op = try_parse(self, assignment_operator); if (!op) return NULL; SV *right_exp = try_parse(self, assignment_expression); if (!right_exp) return NULL; return new_obj3("CParse::Op::Assign", left_exp, right_exp, op); } static SV * try_assignment_expression (SV *self) { SV *exp = try_parse(self, assignment); if (exp) return exp; exp = try_parse(self, conditional_expression); return exp; } static SV * try_constant_expression (SV *self) { return try_conditional_expression(self); } static SV * try_constant (SV *self) { SV *constant = try_parse(self, integer_constant); if (constant) return process(constant); constant = try_parse(self, floating_constant); if (constant) return process(constant); constant = try_parse(self, character_constant); if (constant) return process(constant); return NULL; } static SV * try_primary_expression (SV *self) { if (try_parse(self, punctuator, "(")) { SV *exp = try_parse(self, expression); if (!exp) return NULL; if (!try_parse(self, punctuator, ")")) return NULL; return exp; } SV *string = try_parse(self, string_literal); if (string) return process(string); SV *identifier = try_parse(self, identifier); if (identifier) return process(identifier); return try_parse(self, constant); } static SV * try_initialiser (SV *self) { if (try_parse(self, punctuator, "{")) { AV *inits = newAV(); bool first = true; while (1) { if (!try_parse(self, punctuator, "}")) { SvREFCNT_dec(inits); return NULL; } if (!first && !try_parse(self, punctuator, ",")) { SvREFCNT_dec(inits); return NULL; } first = false; SV *init = try_parse(self, designated_initialiser); if (!init) { SvREFCNT_dec(inits); return NULL; } SvREFCNT_inc(init); av_push(inits, init); } } return try_parse(self, assignment_expression); } static SV * try_designated_initialiser (SV *self) { if (try_parse(self, punctuator, "[")) { commit = true; SV *exp = try_parse(self, constant_expression); if (!exp) return NULL; if (!try_parse(self, punctuator, "]")) return NULL; return try_parse(self, initialiser); } if (try_parse(self, punctuator, ".")) { commit = true; SV *id = try_parse(self, identifier); if (!id) return NULL; return try_parse(self, initialiser); } return try_parse(self, initialiser); } static SV * try_compound_literal (SV *self) { if (!try_parse(self, punctuator, "(")) return NULL; SV *type = try_parse(self, type_name); if (!type) return NULL; if (!try_parse(self, punctuator, ")")) return NULL; if (!try_parse(self, punctuator, "{")) return NULL; AV *inits = newAV(); bool first = true; while (1) { if (!try_parse(self, punctuator, "}")) { SvREFCNT_dec(inits); return NULL; } if (!first && !try_parse(self, punctuator, ",")) { SvREFCNT_dec(inits); return NULL; } first = false; if (!try_parse(self, punctuator, "}")) { SvREFCNT_dec(inits); return NULL; } SV *init = try_parse(self, designated_initialiser); if (!init) { SvREFCNT_dec(inits); return NULL; } SvREFCNT_inc(init); av_push(inits, init); } SV *ref = newRV_noinc((SV *)inits); return new_obj2("CParse::Op::CompoundLiteral", type, ref); } static SV * try_postfix_expression_prefix (SV *self) { SV *compound = try_parse(self, compound_literal); if (compound) return compound; return try_parse(self, primary_expression); } static SV * try_postfix_expression_array_suffix (SV *self) { if (!try_parse(self, punctuator, "[")) return NULL; SV *expr = try_parse(self, expression); if (!expr) return NULL; if (!try_parse(self, punctuator, "]")) return NULL; return new_obj("CParse::Op::ArraySubscript", expr); } static SV * try_postfix_expression_call_suffix (SV *self) { if (!try_parse(self, punctuator, "(")) return NULL; SV *args = try_op_list(self, assignment_expression, NULL, punctuator, ","); if (!try_parse(self, punctuator, ")")) return NULL; if (!args) args = newRV_noinc((SV *)newAV()); return new_obj("CParse::Op::Call", args); } static SV * try_postfix_expression_member_suffix (SV *self) { if (!try_parse(self, punctuator, ".")) return NULL; SV *identifier = try_parse(self, identifier); if (!identifier) return NULL; SV *str = get_string(identifier); return new_obj("CParse::Op::Member", str); } static SV * try_postfix_expression_member_indirect_suffix (SV *self) { if (!try_parse(self, punctuator, "->")) return NULL; SV *identifier = try_parse(self, identifier); if (!identifier) return NULL; SV *str = get_string(identifier); return new_obj("CParse::Op::MemberIndirect", str); } static SV * try_postfix_expression_post_increment_suffix (SV *self) { if (!try_parse(self, punctuator, "++")) return NULL; return new_obj("CParse::Op::Postinc", NULL); } static SV * try_postfix_expression_post_decrement_suffix (SV *self) { if (!try_parse(self, punctuator, "--")) return NULL; return new_obj("CParse::Op::Postdec", NULL); } static SV * try_postfix_expression (SV *self) { SV *prefix = try_parse(self, postfix_expression_prefix); if (!prefix) return NULL; AV *suffixes = newAV(); while (1) { SV *suffix; if ((suffix = try_parse(self, postfix_expression_array_suffix))) { SvREFCNT_inc(suffix); av_push(suffixes, suffix); continue; } if ((suffix = try_parse(self, postfix_expression_call_suffix))) { SvREFCNT_inc(suffix); av_push(suffixes, suffix); continue; } if ((suffix = try_parse(self, postfix_expression_member_suffix))) { SvREFCNT_inc(suffix); av_push(suffixes, suffix); continue; } if ((suffix = try_parse(self, postfix_expression_member_indirect_suffix))) { SvREFCNT_inc(suffix); av_push(suffixes, suffix); continue; } if ((suffix = try_parse(self, postfix_expression_post_increment_suffix))) { SvREFCNT_inc(suffix); av_push(suffixes, suffix); continue; } if ((suffix = try_parse(self, postfix_expression_post_decrement_suffix))) { SvREFCNT_inc(suffix); av_push(suffixes, suffix); continue; } break; } SV *ref = newRV_noinc((SV *)suffixes); return new_obj2("CParse::Op::Postfix", prefix, ref); } static SV * try_unary_expression (SV *self) { if (try_parse(self, keyword, "sizeof")) { commit = true; if (try_parse(self, punctuator, "(")) { SV *type = try_parse(self, type_name); if (!type) return NULL; if (!try_parse(self, punctuator, ")")) return NULL; return new_obj("CParse::Op::Sizeof", type); } SV *expr = try_parse(self, unary_expression); if (!expr) return NULL; return new_obj("CParse::Op::SizeofExpr", expr); } if (try_parse(self, keyword, "__alignof__")) { commit = true; if (!try_parse(self, punctuator, "(")) return NULL; SV *arg = try_parse(self, type_name); if (!arg) arg = try_parse(self, unary_expression); if (!arg) return NULL; if (!try_parse(self, punctuator, ")")) return NULL; return new_obj("CParse::Op::Alignof", arg); } if (try_parse(self, punctuator, "++")) { SV *expr = try_parse(self, unary_expression); if (!expr) return NULL; return new_obj("CParse::Op::Preinc", expr); } if (try_parse(self, punctuator, "--")) { SV *expr = try_parse(self, unary_expression); if (!expr) return NULL; return new_obj("CParse::Op::Predec", expr); } if (try_parse(self, keyword, "__extension__")) { commit = 1; return try_parse(self, cast_expression); } SV *op; if ((op = try_parse(self, unary_operator))) { SV *expr = try_parse(self, cast_expression); return new_obj2("CParse::Op::Unary", expr, op); } return try_parse(self, postfix_expression); } static SV * try_explicit_cast (SV *self) { if (!try_parse(self, punctuator, "(")) return NULL; SV *type = try_parse(self, type_name); if (!type) return NULL; if (!try_parse(self, punctuator, ")")) return NULL; SV *expr = try_parse(self, cast_expression); if (!expr) return NULL; return new_obj2("CParse::Op::Cast", expr, type); } static SV * try_cast_expression (SV *self) { SV *expr = try_parse(self, explicit_cast); if (expr) return expr; return try_parse(self, unary_expression); } #define def_arith1_func(this, next, class) \ static SV * \ try_ ## this ## _expression (SV *self) \ { \ SV *list = try_op_list(self, next ## _expression, NULL, this ## _operator); \ if (!list) \ return NULL; \ return new_obj2("CParse::Op", list, sv_2mortal(newSVpv("CParse::Op::" #class, 0))); \ } #define def_arith2_func(this, next, class, op) \ static SV * \ try_ ## this ## _expression (SV *self) \ { \ SV *list = try_op_list(self, next ## _expression, NULL, punctuator, op); \ if (!list) \ return NULL; \ return new_obj2("CParse::Op", list, sv_2mortal(newSVpv("CParse::Op::" #class, 0))); \ } def_arith1_func(multiplicative, cast, Multiply) def_arith1_func(additive, multiplicative, Add) def_arith1_func(shift, additive, Shift) def_arith1_func(relational, shift, Relation) def_arith1_func(equality, relational, Equal) def_arith2_func(and, equality, BitAnd, "&") def_arith2_func(exclusive_or, and, BitXor, "^") def_arith2_func(inclusive_or, exclusive_or, BitOr, "|") def_arith2_func(logical_and, inclusive_or, BoolAnd, "&&") def_arith2_func(logical_or, logical_and, BoolOr, "||") static SV * try_specifier_qualifier (SV *self) { SV *sv; if ((sv = try_parse(self, attribute_specifier))) return sv; if ((sv = try_parse(self, type_specifier))) return sv; if ((sv = try_parse(self, type_qualifier, NULL))) return sv; return NULL; } static SV * try_struct_declarator (SV *self) { SV *attr1 = try_parse(self, attribute_specifier_list); SV *declarator = try_parse(self, declarator); if (!declarator) declarator = new_obj("CParse::Declarator", NULL); if (try_parse(self, punctuator, ":")) { SV *expr = try_parse(self, constant_expression); if (!expr) return NULL; SV *attr2 = try_parse(self, attribute_specifier_list); return new_obj4("CParse::StructDeclarator", declarator, expr, attr1 ? attr1 : &PL_sv_undef, attr2 ? attr2 : &PL_sv_undef); } else { SV *attr2 = try_parse(self, attribute_specifier_list); return new_obj4("CParse::StructDeclarator", declarator, &PL_sv_undef, attr1 ? attr1 : &PL_sv_undef, attr2 ? attr2 : &PL_sv_undef); } } static SV * try_struct_declaration_declarator_list (SV *self) { AV *decls = newAV(); bool first = true; while (1) { if (try_parse(self, punctuator, ";")) break; if (!first) { if (!try_parse(self, punctuator, ",")) { SvREFCNT_dec(decls); return NULL; } } first = false; SV *decl = try_parse(self, struct_declarator); if (!decl) { SvREFCNT_dec(decls); return NULL; } SvREFCNT_inc(decl); av_push(decls, decl); } return newRV_noinc((SV *)decls); } static SV * try_struct_declaration (SV *self) { SV *declarators; AV *specifiers = newAV(); /* This loop accumulates specifiers until we find a single declarator list */ while (1) { declarators = try_parse(self, struct_declaration_declarator_list); if (declarators) break; SV *specifier = try_parse(self, specifier_qualifier); if (specifier) { SvREFCNT_inc(specifier); av_push(specifiers, specifier); continue; } SvREFCNT_dec((SV *)specifiers); return NULL; } return new_obj2("CParse::StructDeclaration", newRV_noinc((SV *)specifiers), declarators); } static SV * try_struct_specifier (SV *self) { SV *attr1 = try_parse(self, attribute_specifier_list); SV *id = try_parse(self, identifier); if (try_parse(self, punctuator, "{")) { commit = true; AV *decls = newAV(); while (1) { if (try_parse(self, punctuator, "}")) break; SV *decl = try_parse(self, struct_declaration); if (!decl) { SvREFCNT_dec(decls); return NULL; } SvREFCNT_inc(decl); av_push(decls, decl); } SV *attr2 = try_parse(self, attribute_specifier_list); return new_obj4("CParse::Struct", id ? get_string(id) : &PL_sv_undef, newRV_noinc((SV *)decls), attr1 ? attr1 : &PL_sv_undef, attr2 ? attr2 : &PL_sv_undef); } else { if (!id) return NULL; return new_obj("CParse::StructRef", get_string(id)); } } static SV * try_union_specifier (SV *self) { SV *attr1 = try_parse(self, attribute_specifier_list); SV *id = try_parse(self, identifier); if (try_parse(self, punctuator, "{")) { commit = true; AV *decls = newAV(); while (1) { if (try_parse(self, punctuator, "}")) break; SV *decl = try_parse(self, struct_declaration); if (!decl) { SvREFCNT_dec(decls); return NULL; } SvREFCNT_inc(decl); av_push(decls, decl); } SV *attr2 = try_parse(self, attribute_specifier_list); return new_obj4("CParse::Union", id ? get_string(id) : &PL_sv_undef, newRV_noinc((SV *)decls), attr1 ? attr1 : &PL_sv_undef, attr2 ? attr2 : &PL_sv_undef); } else { if (!id) return NULL; return new_obj("CParse::UnionRef", get_string(id)); } } static SV * try_enumerator (SV *self) { SV *id = try_parse(self, identifier); if (!id) return NULL; SV *expr = &PL_sv_undef; if (try_parse(self, punctuator, "=")) { expr = try_parse(self, constant_expression); if (!expr) return NULL; } return new_obj2("CParse::Enumerator", get_string(id), expr); } static SV * try_enum_specifier (SV *self) { SV *attr1 = try_parse(self, attribute_specifier_list); SV *id = try_parse(self, identifier); if (try_parse(self, punctuator, "{")) { commit = true; AV *decls = newAV(); bool first = true; while (1) { if (try_parse(self, punctuator, "}")) break; if (!first) { if (!try_parse(self, punctuator, ",")) { SvREFCNT_dec(decls); return NULL; } } first = false; if (try_parse(self, punctuator, "}")) break; SV *decl = try_parse(self, enumerator); if (!decl) { SvREFCNT_dec(decls); return NULL; } SvREFCNT_inc(decl); av_push(decls, decl); } SV *attr2 = try_parse(self, attribute_specifier_list); return new_obj4("CParse::Enum", id ? get_string(id) : &PL_sv_undef, newRV_noinc((SV *)decls), attr1 ? attr1 : &PL_sv_undef, attr2 ? attr2 : &PL_sv_undef); } else { if (!id) return NULL; return new_obj("CParse::EnumRef", get_string(id)); } } static SV * try_type_specifier (SV *self) { SV *id = try_parse(self, identifier); if (id) return process(id); SV *keyword = try_parse(self, keyword, NULL); if (!keyword) return NULL; char *str = SvPV_nolen(get_string(keyword)); static const char *basic_types[] = {"void", "char", "short", "int", "long", "float", "double", "signed", "unsigned", "_Bool", "_Complex", "_Imaginary", NULL}; const char **t; for (t = basic_types; *t; t++) { if (strcmp(str, *t) == 0) return new_obj("CParse::TypeSpecifier", get_string(keyword)); } if (strcmp(str, "__extension__") == 0) return new_obj("CParse::Extension", NULL); if (strcmp(str, "struct") == 0) return try_parse(self, struct_specifier); if (strcmp(str, "union") == 0) return try_parse(self, union_specifier); if (strcmp(str, "enum") == 0) return try_parse(self, enum_specifier); return NULL; } static SV * try_type_name (SV *self) { AV *specs = newAV(); SV *decl; while (1) { decl = try_parse(self, abstract_declarator); if (decl) break; SV *spec = try_parse(self, specifier_qualifier); if (spec) { SvREFCNT_inc(spec); av_push(specs, spec); continue; } break; } if (av_len(specs) == -1) { SvREFCNT_dec(specs); return NULL; } if (!decl) decl = new_obj("CParse::Declarator", NULL); return new_obj2("CParse::TypeName", newRV_noinc((SV *)specs), decl); } static SV * try_declaration_specifier (SV *self) { SV *spec; if ((spec = try_parse(self, storage_class_specifier, NULL))) return spec; if ((spec = try_parse(self, type_qualifier, NULL))) return spec; if ((spec = try_parse(self, function_specifier, NULL))) return spec; if ((spec = try_parse(self, attribute_specifier))) return spec; return try_parse(self, type_specifier); } static SV * try_pointer (SV *self) { if (!try_parse(self, punctuator, "*")) return NULL; AV *quals = newAV(); while (1) { SV *attr = try_parse(self, attribute_specifier); if (attr) { SvREFCNT_inc(attr); av_push(quals, attr); continue; } SV *qual = try_parse(self, type_qualifier, NULL); if (!qual) break; SvREFCNT_inc(qual); av_push(quals, qual); } SV *pointer = try_parse(self, pointer); return new_obj2("CParse::Pointer", newRV_noinc((SV *)quals), pointer ? pointer : &PL_sv_undef); } static SV * try_direct_declarator_prefix (SV *self) { if (try_parse(self, punctuator, "(")) { SV *prefix = try_parse(self, declarator); if (!try_parse(self, punctuator, ")")) return NULL; return prefix; } else { SV *prefix = try_parse(self, identifier); if (prefix) return process(prefix); else return NULL; } croak("not reached"); } static SV * try_direct_declarator_array_suffix (SV *self) { if (!try_parse(self, punctuator, "[")) return NULL; commit = true; if (try_parse(self, punctuator, "*")) croak("Unhandled foo[*] construct"); bool restrict = false; SV *expr = &PL_sv_undef; if (try_parse(self, type_qualifier, "restrict")) { restrict = true; } else { expr = try_parse(self, assignment_expression); } if (!try_parse(self, punctuator, "]")) return NULL; return new_obj2("CParse::Declarator::Array", expr ? expr : &PL_sv_undef, restrict ? sv_2mortal(newSViv(1)) : &PL_sv_undef); } static SV * try_parameter_declaration (SV *self) { AV *specs = newAV(); while (1) { SV *spec = try_parse(self, declaration_specifier); if (!spec) break; SvREFCNT_inc(spec); av_push(specs, spec); } SV *decl = try_parse(self, declarator); if (!decl) decl = try_parse(self, abstract_declarator); if (!decl) decl = new_obj("CParse::Declarator", NULL); return new_obj2("CParse::ParameterDeclaration", newRV_noinc((SV *)specs), decl); } static SV * try_direct_declarator_function_suffix (SV *self) { if (!try_parse(self, punctuator, "(")) return NULL; if (try_parse(self, punctuator, ")")) return new_obj2("CParse::Declarator::Function", newRV_noinc((SV *)newAV()), sv_2mortal(newSViv(1))); AV *parms = newAV(); bool variadic = false; bool first = true; while (1) { if (try_parse(self, punctuator, ")")) break; if (!first) { if (!try_parse(self, punctuator, ",")) { SvREFCNT_dec(parms); return NULL; } } first = false; if (try_parse(self, punctuator, "...")) { if (!try_parse(self, punctuator, ")")) { SvREFCNT_dec(parms); return NULL; } variadic = true; break; } SV *parm = try_parse(self, parameter_declaration); if (!parm) { SvREFCNT_dec(parms); return NULL; } SvREFCNT_inc(parm); av_push(parms, parm); } return new_obj2("CParse::Declarator::Function", newRV_noinc((SV *)parms), sv_2mortal(newSViv(variadic ? 1 : 0))); } static SV * try_declarator (SV *self) { SV *attr1 = try_parse(self, attribute_specifier_list); SV *pointer = try_parse(self, pointer); SV *prefix = try_parse(self, direct_declarator_prefix); if (!prefix) return NULL; bool had_function_suffix = false; AV *suffixes = newAV(); while (1) { SV *suffix = try_parse(self, direct_declarator_array_suffix); if (suffix) { SvREFCNT_inc(suffix); av_push(suffixes, suffix); continue; } if (!had_function_suffix) { suffix = try_parse(self, direct_declarator_function_suffix); if (suffix) { had_function_suffix = true; SvREFCNT_inc(suffix); av_push(suffixes, suffix); continue; } } break; } SV *attr2 = try_parse(self, attribute_specifier_list); SV *direct = new_obj2("CParse::Declarator::Direct", prefix, newRV_noinc((SV *)suffixes)); return new_obj4("CParse::Declarator", direct, pointer ? pointer : &PL_sv_undef, attr1 ? attr1 : &PL_sv_undef, attr2 ? attr2 : &PL_sv_undef); } static SV * try_abstract_declarator_prefix (SV *self) { if (!try_parse(self, punctuator, "(")) return NULL; SV *decl = try_parse(self, abstract_declarator); if (!try_parse(self, punctuator, ")")) return NULL; return decl; } static SV * try_direct_abstract_declarator (SV *self) { SV *prefix = try_parse(self, abstract_declarator_prefix); if (!prefix) prefix = &PL_sv_undef; AV *suffixes = newAV(); while (1) { SV *suffix = try_parse(self, direct_declarator_array_suffix); if (suffix) { SvREFCNT_inc(suffix); av_push(suffixes, suffix); continue; } suffix = try_parse(self, direct_declarator_function_suffix); if (suffix) { SvREFCNT_inc(suffix); av_push(suffixes, suffix); continue; } break; } return new_obj2("CParse::Declarator::Direct", prefix, newRV_noinc((SV *)suffixes)); } static SV * try_abstract_declarator (SV *self) { SV *attr1 = try_parse(self, attribute_specifier_list); SV *pointer = try_parse(self, pointer); SV *decl = try_parse(self, direct_abstract_declarator); SV *attr2 = try_parse(self, attribute_specifier_list); if (!pointer && (!decl || !SvOK(decl))) return NULL; return new_obj4("CParse::Declarator", decl ? decl : &PL_sv_undef, pointer ? pointer : &PL_sv_undef, attr1 ? attr1 : &PL_sv_undef, attr2 ? attr2 : &PL_sv_undef); } static SV * try_init_declarator (SV *self) { SV *decl = try_parse(self, declarator); SV *init = NULL; if (try_parse(self, punctuator, "=")) { init = try_parse(self, initialiser); if (!init) return NULL; } return decl; } static SV * try_declaration_declarator_list (SV *self) { AV *decls = newAV(); bool first = true; while (1) { if (try_parse(self, punctuator, ";")) break; if (!first) { if (!try_parse(self, punctuator, ",")) { SvREFCNT_dec(decls); return NULL; } } first = false; SV *decl = try_parse(self, init_declarator); if (!decl) { SvREFCNT_dec(decls); return NULL; } SvREFCNT_inc(decl); av_push(decls, decl); } return newRV_noinc((SV *)decls); } static SV * try_declaration (SV *self) { SV *decls; AV *decl_specs = newAV(); while (1) { decls = try_parse(self, declaration_declarator_list); if (decls) break; SV *spec = try_parse(self, declaration_specifier); if (spec) { SvREFCNT_inc(spec); av_push(decl_specs, spec); continue; } SvREFCNT_dec(decl_specs); return NULL; } return new_obj2("CParse::Declaration", newRV_noinc((SV *)decl_specs), decls); } static SV * try_function_declarator (SV *self) { SV *pointer = try_parse(self, pointer); SV *prefix = try_parse(self, direct_declarator_prefix); if (!prefix) return NULL; SV *suffix = try_parse(self, direct_declarator_function_suffix); if (!suffix) return NULL; SV *direct = new_obj2("CParse::Declarator::Direct", prefix, newRV_noinc((SV *)av_make(1, &suffix))); return new_obj2("CParse::Declarator", direct, pointer ? pointer : &PL_sv_undef); } static SV * try_function (SV *self) { SV *decl; AV *decl_specs = newAV(); while (1) { decl = try_parse(self, function_declarator); if (decl) break; SV *spec = try_parse(self, declaration_specifier); if (spec) { SvREFCNT_inc(spec); av_push(decl_specs, spec); continue; } SvREFCNT_dec(decl_specs); return NULL; } AV *decls = newAV(); while (1) { SV *arg_decl = try_parse(self, declaration); if (!arg_decl) break; SvREFCNT_inc(arg_decl); av_push(decls, arg_decl); } SV *body = try_parse(self, compound_statement); if (!body) { SvREFCNT_dec(decl_specs); SvREFCNT_dec(decls); return NULL; } return new_obj3("CParse::Function", newRV_noinc((SV *)decl_specs), decl, newRV_noinc((SV *)decls)); } static SV * try_asm_clobbers (SV *self) { return try_op_list(self, string_literal, NULL, punctuator, ","); } static SV * try_asm_operand (SV *self) { if (try_parse(self, punctuator, "[")) { commit = true; if (!try_parse(self, identifier)) return NULL; if (!try_parse(self, punctuator, "]")) return NULL; } SV *op = try_parse(self, string_literal); if (!op) return NULL; commit = true; if (!try_parse(self, punctuator, "(")) return NULL; if (!try_parse(self, expression)) return NULL; if (!try_parse(self, punctuator, ")")) return NULL; return op; } static SV * try_asm_operands (SV *self) { return try_op_list(self, asm_operand, NULL, punctuator, ","); } static SV * try_asm_statement (SV *self) { if (!try_parse(self, keyword, "__asm__")) return NULL; commit = true; try_parse(self, keyword, "volatile"); if (!try_parse(self, punctuator, "(")) return NULL; SV *expr = try_parse(self, expression); if (!expr) return NULL; if (try_parse(self, punctuator, ":")) { if (!try_parse(self, asm_operands)) return NULL; if (try_parse(self, punctuator, ":")) { if (!try_parse(self, asm_operands)) return NULL; if (try_parse(self, punctuator, ":")) { if (!try_parse(self, asm_clobbers)) return NULL; } } } if (!try_parse(self, punctuator, ")")) return NULL; if (!try_parse(self, punctuator, ";")) return NULL; return expr; } static SV * try_jump_statement (SV *self) { if (try_parse(self, keyword, "goto")) { commit = true; SV *label = try_parse(self, identifier); if (!label) return NULL; if (!try_parse(self, punctuator, ";")) return NULL; return label; } if (try_parse(self, keyword, "continue")) { commit = true; if (!try_parse(self, punctuator, ";")) return NULL; return newRV_noinc((SV *)newAV()); } if (try_parse(self, keyword, "break")) { commit = true; if (!try_parse(self, punctuator, ";")) return NULL; return newRV_noinc((SV *)newAV()); } if (try_parse(self, keyword, "return")) { commit = true; try_parse(self, expression); if (!try_parse(self, punctuator, ";")) return NULL; return newRV_noinc((SV *)newAV()); } return NULL; } static SV * try_iteration_statement (SV *self) { if (try_parse(self, keyword, "while")) { commit = true; if (!try_parse(self, punctuator, "(")) return NULL; if (!try_parse(self, expression)) return NULL; if (!try_parse(self, punctuator, ")")) return NULL; if (!try_parse(self, statement)) return NULL; return newRV_noinc((SV *)newAV()); } if (try_parse(self, keyword, "do")) { commit = true; if (!try_parse(self, statement)) return NULL; if (!try_parse(self, keyword, "while")) return NULL; if (!try_parse(self, punctuator, "(")) return NULL; if (!try_parse(self, expression)) return NULL; if (!try_parse(self, punctuator, ")")) return NULL; if (!try_parse(self, punctuator, ";")) return NULL; return newRV_noinc((SV *)newAV()); } if (try_parse(self, keyword, "for")) { commit = true; if (!try_parse(self, punctuator, "(")) return NULL; if (!try_parse(self, declaration)) { try_parse(self, expression); if (!try_parse(self, punctuator, ";")) return NULL; } try_parse(self, expression); if (!try_parse(self, punctuator, ";")) return NULL; try_parse(self, expression); if (!try_parse(self, punctuator, ")")) return NULL; if (!try_parse(self, statement)) return NULL; return newRV_noinc((SV *)newAV()); } return NULL; } static SV * try_selection_statement (SV *self) { if (try_parse(self, keyword, "if")) { commit = true; if (!try_parse(self, punctuator, "(")) return NULL; if (!try_parse(self, expression)) return NULL; if (!try_parse(self, punctuator, ")")) return NULL; if (!try_parse(self, statement)) return NULL; if (try_parse(self, keyword, "else")) { if (!try_parse(self, statement)) return NULL; } return newRV_noinc((SV *)newAV()); } if (try_parse(self, keyword, "switch")) { commit = true; if (!try_parse(self, punctuator, "(")) return NULL; if (!try_parse(self, expression)) return NULL; if (!try_parse(self, punctuator, ")")) return NULL; if (!try_parse(self, statement)) return NULL; return newRV_noinc((SV *)newAV()); } return NULL; } static SV * try_expression_statement (SV *self) { SV *expr = try_parse(self, expression); if (!try_parse(self, punctuator, ";")) return NULL; return expr; } static SV * try_labelled_statement (SV *self) { if (try_parse(self, keyword, "case")) { commit = true; if (!try_parse(self, constant_expression)) return NULL; if (!try_parse(self, punctuator, ":")) return NULL; if (!try_parse(self, statement)) return NULL; return newRV_noinc((SV *)newAV()); } if (try_parse(self, keyword, "default")) { commit = true; if (!try_parse(self, punctuator, ":")) return NULL; if (!try_parse(self, statement)) return NULL; return newRV_noinc((SV *)newAV()); } if (!try_parse(self, identifier)) return NULL; if (!try_parse(self, punctuator, ":")) return NULL; try_parse(self, attribute_specifier_list); if (!try_parse(self, statement)) return NULL; return newRV_noinc((SV *)newAV()); } static SV * try_null_statement (SV *self) { if (!try_parse(self, punctuator, ";")) return NULL; return newRV_noinc((SV *)newAV()); } static SV * try_statement (SV *self) { SV *stmt; if ((stmt = try_parse(self, null_statement))) return stmt; if ((stmt = try_parse(self, compound_statement))) return stmt; if ((stmt = try_parse(self, labelled_statement))) return stmt; if ((stmt = try_parse(self, selection_statement))) return stmt; if ((stmt = try_parse(self, iteration_statement))) return stmt; if ((stmt = try_parse(self, jump_statement))) return stmt; if ((stmt = try_parse(self, asm_statement))) return stmt; if ((stmt = try_parse(self, expression_statement))) return stmt; return NULL; } static SV * try_compound_statement (SV *self) { if (!try_parse(self, punctuator, "{")) return NULL; commit = true; while (1) { if (try_parse(self, punctuator, "}")) break; if (try_parse(self, statement)) continue; if (try_parse(self, declaration)) continue; return NULL; } return newRV_noinc((SV *)newAV()); } MODULE = CParse::Parser::PerlXS PACKAGE = CParse::Parser::PerlXS PROTOTYPES: ENABLE SV * try_parse(self, thing) SV *self; char *thing; CODE: SV *token = NULL; if (strcmp(thing, "declaration") == 0) token = try_parse(self, declaration); else if (strcmp(thing, "function") == 0) token = try_parse(self, function); else croak("Unhandled try_parse argument: '%s'", thing); SvREFCNT_inc(token); RETVAL = token; OUTPUT: RETVAL icheck-0.9.7/ext/CParse-Parser-PerlXS/.arch-inventory0000644000175000017500000000007310273204251022772 0ustar asuffieldasuffieldprecious ^(blib|pm_to_blib|Makefile|PerlXS\.c|PerlXS\.bs)$ icheck-0.9.7/ext/CParse-Parser-PerlXS/PerlXS.pm0000644000175000017500000002145010273204251021536 0ustar asuffieldasuffieldpackage CParse::Parser::PerlXS; use 5.6.0; use strict; use warnings; no warnings "recursion"; use Carp; use CParse::Attribute; use CParse::AttributeList; use CParse::Declaration; use CParse::Declarator; use CParse::Declarator::Array; use CParse::Declarator::Direct; use CParse::Declarator::Function; use CParse::Enum; use CParse::EnumRef; use CParse::Enumerator; use CParse::Extension; use CParse::Function; use CParse::FunctionSpecifier; use CParse::Op; use CParse::Op::Add; use CParse::Op::ArraySubscript; use CParse::Op::Assign; use CParse::Op::BitAnd; use CParse::Op::BitOr; use CParse::Op::BitXor; use CParse::Op::BoolAnd; use CParse::Op::BoolOr; use CParse::Op::Cast; use CParse::Op::Call; use CParse::Op::Conditional; use CParse::Op::Equal; use CParse::Op::Expression; use CParse::Op::Member; use CParse::Op::MemberIndirect; use CParse::Op::Multiply; use CParse::Op::Preinc; use CParse::Op::Predec; use CParse::Op::Postinc; use CParse::Op::Postdec; use CParse::Op::Postfix; use CParse::Op::Relation; use CParse::Op::Shift; use CParse::Op::Alignof; use CParse::Op::Sizeof; use CParse::Op::SizeofExpr; use CParse::Op::Unary; use CParse::ParameterDeclaration; use CParse::Pointer; use CParse::StorageClass; use CParse::Struct; use CParse::StructDeclaration; use CParse::StructDeclarator; use CParse::StructRef; use CParse::TypeName; use CParse::TypeQualifier; use CParse::TypeSpecifier; use CParse::Union; use CParse::UnionRef; use CParse::Parser::Token::Keyword; use CParse::Parser::Token::Identifier; use CParse::Parser::Token::Integer; use CParse::Parser::Token::Float; use CParse::Parser::Token::Character; use CParse::Parser::Token::String; use CParse::Parser::Token::Punctuator; our $VERSION = '0.1'; require XSLoader; XSLoader::load('CParse::Parser::PerlXS', $VERSION); # Preloaded methods go here. sub new { my $this = shift; my $class = ref($this) || $this; my $self = { }; bless $self, $class; return $self; } sub unit { my $self = shift; my $data = shift; my $linemap = shift; $self->{data} = $data; $self->{linemap} = $linemap; $self->{line} = 0; $self->{pos} = 0; $self->{errors} = 0; $self->{commit} = 0; $self->{skip_errors} = 0; $self->{token_queue} = []; $self->{trying_tokens} = []; my @external_decls; DECL: while (1) { if ($self->no_data_left) { last; } my $decl; foreach my $thing (qw/declaration function/) { $self->{skip_errors} = 0; $decl = $self->try_parse($thing); if ($decl) { my $data_line = $self->{trying_tokens}[0]->line; my $data_pos = $self->{trying_tokens}[0]->pos; my $file = $self->{linemap}{$data_line}{file} || ""; my $line = $self->{linemap}{$data_line}{line} || ""; $decl->set_location($file, $line, $data_pos); $self->{trying_tokens} = []; push @external_decls, $decl; next DECL; } last if $self->{errors}; } die if scalar @{$self->{trying_tokens}}; $self->syntax_error; last; } return undef if $self->{errors}; return \@external_decls; } sub error { my $self = shift; my $msg = shift; return if $self->{skip_errors}; my $data_line = scalar @{$self->{token_queue}} ? $self->{token_queue}[0]->line : $self->{line}; my $data_pos = scalar @{$self->{token_queue}} ? $self->{token_queue}[0]->pos : $self->{pos}; my $file = $self->{linemap}{$data_line}{file} || ""; my $line = $self->{linemap}{$data_line}{line} || ""; print STDERR "$file:$line:$data_pos: $msg\n"; foreach my $l ($data_line - 2 .. $data_line + 2) { next if $l < 0; last if $l >= scalar @{$self->{data}}; print STDERR $self->{data}[$l] . "\n"; print STDERR ' ' x $data_pos . "^-- Here\n" if $l == $data_line; } $self->{errors}++; } sub syntax_error { my $self = shift; my $thing = shift; if (defined $thing) { $self->error("syntax error while trying to parse $thing"); } else { $self->error("syntax error"); } } sub no_data_left { my $self = shift; return 0 if scalar @{$self->{token_queue}}; my $token = $self->next_token; if ($token) { $self->retry_tokens($token); return 0; } else { return 1; } } sub next_token { my $self = shift; if (scalar @{$self->{token_queue}}) { return shift @{$self->{token_queue}}; } while (1) { if ($self->{line} >= scalar @{$self->{data}}) { # No lines left, this is EOF return undef; } my $line = substr $self->{data}[$self->{line}], $self->{pos}; # Try to move to the next line if (length $line == 0) { $self->{line}++; $self->{pos} = 0; next; } # Try to consume whitespace if ($line =~ /^(\s+)/) { $self->{pos} += length $1; next; } # Try for a keyword if ($line =~ /^(auto|break|case|char|const|continue|default|do|double| else|enum|extern|float|for|goto|if|inline|int|long| register|restrict|return|short|signed|sizeof|static| struct|switch|typedef|union|unsigned|void|volatile| while|_Bool|_Complex|_Imaginary| __const|__restrict|__volatile|__const__|__restrict__| __volatile__|__attribute__|__attribute|__inline| __inline__|__extension__|__alignof__|asm|__asm__)\b/x) { my $len = length $1; my $token = new CParse::Parser::Token::Keyword $1, $self->{line}, $self->{pos}; $self->{pos} += $len; return $token; } # Try for an identifier if ($line =~ /^((?:[A-Za-z_]|\\u[[:xdigit:]]{4}|\\U[[:xdigit:]]{8})(?:\w|\\u[[:xdigit:]]{4}|\\U[[:xdigit:]]{8})*)/) { my $len = length $1; my $token = new CParse::Parser::Token::Identifier $1, $self->{line}, $self->{pos}; $self->{pos} += $len; return $token; } # Try for a constant if ($line =~ /^((0[xX][[:xdigit:]]+|[1-9]\d*|0[0-7]*)([uU](?:l|L|ll|LL)?|[lL][uU]?|ll[uU]?|LL[uU]?)?)/) { my $len = length $1; my $token = new CParse::Parser::Token::Integer $2, $3, $self->{line}, $self->{pos}; $self->{pos} += $len; return $token; } if ($line =~ /^(((?:\d+\.\d*|\.\d+|\d+)(?:[eE][+-]?\d+))([flFL])?)/) { my $len = length $1; my $token = new CParse::Parser::Token::Float $2, $3, $self->{line}, $self->{pos}; $self->{pos} += $len; return $token; } if ($line =~ /^((0x(?:[[:xdigit:]]+\.[[:xdigit:]]*|\.[[:xdigit:]]+|[[:xdigit:]]+)[pP][+-]?\d+)([flFL])?)/) { my $len = length $1; my $token = new CParse::Parser::Token::Float $2, $3, $self->{line}, $self->{pos}; $self->{pos} += $len; return $token; } if ($line =~ /^(L?'(?:[^'\\\n]|\\['"?abfnrtv\\]|\\[0-7]{1,3}|\\x[[:xdigit:]]+)*')/) { my $len = length $1; my $token = new CParse::Parser::Token::Character $1, $self->{line}, $self->{pos}; $self->{pos} += $len; return $token; } # Try for a string literal if ($line =~ /^(L?"(?:[^"\\\n]|\\['"?abfnrtv\\]|\\[0-7]{1,3}|\\x[[:xdigit:]]+)*")/) { my $len = length $1; my $token = new CParse::Parser::Token::String $1, $self->{line}, $self->{pos}; $self->{pos} += $len; return $token; } # Try for a punctuator if ($line =~ /^(==|!=|=|\*=|\/=|\%=|\+=|-=|>>=|<<=|&=|\^=|!=|\[|\]| \(|\)|{|}|\.\.\.|\.|->|\+\+|--|&|\*|\+|-|~|\/| \%|<<|>>|<=|>=|<|>|\^|&&|\|\||\||\?|:|;| ,|\#|\#\#|!|<:|:>|<\%|\%>|\%:|\%\%:)/x) { my $len = length $1; my $token = new CParse::Parser::Token::Punctuator $1, $self->{line}, $self->{pos}; $self->{pos} += $len; return $token; } $self->syntax_error; return undef; } } sub retry_tokens { my $self = shift; unshift @{$self->{token_queue}}, @_; } sub try_token { my $self = shift; my $token = $self->next_token; return undef unless $token; push @{$self->{trying_tokens}}, $token; return $token; } 1; __END__ icheck-0.9.7/ext/CParse-Parser-PerlXS/Makefile.PL0000644000175000017500000000110210273204251021765 0ustar asuffieldasuffielduse 5.8.7; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'CParse::Parser::PerlXS', VERSION_FROM => 'PerlXS.pm', # finds $VERSION PREREQ_PM => {}, # e.g., Module::Name => 1.1 AUTHOR => 'Andrew Suffield ', LIBS => [''], # e.g., '-lm' DEFINE => '', # e.g., '-DHAVE_SOMETHING' INC => '-I.', # e.g., '-I. -I/usr/include/other' # Un-comment this if you add C files to link with later: # OBJECT => '$(O_FILES)', # link all the C files too ); icheck-0.9.7/typegen.pl0000755000175000017500000000672010273204214015456 0ustar asuffieldasuffield#!/usr/bin/perl use strict; use 5.6.0; use warnings; # This perl script generates a C program which generates a perl # script. It's gonna get ugly. my @types = ('char', 'signed char', 'unsigned char', 'short', 'unsigned short', 'int', 'unsigned', 'long', 'unsigned long', 'long long', 'unsigned long long', 'float', 'double', 'long double', '_Bool', 'void *', 'enum null_enum'); sub mangle_typename { my $name = shift; $name =~ s/\*/ptr/g; $name =~ s/[^\w]/_/g; return $name; } sub print_align_struct { my $type = shift; my $name = mangle_typename($type); print <<"END"; struct align_$name { char pad; $type object; }; END } print < #include #include int main(void) { printf("package CType::Native;\\n"); printf("\\n"); printf("use 5.6.0;\\n"); printf("use strict;\\n"); printf("use warnings;\\n"); printf("\\n"); printf("use bigint;\\n"); printf("use CType::Fundamental qw/register_type_attrs/;\\n"); printf("\\n"); END # We can't use gcc's __alignof__ function because it's # broken. __alignof__(double) returns 8 on i686-linux-gnu, but the # correct value is 4. Instead we'll examine how a struct is laid out, # to deduce the alignment actually used. sub alignof { my $type = shift; my $name = mangle_typename($type); return "offsetof(struct align_$name, object) * 8"; } sub signof { my $type = shift; return "((($type) -1) < 0)"; } sub sizeof { my $type = shift; return "sizeof($type) * 8"; } my %printf_limit_values = ('long' => '%ld', 'unsigned long' => '%lu', 'long long' => '%lld', 'unsigned long long' => '%llu', ); my %limit_values = ('char' => 'CHAR', 'signed char' => 'SCHAR', 'unsigned char' => 'UCHAR', 'short' => 'SHRT', 'unsigned short' => 'USHRT', 'int' => 'INT', 'unsigned' => 'UINT', 'long' => 'LONG', 'unsigned long' => 'ULONG', 'long long' => 'LLONG', 'unsigned long long' => 'ULLONG' ); sub printf_limit_min { my $type = shift; return '\%d' unless $printf_limit_values{$type}; return '\%d' if $type =~ /unsigned/; return $printf_limit_values{$type}; } sub printf_limit_max { my $type = shift; return '\%d' unless $printf_limit_values{$type}; return $printf_limit_values{$type}; } sub minof { my $type = shift; return '0' unless $limit_values{$type}; return '0' if $type =~ /unsigned/; return $limit_values{$type} . '_MIN'; } sub maxof { my $type = shift; return '0' unless $limit_values{$type}; return $limit_values{$type} . '_MAX'; } sub print_register_attrs { my $type = shift; my $ln = printf_limit_min($type); my $lx = printf_limit_max($type); print " printf(\"register_type_attrs('$type', \%d, \%d, \%d, $ln, $lx);\\n\",\n"; print " " . sizeof($type) . ", " . alignof($type) . ", " . signof($type) . ",\n"; print " " . minof($type) . ", " . maxof($type) . ");\n"; } print_register_attrs($_) foreach @types; print < patch-43 Summary: more fixes to alignment handling Revision: icheck--main--0--patch-43 new files: CType/.arch-ids/Structural.pm.id CType/Structural.pm modified files: CType.pm CType/Enum.pm CType/Fundamental.pm CType/Struct.pm CType/Union.pm ChangeLog t/04_align/canonical t/04_align/diff t/04_align/original t/04_align/source/foo.c 2005-08-01 05:24:35 GMT Andrew Suffield patch-42 Summary: add test suite checks for canonical form correctness Revision: icheck--main--0--patch-42 modified files: ChangeLog run_test.pl 2005-08-01 00:56:09 GMT Andrew Suffield patch-41 Summary: fix up clean target Revision: icheck--main--0--patch-41 modified files: ChangeLog Makefile 2005-08-01 00:42:33 GMT Andrew Suffield patch-40 Summary: adjust the alignment canonicalisation some more Revision: icheck--main--0--patch-40 modified files: CDecl.pm CExpr/Alignof.pm CType.pm CType/Array.pm CType/BitField.pm CType/Enum.pm CType/Fundamental.pm CType/Ref.pm CType/Struct.pm CType/Union.pm ChangeLog Makefile NEWS t/02_struct/canonical t/04_align/canonical t/04_align/diff t/04_align/source/foo.c 2005-07-31 17:49:50 GMT Andrew Suffield patch-39 Summary: fix clean target Revision: icheck--main--0--patch-39 modified files: ChangeLog Makefile 2005-07-31 17:43:31 GMT Andrew Suffield patch-38 Summary: improve heuristic for eliminating bogus redefinition errors Revision: icheck--main--0--patch-38 modified files: CParse/Enum.pm CParse/Struct.pm CParse/Union.pm ChangeLog 2005-07-31 17:20:59 GMT Andrew Suffield patch-37 Summary: update NEWS file Revision: icheck--main--0--patch-37 modified files: ChangeLog NEWS 2005-07-31 01:59:04 GMT Andrew Suffield patch-36 Summary: finish implementing xsub parser Revision: icheck--main--0--patch-36 new files: .arch-ids/test_xsub.pl.id test_xsub.pl modified files: ChangeLog Makefile ext/CParse-Parser-PerlXS/PerlXS.pm ext/CParse-Parser-PerlXS/PerlXS.xs 2005-07-27 17:34:48 GMT Andrew Suffield patch-35 Summary: fill in some missing alignment_expr functions Revision: icheck--main--0--patch-35 modified files: CType/Array.pm CType/Ref.pm ChangeLog 2005-07-23 16:11:59 GMT Andrew Suffield patch-34 Summary: fix alignment handling to be arch-independent Revision: icheck--main--0--patch-34 new files: t/04_align/.arch-ids/=id t/04_align/.arch-ids/canonical.id t/04_align/.arch-ids/diff.id t/04_align/.arch-ids/original.id t/04_align/.arch-ids/result.compare.id t/04_align/canonical t/04_align/diff t/04_align/original t/04_align/result.compare t/04_align/source/.arch-ids/=id t/04_align/source/.arch-ids/foo.c.id t/04_align/source/foo.c modified files: CDecl.pm CExpr/Alignof.pm CType.pm CType/BitField.pm CType/Fundamental.pm CType/Struct.pm CType/Union.pm ChangeLog t/02_struct/canonical t/03_baseline/canonical new directories: t/04_align t/04_align/.arch-ids t/04_align/source t/04_align/source/.arch-ids 2005-07-23 14:32:06 GMT Andrew Suffield patch-33 Summary: start implementing XSUB parser Revision: icheck--main--0--patch-33 new files: ext/.arch-ids/=id ext/CParse-Parser-PerlXS/.arch-ids/.arch-inventory.id ext/CParse-Parser-PerlXS/.arch-ids/=id ext/CParse-Parser-PerlXS/.arch-ids/Makefile.PL.id ext/CParse-Parser-PerlXS/.arch-ids/PerlXS.pm.id ext/CParse-Parser-PerlXS/.arch-ids/PerlXS.xs.id ext/CParse-Parser-PerlXS/.arch-inventory ext/CParse-Parser-PerlXS/Makefile.PL ext/CParse-Parser-PerlXS/PerlXS.pm ext/CParse-Parser-PerlXS/PerlXS.xs modified files: CParse.pm CParse/Parser/Perl.pm ChangeLog Makefile icheck new directories: ext ext/.arch-ids ext/CParse-Parser-PerlXS ext/CParse-Parser-PerlXS/.arch-ids 2005-07-06 18:47:23 GMT Andrew Suffield patch-32 Summary: update NEWS Revision: icheck--main--0--patch-32 modified files: ChangeLog NEWS 2005-07-06 18:46:37 GMT Andrew Suffield patch-31 Summary: add basic manpage Revision: icheck--main--0--patch-31 new files: .arch-ids/icheck.1.id icheck.1 modified files: ChangeLog icheck 2005-07-05 23:24:30 GMT Andrew Suffield patch-30 Summary: fix handling of -- on command line Revision: icheck--main--0--patch-30 modified files: ChangeLog NEWS icheck 2005-07-03 20:30:24 GMT Andrew Suffield patch-29 Summary: 'make test' should fail if any tests fail Revision: icheck--main--0--patch-29 modified files: ChangeLog test.pl 2005-07-03 20:14:05 GMT Andrew Suffield patch-28 Summary: add test for baseline support Revision: icheck--main--0--patch-28 new files: t/03_baseline/.arch-ids/=id t/03_baseline/.arch-ids/baseline.id t/03_baseline/.arch-ids/canonical.id t/03_baseline/baseline t/03_baseline/canonical t/03_baseline/source/.arch-ids/=id t/03_baseline/source/.arch-ids/foo.c.id t/03_baseline/source/foo.c modified files: ChangeLog new directories: t/03_baseline t/03_baseline/.arch-ids t/03_baseline/source t/03_baseline/source/.arch-ids 2005-07-03 17:44:12 GMT Andrew Suffield patch-27 Summary: finish testsuite, fix bugs found Revision: icheck--main--0--patch-27 Fix canonification of _Bool types Fix comparison of missing enums new files: t/01_fundamental/.arch-ids/diff.id t/01_fundamental/.arch-ids/original.id t/01_fundamental/.arch-ids/result.compare.id t/01_fundamental/diff t/01_fundamental/original t/01_fundamental/result.compare modified files: CParse/Namespace.pm CType/Fundamental.pm ChangeLog Makefile make_test.pl run_test.pl t/01_fundamental/canonical 2005-07-03 17:15:50 GMT Andrew Suffield patch-26 Summary: add test suite framework, and fix a bug it found Revision: icheck--main--0--patch-26 new files: .arch-ids/make_test.pl.id .arch-ids/make_tests.pl.id .arch-ids/run_test.pl.id .arch-ids/test.pl.id make_test.pl make_tests.pl run_test.pl t/.arch-ids/=id t/00_empty/.arch-ids/=id t/00_empty/.arch-ids/canonical.id t/00_empty/.arch-ids/diff.id t/00_empty/.arch-ids/original.id t/00_empty/canonical t/00_empty/diff t/00_empty/original t/00_empty/source/.arch-ids/=id t/01_fundamental/.arch-ids/=id t/01_fundamental/.arch-ids/canonical.id t/01_fundamental/canonical t/01_fundamental/source/.arch-ids/=id t/01_fundamental/source/.arch-ids/foo.c.id t/01_fundamental/source/foo.c t/02_struct/.arch-ids/=id t/02_struct/.arch-ids/canonical.id t/02_struct/canonical t/02_struct/source/.arch-ids/=id t/02_struct/source/.arch-ids/bar.c.id t/02_struct/source/bar.c test.pl modified files: CDecl.pm ChangeLog typegen.pl new directories: t t/.arch-ids t/00_empty t/00_empty/.arch-ids t/00_empty/source t/00_empty/source/.arch-ids t/01_fundamental t/01_fundamental/.arch-ids t/01_fundamental/source t/01_fundamental/source/.arch-ids t/02_struct t/02_struct/.arch-ids t/02_struct/source t/02_struct/source/.arch-ids 2005-06-24 17:14:32 GMT Andrew Suffield patch-25 Summary: fix baseline processing Revision: icheck--main--0--patch-25 modified files: CParse/Namespace.pm ChangeLog 2005-06-19 12:45:00 GMT Andrew Suffield patch-24 Summary: fix baseline argument parsing Revision: icheck--main--0--patch-24 modified files: ChangeLog icheck 2005-06-17 14:44:14 GMT Andrew Suffield patch-23 Summary: fix a method call on an undefined object Revision: icheck--main--0--patch-23 modified files: CParse/Namespace.pm ChangeLog 2005-06-17 09:19:53 GMT Andrew Suffield patch-22 Summary: add --baseline support Revision: icheck--main--0--patch-22 modified files: CParse/Namespace.pm ChangeLog NEWS icheck 2005-05-08 19:08:41 GMT Andrew Suffield patch-21 Summary: handle characters as expressions Revision: icheck--main--0--patch-21 modified files: CParse.pm CParse/Char.pm ChangeLog 2005-03-25 21:14:45 GMT Andrew Suffield patch-20 Summary: fix the matching of struct members for comparison Revision: icheck--main--0--patch-20 modified files: CType/Struct.pm ChangeLog NEWS 2005-03-25 17:41:22 GMT Andrew Suffield patch-19 Summary: fix checking of enums Revision: icheck--main--0--patch-19 modified files: CParse/Namespace.pm CType/Enum.pm ChangeLog 2005-03-25 16:49:41 GMT Andrew Suffield patch-18 Summary: fix braindamage in typedef dumping Revision: icheck--main--0--patch-18 modified files: CParse/Namespace.pm ChangeLog 2005-03-25 16:29:11 GMT Andrew Suffield patch-17 Summary: implement CExpr::Cast::convert Revision: icheck--main--0--patch-17 modified files: CDecl.pm CExpr/Cast.pm CType/Fundamental.pm ChangeLog NEWS 2005-03-23 22:57:47 GMT Andrew Suffield patch-16 Summary: fix up the string parsing Revision: icheck--main--0--patch-16 modified files: CParse/Parser/Perl.pm ChangeLog 2005-03-23 22:39:13 GMT Andrew Suffield patch-15 Summary: implement parsing of asm expressions, string concatenation, __extension__ expressions, __inline Revision: icheck--main--0--patch-15 modified files: CParse/Parser/Perl.pm CParse/Parser/Token/Keyword.pm CParse/Parser/Token/String.pm ChangeLog 2005-03-23 22:07:02 GMT Andrew Suffield patch-14 Summary: implement parsing of asm labels Revision: icheck--main--0--patch-14 modified files: CParse/Parser/Perl.pm CParse/Parser/Token/Keyword.pm ChangeLog 2005-03-23 22:00:21 GMT Andrew Suffield patch-13 Summary: fix include path Revision: icheck--main--0--patch-13 modified files: ChangeLog icheck 2005-03-20 06:23:40 GMT Andrew Suffield patch-12 Summary: fix NEWS file Revision: icheck--main--0--patch-12 modified files: ChangeLog NEWS 2005-03-20 06:22:20 GMT Andrew Suffield patch-11 Summary: add install target to Makefile Revision: icheck--main--0--patch-11 modified files: ChangeLog Makefile 2005-03-20 05:53:13 GMT Andrew Suffield patch-10 Summary: adjust module search paths Revision: icheck--main--0--patch-10 modified files: ChangeLog icheck 2005-03-19 15:47:56 GMT Andrew Suffield patch-9 Summary: add the usual documentation cocktail Revision: icheck--main--0--patch-9 new files: .arch-ids/COPYING.id .arch-ids/ChangeLog.id .arch-ids/LICENSE.id .arch-ids/NEWS.id .arch-ids/README.id COPYING ChangeLog LICENSE NEWS README 2005-03-19 14:39:10 GMT Andrew Suffield patch-8 Summary: fix a few bugs Revision: icheck--main--0--patch-8 modified files: CDecl.pm CType/Function.pm CType/Pointer.pm CType/Ref.pm CType/Struct.pm 2005-03-19 12:47:46 GMT Andrew Suffield patch-7 Summary: finish support for bitfields Revision: icheck--main--0--patch-7 modified files: CParse/Namespace.pm CType.pm CType/BitField.pm CType/Struct.pm icheck 2005-03-13 12:56:29 GMT Andrew Suffield patch-6 Summary: fix various obscure C features Revision: icheck--main--0--patch-6 new files: CExpr/.arch-ids/Alignof.pm.id CExpr/Alignof.pm CParse/Op/.arch-ids/Alignof.pm.id CParse/Op/Alignof.pm modified files: CParse/Parser/Perl.pm CParse/Parser/Token/Keyword.pm CParse/Pointer.pm CType/Array.pm CType/Pointer.pm 2005-03-13 05:29:56 GMT Andrew Suffield patch-5 Summary: add support for self-referential enums Revision: icheck--main--0--patch-5 new files: CDecl/.arch-ids/=id CDecl/.arch-ids/Enumerator.pm.id CDecl/Enumerator.pm CExpr/.arch-ids/Ref.pm.id CExpr/Ref.pm modified files: CDecl.pm CExpr/Add.pm CExpr/ArraySubscript.pm CExpr/Assign/Add.pm CExpr/Assign/BitAnd.pm CExpr/Assign/BitOr.pm CExpr/Assign/BitXor.pm CExpr/Assign/Divide.pm CExpr/Assign/Modulus.pm CExpr/Assign/Multiply.pm CExpr/Assign/ShiftLeft.pm CExpr/Assign/ShiftRight.pm CExpr/Assign/Subtract.pm CExpr/BitAnd.pm CExpr/BitOr.pm CExpr/BitXor.pm CExpr/BoolAnd.pm CExpr/BoolOr.pm CExpr/Cast.pm CExpr/Conditional.pm CExpr/Divide.pm CExpr/Equal.pm CExpr/Greater.pm CExpr/GreaterEqual.pm CExpr/Less.pm CExpr/LessEqual.pm CExpr/Member.pm CExpr/MemberIndirect.pm CExpr/Modulus.pm CExpr/Multiply.pm CExpr/NotEqual.pm CExpr/Postdec.pm CExpr/Postinc.pm CExpr/Predec.pm CExpr/Preinc.pm CExpr/SeqExpression.pm CExpr/ShiftLeft.pm CExpr/ShiftRight.pm CExpr/Sizeof.pm CExpr/SizeofExpr.pm CExpr/Subtract.pm CExpr/Unary/AddressOf.pm CExpr/Unary/BitNot.pm CExpr/Unary/BoolNot.pm CExpr/Unary/Deref.pm CExpr/Unary/Negative.pm CExpr/Unary/Positive.pm CParse.pm CParse/Declarator/Array.pm CParse/Enum.pm CParse/Identifier.pm CParse/Namespace.pm CParse/Parser/Perl.pm CType/Array.pm CType/Enum.pm CType/Function.pm CType/Ref.pm CType/Struct.pm CType/Union.pm icheck new directories: CDecl CDecl/.arch-ids 2005-03-12 15:15:57 GMT Andrew Suffield patch-4 Summary: fill in most of the operators Revision: icheck--main--0--patch-4 new files: CExpr/.arch-ids/ArraySubscript.pm.id CExpr/.arch-ids/BitAnd.pm.id CExpr/.arch-ids/BitOr.pm.id CExpr/.arch-ids/BitXor.pm.id CExpr/.arch-ids/BoolAnd.pm.id CExpr/.arch-ids/BoolOr.pm.id CExpr/.arch-ids/Cast.pm.id CExpr/.arch-ids/Conditional.pm.id CExpr/.arch-ids/Equal.pm.id CExpr/.arch-ids/Greater.pm.id CExpr/.arch-ids/GreaterEqual.pm.id CExpr/.arch-ids/Less.pm.id CExpr/.arch-ids/LessEqual.pm.id CExpr/.arch-ids/Member.pm.id CExpr/.arch-ids/MemberIndirect.pm.id CExpr/.arch-ids/NotEqual.pm.id CExpr/.arch-ids/Postdec.pm.id CExpr/.arch-ids/Postinc.pm.id CExpr/.arch-ids/Predec.pm.id CExpr/.arch-ids/Preinc.pm.id CExpr/.arch-ids/SeqExpression.pm.id CExpr/.arch-ids/ShiftLeft.pm.id CExpr/.arch-ids/ShiftRight.pm.id CExpr/.arch-ids/SizeofExpr.pm.id CExpr/ArraySubscript.pm CExpr/Assign/.arch-ids/=id CExpr/Assign/.arch-ids/Add.pm.id CExpr/Assign/.arch-ids/BitAnd.pm.id CExpr/Assign/.arch-ids/BitOr.pm.id CExpr/Assign/.arch-ids/BitXor.pm.id CExpr/Assign/.arch-ids/Divide.pm.id CExpr/Assign/.arch-ids/Modulus.pm.id CExpr/Assign/.arch-ids/Multiply.pm.id CExpr/Assign/.arch-ids/ShiftLeft.pm.id CExpr/Assign/.arch-ids/ShiftRight.pm.id CExpr/Assign/.arch-ids/Subtract.pm.id CExpr/Assign/Add.pm CExpr/Assign/BitAnd.pm CExpr/Assign/BitOr.pm CExpr/Assign/BitXor.pm CExpr/Assign/Divide.pm CExpr/Assign/Modulus.pm CExpr/Assign/Multiply.pm CExpr/Assign/ShiftLeft.pm CExpr/Assign/ShiftRight.pm CExpr/Assign/Subtract.pm CExpr/BitAnd.pm CExpr/BitOr.pm CExpr/BitXor.pm CExpr/BoolAnd.pm CExpr/BoolOr.pm CExpr/Cast.pm CExpr/Conditional.pm CExpr/Equal.pm CExpr/Greater.pm CExpr/GreaterEqual.pm CExpr/Less.pm CExpr/LessEqual.pm CExpr/Member.pm CExpr/MemberIndirect.pm CExpr/NotEqual.pm CExpr/Postdec.pm CExpr/Postinc.pm CExpr/Predec.pm CExpr/Preinc.pm CExpr/SeqExpression.pm CExpr/ShiftLeft.pm CExpr/ShiftRight.pm CExpr/SizeofExpr.pm CExpr/Unary/.arch-ids/=id CExpr/Unary/.arch-ids/AddressOf.pm.id CExpr/Unary/.arch-ids/BitNot.pm.id CExpr/Unary/.arch-ids/BoolNot.pm.id CExpr/Unary/.arch-ids/Deref.pm.id CExpr/Unary/.arch-ids/Negative.pm.id CExpr/Unary/.arch-ids/Positive.pm.id CExpr/Unary/AddressOf.pm CExpr/Unary/BitNot.pm CExpr/Unary/BoolNot.pm CExpr/Unary/Deref.pm CExpr/Unary/Negative.pm CExpr/Unary/Positive.pm modified files: CDecl.pm CExpr.pm CExpr/Add.pm CExpr/Divide.pm CExpr/Integer.pm CExpr/Modulus.pm CExpr/Multiply.pm CExpr/Subtract.pm CParse/Op/ArraySubscript.pm CParse/Op/Assign/Add.pm CParse/Op/Assign/BitAnd.pm CParse/Op/Assign/BitOr.pm CParse/Op/Assign/BitXor.pm CParse/Op/Assign/Divide.pm CParse/Op/Assign/Modulus.pm CParse/Op/Assign/Multiply.pm CParse/Op/Assign/ShiftLeft.pm CParse/Op/Assign/ShiftRight.pm CParse/Op/Assign/Subtract.pm CParse/Op/BitAnd.pm CParse/Op/BitOr.pm CParse/Op/BitXor.pm CParse/Op/BoolAnd.pm CParse/Op/BoolOr.pm CParse/Op/Cast.pm CParse/Op/Conditional.pm CParse/Op/Equal.pm CParse/Op/Expression.pm CParse/Op/Member.pm CParse/Op/MemberIndirect.pm CParse/Op/NotEqual.pm CParse/Op/Postdec.pm CParse/Op/Postinc.pm CParse/Op/Predec.pm CParse/Op/Preinc.pm CParse/Op/Relation/Greater.pm CParse/Op/Relation/GreaterEqual.pm CParse/Op/Relation/Less.pm CParse/Op/Relation/LessEqual.pm CParse/Op/Shift/Left.pm CParse/Op/Shift/Right.pm CParse/Op/SizeofExpr.pm CParse/Op/Unary/AddressOf.pm CParse/Op/Unary/BitNot.pm CParse/Op/Unary/BoolNot.pm CParse/Op/Unary/Deref.pm CParse/Op/Unary/Negative.pm CParse/Op/Unary/Positive.pm CParse/Parser/Perl.pm new directories: CExpr/Assign CExpr/Assign/.arch-ids CExpr/Unary CExpr/Unary/.arch-ids 2005-03-09 01:15:53 GMT Andrew Suffield patch-3 Summary: finish cleaning up icheck Revision: icheck--main--0--patch-3 modified files: icheck 2005-03-09 01:01:12 GMT Andrew Suffield patch-2 Summary: fix enum checking Revision: icheck--main--0--patch-2 modified files: CExpr.pm CExpr/Add.pm CExpr/Divide.pm CExpr/Integer.pm CExpr/Modulus.pm CExpr/Multiply.pm CExpr/Sizeof.pm CExpr/Subtract.pm CParse/EnumRef.pm CType/Array.pm CType/Enum.pm CType/Ref.pm CType/Struct.pm CType/Union.pm 2005-03-08 22:35:47 GMT Andrew Suffield patch-1 Summary: add enum support Revision: icheck--main--0--patch-1 modified files: CExpr/Add.pm CExpr/Divide.pm CExpr/Integer.pm CExpr/Modulus.pm CExpr/Multiply.pm CExpr/Sizeof.pm CExpr/Subtract.pm CParse/Enum.pm CParse/Enumerator.pm CParse/Parser/Perl.pm CType.pm CType/Array.pm CType/Enum.pm CType/Fundamental.pm CType/Ref.pm CType/Struct.pm CType/Union.pm Makefile typegen.pl 2005-03-08 18:01:51 GMT Andrew Suffield base-0 Summary: initial import Revision: icheck--main--0--base-0 (automatically generated log message) new files: .arch-ids/.arch-inventory.id .arch-ids/CDecl.pm.id .arch-ids/CExpr.pm.id .arch-ids/CParse.pm.id .arch-ids/CType.pm.id .arch-ids/Makefile.id .arch-ids/icheck.id .arch-ids/typegen.pl.id .arch-inventory CDecl.pm CExpr.pm CExpr/.arch-ids/=id CExpr/.arch-ids/Add.pm.id CExpr/.arch-ids/Divide.pm.id CExpr/.arch-ids/Integer.pm.id CExpr/.arch-ids/Modulus.pm.id CExpr/.arch-ids/Multiply.pm.id CExpr/.arch-ids/Sizeof.pm.id CExpr/.arch-ids/Subtract.pm.id CExpr/Add.pm CExpr/Divide.pm CExpr/Integer.pm CExpr/Modulus.pm CExpr/Multiply.pm CExpr/Sizeof.pm CExpr/Subtract.pm CParse.pm CParse/.arch-ids/=id CParse/.arch-ids/Attribute.pm.id CParse/.arch-ids/AttributeList.pm.id CParse/.arch-ids/Char.pm.id CParse/.arch-ids/Declaration.pm.id CParse/.arch-ids/Declarator.pm.id CParse/.arch-ids/Enum.pm.id CParse/.arch-ids/EnumRef.pm.id CParse/.arch-ids/Enumerator.pm.id CParse/.arch-ids/Extension.pm.id CParse/.arch-ids/Float.pm.id CParse/.arch-ids/Function.pm.id CParse/.arch-ids/FunctionSpecifier.pm.id CParse/.arch-ids/Identifier.pm.id CParse/.arch-ids/Integer.pm.id CParse/.arch-ids/Namespace.pm.id CParse/.arch-ids/Op.pm.id CParse/.arch-ids/ParameterDeclaration.pm.id CParse/.arch-ids/Pointer.pm.id CParse/.arch-ids/StorageClass.pm.id CParse/.arch-ids/String.pm.id CParse/.arch-ids/Struct.pm.id CParse/.arch-ids/StructDeclaration.pm.id CParse/.arch-ids/StructDeclarator.pm.id CParse/.arch-ids/StructRef.pm.id CParse/.arch-ids/TypeName.pm.id CParse/.arch-ids/TypeQualifier.pm.id CParse/.arch-ids/TypeSpecifier.pm.id CParse/.arch-ids/Union.pm.id CParse/.arch-ids/UnionRef.pm.id CParse/Attribute.pm CParse/AttributeList.pm CParse/Char.pm CParse/Declaration.pm CParse/Declarator.pm CParse/Declarator/.arch-ids/=id CParse/Declarator/.arch-ids/Array.pm.id CParse/Declarator/.arch-ids/Direct.pm.id CParse/Declarator/.arch-ids/Function.pm.id CParse/Declarator/Array.pm CParse/Declarator/Direct.pm CParse/Declarator/Function.pm CParse/Enum.pm CParse/EnumRef.pm CParse/Enumerator.pm CParse/Extension.pm CParse/Float.pm CParse/Function.pm CParse/FunctionSpecifier.pm CParse/Identifier.pm CParse/Integer.pm CParse/Namespace.pm CParse/Op.pm CParse/Op/.arch-ids/=id CParse/Op/.arch-ids/Add.pm.id CParse/Op/.arch-ids/ArraySubscript.pm.id CParse/Op/.arch-ids/Assign.pm.id CParse/Op/.arch-ids/BitAnd.pm.id CParse/Op/.arch-ids/BitOr.pm.id CParse/Op/.arch-ids/BitXor.pm.id CParse/Op/.arch-ids/BoolAnd.pm.id CParse/Op/.arch-ids/BoolOr.pm.id CParse/Op/.arch-ids/Call.pm.id CParse/Op/.arch-ids/Cast.pm.id CParse/Op/.arch-ids/Conditional.pm.id CParse/Op/.arch-ids/Divide.pm.id CParse/Op/.arch-ids/Equal.pm.id CParse/Op/.arch-ids/Expression.pm.id CParse/Op/.arch-ids/Member.pm.id CParse/Op/.arch-ids/MemberIndirect.pm.id CParse/Op/.arch-ids/Modulus.pm.id CParse/Op/.arch-ids/Multiply.pm.id CParse/Op/.arch-ids/NotEqual.pm.id CParse/Op/.arch-ids/Postdec.pm.id CParse/Op/.arch-ids/Postfix.pm.id CParse/Op/.arch-ids/Postinc.pm.id CParse/Op/.arch-ids/Predec.pm.id CParse/Op/.arch-ids/Preinc.pm.id CParse/Op/.arch-ids/Relation.pm.id CParse/Op/.arch-ids/Shift.pm.id CParse/Op/.arch-ids/Sizeof.pm.id CParse/Op/.arch-ids/SizeofExpr.pm.id CParse/Op/.arch-ids/Subtract.pm.id CParse/Op/.arch-ids/Unary.pm.id CParse/Op/Add.pm CParse/Op/ArraySubscript.pm CParse/Op/Assign.pm CParse/Op/Assign/.arch-ids/=id CParse/Op/Assign/.arch-ids/Add.pm.id CParse/Op/Assign/.arch-ids/BitAnd.pm.id CParse/Op/Assign/.arch-ids/BitOr.pm.id CParse/Op/Assign/.arch-ids/BitXor.pm.id CParse/Op/Assign/.arch-ids/Divide.pm.id CParse/Op/Assign/.arch-ids/Modulus.pm.id CParse/Op/Assign/.arch-ids/Multiply.pm.id CParse/Op/Assign/.arch-ids/ShiftLeft.pm.id CParse/Op/Assign/.arch-ids/ShiftRight.pm.id CParse/Op/Assign/.arch-ids/Subtract.pm.id CParse/Op/Assign/Add.pm CParse/Op/Assign/BitAnd.pm CParse/Op/Assign/BitOr.pm CParse/Op/Assign/BitXor.pm CParse/Op/Assign/Divide.pm CParse/Op/Assign/Modulus.pm CParse/Op/Assign/Multiply.pm CParse/Op/Assign/ShiftLeft.pm CParse/Op/Assign/ShiftRight.pm CParse/Op/Assign/Subtract.pm CParse/Op/BitAnd.pm CParse/Op/BitOr.pm CParse/Op/BitXor.pm CParse/Op/BoolAnd.pm CParse/Op/BoolOr.pm CParse/Op/Call.pm CParse/Op/Cast.pm CParse/Op/Conditional.pm CParse/Op/Divide.pm CParse/Op/Equal.pm CParse/Op/Expression.pm CParse/Op/Member.pm CParse/Op/MemberIndirect.pm CParse/Op/Modulus.pm CParse/Op/Multiply.pm CParse/Op/NotEqual.pm CParse/Op/Postdec.pm CParse/Op/Postfix.pm CParse/Op/Postinc.pm CParse/Op/Predec.pm CParse/Op/Preinc.pm CParse/Op/Relation.pm CParse/Op/Relation/.arch-ids/=id CParse/Op/Relation/.arch-ids/Greater.pm.id CParse/Op/Relation/.arch-ids/GreaterEqual.pm.id CParse/Op/Relation/.arch-ids/Less.pm.id CParse/Op/Relation/.arch-ids/LessEqual.pm.id CParse/Op/Relation/Greater.pm CParse/Op/Relation/GreaterEqual.pm CParse/Op/Relation/Less.pm CParse/Op/Relation/LessEqual.pm CParse/Op/Shift.pm CParse/Op/Shift/.arch-ids/=id CParse/Op/Shift/.arch-ids/Left.pm.id CParse/Op/Shift/.arch-ids/Right.pm.id CParse/Op/Shift/Left.pm CParse/Op/Shift/Right.pm CParse/Op/Sizeof.pm CParse/Op/SizeofExpr.pm CParse/Op/Subtract.pm CParse/Op/Unary.pm CParse/Op/Unary/.arch-ids/=id CParse/Op/Unary/.arch-ids/AddressOf.pm.id CParse/Op/Unary/.arch-ids/BitNot.pm.id CParse/Op/Unary/.arch-ids/BoolNot.pm.id CParse/Op/Unary/.arch-ids/Deref.pm.id CParse/Op/Unary/.arch-ids/Negative.pm.id CParse/Op/Unary/.arch-ids/Positive.pm.id CParse/Op/Unary/AddressOf.pm CParse/Op/Unary/BitNot.pm CParse/Op/Unary/BoolNot.pm CParse/Op/Unary/Deref.pm CParse/Op/Unary/Negative.pm CParse/Op/Unary/Positive.pm CParse/ParameterDeclaration.pm CParse/Parser/.arch-ids/=id CParse/Parser/.arch-ids/Perl.pm.id CParse/Parser/Perl.pm CParse/Parser/Token/.arch-ids/=id CParse/Parser/Token/.arch-ids/Character.pm.id CParse/Parser/Token/.arch-ids/Float.pm.id CParse/Parser/Token/.arch-ids/Identifier.pm.id CParse/Parser/Token/.arch-ids/Integer.pm.id CParse/Parser/Token/.arch-ids/Keyword.pm.id CParse/Parser/Token/.arch-ids/Punctuator.pm.id CParse/Parser/Token/.arch-ids/String.pm.id CParse/Parser/Token/Character.pm CParse/Parser/Token/Float.pm CParse/Parser/Token/Identifier.pm CParse/Parser/Token/Integer.pm CParse/Parser/Token/Keyword.pm CParse/Parser/Token/Punctuator.pm CParse/Parser/Token/String.pm CParse/Pointer.pm CParse/StorageClass.pm CParse/String.pm CParse/Struct.pm CParse/StructDeclaration.pm CParse/StructDeclarator.pm CParse/StructRef.pm CParse/TypeName.pm CParse/TypeQualifier.pm CParse/TypeSpecifier.pm CParse/Union.pm CParse/UnionRef.pm CType.pm CType/.arch-ids/.arch-inventory.id CType/.arch-ids/=id CType/.arch-ids/Array.pm.id CType/.arch-ids/BitField.pm.id CType/.arch-ids/Builtin.pm.id CType/.arch-ids/Enum.pm.id CType/.arch-ids/Function.pm.id CType/.arch-ids/Fundamental.pm.id CType/.arch-ids/Pointer.pm.id CType/.arch-ids/Ref.pm.id CType/.arch-ids/Struct.pm.id CType/.arch-ids/Union.pm.id CType/.arch-inventory CType/Array.pm CType/BitField.pm CType/Builtin.pm CType/Enum.pm CType/Function.pm CType/Fundamental.pm CType/Pointer.pm CType/Ref.pm CType/Struct.pm CType/Union.pm Makefile icheck typegen.pl icheck-0.9.7/test_xsub.pl0000755000175000017500000000476410273204251016032 0ustar asuffieldasuffield#!/usr/bin/perl use strict; use 5.6.0; use warnings; use File::Spec; use POSIX; use Text::Diff; use File::Find; use IO::Handle; use IPC::Open3; use IO::File; my $fail = 0; sub compare_str { my $desc = shift; my $expect = shift; my $got = shift; return if $expect eq $got; print STDERR "Differences in $desc\n"; if (length $expect) { diff \$expect, \$got, {STYLE => 'Unified', OUTPUT => \*STDOUT}; } else { print STDERR "Expected nothing, got:\n"; print STDERR "---\n"; print STDERR $got; print STDERR "---\n" } $fail = 1; } sub compare_int { my $desc = shift; my $expect = shift; my $got = shift; return if $expect == $got; print STDERR "Differences in $desc: expected $expect, got $got\n"; $fail = 1; } my ($perl_output, $perl_errors, $perl_result) = ("", "", undef); { my ($write, $read, $err) = (new IO::Handle, new IO::Handle, new IO::Handle); $ENV{ICHECK_PARSER_XSUB} = 0; my @cmd = ('./icheck', @ARGV); if ($ENV{TEST_VERBOSE}) { print "ICHECK_PARSER_XSUB=0 " . join(' ', @cmd) . "\n"; } my $pid = open3($write, $read, $err, @cmd); close $write; $perl_output .= $_ while <$read>; close $read; $perl_errors .= $_ while <$err>; close $err; waitpid $pid, 0; if (WIFSIGNALED($?)) { die "icheck killed by signal " . WTERMSIG($?) . "\n"; } unless (WIFEXITED($?)) { die "icheck died wierdly (waitpid gave $?)\n"; } $perl_result = WEXITSTATUS($?); } if (length $perl_errors) { print STDERR $perl_errors; } print STDOUT $perl_output; my ($xsub_output, $xsub_errors, $xsub_result) = ("", "", undef); { my ($write, $read, $err) = (new IO::Handle, new IO::Handle, new IO::Handle); $ENV{ICHECK_PARSER_XSUB} = 1; my @cmd = ('./icheck', @ARGV); if ($ENV{TEST_VERBOSE}) { print "ICHECK_PARSER_XSUB=1 " . join(' ', @cmd) . "\n"; } my $pid = open3($write, $read, $err, @cmd); close $write; $xsub_output .= $_ while <$read>; close $read; $xsub_errors .= $_ while <$err>; close $err; waitpid $pid, 0; if (WIFSIGNALED($?)) { die "icheck killed by signal " . WTERMSIG($?) . "\n"; } unless (WIFEXITED($?)) { die "icheck died wierdly (waitpid gave $?)\n"; } $xsub_result = WEXITSTATUS($?); } compare_str('output', $perl_errors, $xsub_errors); compare_str('errors', $perl_errors, $xsub_errors); compare_int('result', $perl_result, $xsub_result); exit 1 if $fail; icheck-0.9.7/{arch}/0000755000175000017500000000000010273204214014743 5ustar asuffieldasuffieldicheck-0.9.7/{arch}/=tagging-method0000644000175000017500000001506210273204214017665 0ustar asuffieldasuffield# id tagging method # # This determines how "inventory ids", strings conveying # logical file identity, are computed for each file, directory # and symbolic link. # # The choices are: # # tagline: inventory ids may be set using add-id, or omitted # (though tree-lint warns about omitted ids), or in # text files, set in a comment line near the top or # bottom of the file of a form like " arch-tag: ". # Renames of files with no id are treated as a combined # add and delete (e.g., local changes can be lost). # # explicit: ids must be set using add-id. Files passing the naming # conventions for source, but lacking add-id ids, are treated # as unrecognized files (see below). # # names: ids are not used. All renames are treated as add+delete # # implicit: similar to tagline, but in addition, the id comment # may be of the form " - ", where # is the basename of the file. This method # is not recommended, but is retained for backwards # compatibility. # explicit # disposition of untagged source files # # (NOTE: this option must follow the tagline/explicit/names/implicit # directive.) # # By default, the explicit method treats untagged files matching the naming # conventions for source files as unrecognized and the implicit and tagline # methods treat such untagged files as source. # # You can override those default treatments of untagged files by specifying # which inventory category (see below) should be used for files whose names # suggest they are source but which lack ids. # # This feature may be especially convenient when importing sources that do # not use file naming conventions that can be conveniently described with # the regexps below. # # Uncomment one of these lines as appropriate to override the default: # # untagged-source source # untagged-source precious # untagged-source backup # untagged-source junk untagged-source unrecognized # # naming convention regexps # # For various commands, arch traverses your project trees, categorizing # the files found there. For example, when importing a project for # the first time, this traversal determines which files are included # in the import. # # The categories of greatest importance are defined in terms of three # questions: # # 1) If arch makes a local copy of this tree, should this file be included # in the copy? # # 2) Is it generally safe to remove this file based only on how it is named? # For example, can it be safely clobbered by a new file of the same name? # # 3) Should this file be archived along with the project? For example, # should it be included when importing the project for the first time? # # The primary categories are: # # category: copy locally? safe to clobber? archive? # # junk no yes no # backup no no no # precious yes no no # source yes no yes # # There are two additional categories, unrelated to those questions: # # excluded -- during a traversal by inventory, this file (and, # if a directory, its contents) are simply ignored unless the # --all flag is specified. This category is usually used to # omit arch's own control files from a listing. # # unrecognized -- a category for files whose name fits no other pattern. # Usually, the presence of unrecognized files is treated as an # error. You can use the naming conventions to define certain # names as "deliberately unrecognized" -- i.e., filenames whose # presence in a source tree you _want_ to be treated as an error # # The traveral algorithm is described here, along with lines you can edit to # customize the naming conventions. # # Starting at "." within a project tree (usually at the root of the # project tree) consider each filename in that directory. # # The files "." and ".." are simply ignored. # # Files containing "illegal characters" are characterized as unrecognized. # If they are directories, traversal does _not_ descend into those directories. # Currently, the illegal characters are *, ?, [, ], \, space, and tab. # (The set of illegal characters may shrink in future releases.) # # In an interactive call to inventory _without_ the --all flag, # names are next compared to the exclude regexp defined here. Those that # are ignored and not descended below. (Most arch operations performing # traversals internally, e.g. import, do not use this pattern # and skip this step of the algorithm. # exclude ^(.arch-ids|\{arch\}|\.arch-inventory)$ # If the file has a name that begins with "++", it is categorized as # _precious_. Names of this form are hard-wired and reserved for use by arch # itself. Traversal does not descend into precious directories, but when a # precious directory is copied, its contents are recursively copied. # # Files and directories that reach this stage and which arch recognizes as its # own control files are classified at this step as source. Traversal _does_ # descend into source directories. # # If the file has a name that begins with ",,", it is categorized as _junk_. # Names of this form are hard-wired and reserved for use by arch and other tools, # and arch may clobber such files without warning. In a project tree, when no # arch commands are running, it is safe for users to delete any ",," files. # Although the general rule for junk files is that arch is free to clobber them, # in fact, arch will only ever clobber files starting with ",,". # # Traversal does not descend into junk directories. # # For your convenience, at this step of the traversal, you can classify # additional files as junk or precious: # junk ^(,.*)$ precious ^(\+.*)$ # Files matching the following regexp are classified as backup files, and # traversal does not descend into backup directories: # backup ^.*(~|\.~[0-9]+~|\.bak|\.swp|\.orig|\.rej|\.original|\.modified|\.reject|\.(o|a|so|core|so(\.[[:digit:]]+)*))$|^core$ # If you want to force certain filenames to be treated as errors when present, # you can add them to the regexp for deliberately unrecognized files. Traversal # does not descend into unrecognized directories. unrecognized ^$ # Files which match the following pattern are treated as source files. # Traversal _does_ descend into source directories: source . # Any files not classified by the above rules are classified as unrecognized. # Traversal does not descend into unrecognized directories. icheck-0.9.7/{arch}/.arch-project-tree0000644000175000017500000000006410273204214020262 0ustar asuffieldasuffieldHackerlab arch project directory, format version 1. icheck-0.9.7/{arch}/icheck/0000755000175000017500000000000010273204214016171 5ustar asuffieldasuffieldicheck-0.9.7/{arch}/icheck/icheck--main/0000755000175000017500000000000010273204214020416 5ustar asuffieldasuffieldicheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/0000755000175000017500000000000010273204214023055 5ustar asuffieldasuffieldicheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/0000755000175000017500000000000010273204214030614 5ustar asuffieldasuffieldicheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/0000755000175000017500000000000010273455727032513 5ustar asuffieldasuffield././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-17icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000062310273204214032655 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-17 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Fri Mar 25 16:29:11 GMT 2005 Standard-date: 2005-03-25 16:29:11 GMT Modified-files: CDecl.pm CExpr/Cast.pm CType/Fundamental.pm ChangeLog NEWS New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-17 Summary: implement CExpr::Cast::convert Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-16icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000055710273204214032663 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-16 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Wed Mar 23 22:57:47 GMT 2005 Standard-date: 2005-03-23 22:57:47 GMT Modified-files: CParse/Parser/Perl.pm ChangeLog New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-16 Summary: fix up the string parsing Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-20icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000060610273204214032656 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-20 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Fri Mar 25 21:14:45 GMT 2005 Standard-date: 2005-03-25 21:14:45 GMT Modified-files: CType/Struct.pm ChangeLog NEWS New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-20 Summary: fix the matching of struct members for comparison Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-31icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000060210273204214032652 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-31 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Wed Jul 6 19:46:37 BST 2005 Standard-date: 2005-07-06 18:46:37 GMT New-files: .arch-ids/icheck.1.id icheck.1 Modified-files: ChangeLog icheck New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-31 Summary: add basic manpage Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-36icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000075010273204251032657 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-36 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sun Jul 31 02:59:04 BST 2005 Standard-date: 2005-07-31 01:59:04 GMT New-files: .arch-ids/test_xsub.pl.id test_xsub.pl Modified-files: ChangeLog Makefile ext/CParse-Parser-PerlXS/PerlXS.pm ext/CParse-Parser-PerlXS/PerlXS.xs New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-36 Summary: finish implementing xsub parser Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-43icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000111410273455727032672 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-43 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Mon Aug 1 18:27:22 BST 2005 Standard-date: 2005-08-01 17:27:22 GMT New-files: CType/.arch-ids/Structural.pm.id CType/Structural.pm Modified-files: CType.pm CType/Enum.pm CType/Fundamental.pm CType/Struct.pm CType/Union.pm ChangeLog t/04_align/canonical t/04_align/diff t/04_align/original t/04_align/source/foo.c New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-43 Summary: more fixes to alignment handling Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-39icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000053110273207513032660 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-39 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sun Jul 31 18:49:50 BST 2005 Standard-date: 2005-07-31 17:49:50 GMT Modified-files: ChangeLog Makefile New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-39 Summary: fix clean target Keywords: ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-4icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000001000510273204214032650 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-4 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sat Mar 12 15:15:57 GMT 2005 Standard-date: 2005-03-12 15:15:57 GMT New-files: CExpr/.arch-ids/ArraySubscript.pm.id CExpr/.arch-ids/BitAnd.pm.id CExpr/.arch-ids/BitOr.pm.id CExpr/.arch-ids/BitXor.pm.id CExpr/.arch-ids/BoolAnd.pm.id CExpr/.arch-ids/BoolOr.pm.id CExpr/.arch-ids/Cast.pm.id CExpr/.arch-ids/Conditional.pm.id CExpr/.arch-ids/Equal.pm.id CExpr/.arch-ids/Greater.pm.id CExpr/.arch-ids/GreaterEqual.pm.id CExpr/.arch-ids/Less.pm.id CExpr/.arch-ids/LessEqual.pm.id CExpr/.arch-ids/Member.pm.id CExpr/.arch-ids/MemberIndirect.pm.id CExpr/.arch-ids/NotEqual.pm.id CExpr/.arch-ids/Postdec.pm.id CExpr/.arch-ids/Postinc.pm.id CExpr/.arch-ids/Predec.pm.id CExpr/.arch-ids/Preinc.pm.id CExpr/.arch-ids/SeqExpression.pm.id CExpr/.arch-ids/ShiftLeft.pm.id CExpr/.arch-ids/ShiftRight.pm.id CExpr/.arch-ids/SizeofExpr.pm.id CExpr/ArraySubscript.pm CExpr/Assign/.arch-ids/=id CExpr/Assign/.arch-ids/Add.pm.id CExpr/Assign/.arch-ids/BitAnd.pm.id CExpr/Assign/.arch-ids/BitOr.pm.id CExpr/Assign/.arch-ids/BitXor.pm.id CExpr/Assign/.arch-ids/Divide.pm.id CExpr/Assign/.arch-ids/Modulus.pm.id CExpr/Assign/.arch-ids/Multiply.pm.id CExpr/Assign/.arch-ids/ShiftLeft.pm.id CExpr/Assign/.arch-ids/ShiftRight.pm.id CExpr/Assign/.arch-ids/Subtract.pm.id CExpr/Assign/Add.pm CExpr/Assign/BitAnd.pm CExpr/Assign/BitOr.pm CExpr/Assign/BitXor.pm CExpr/Assign/Divide.pm CExpr/Assign/Modulus.pm CExpr/Assign/Multiply.pm CExpr/Assign/ShiftLeft.pm CExpr/Assign/ShiftRight.pm CExpr/Assign/Subtract.pm CExpr/BitAnd.pm CExpr/BitOr.pm CExpr/BitXor.pm CExpr/BoolAnd.pm CExpr/BoolOr.pm CExpr/Cast.pm CExpr/Conditional.pm CExpr/Equal.pm CExpr/Greater.pm CExpr/GreaterEqual.pm CExpr/Less.pm CExpr/LessEqual.pm CExpr/Member.pm CExpr/MemberIndirect.pm CExpr/NotEqual.pm CExpr/Postdec.pm CExpr/Postinc.pm CExpr/Predec.pm CExpr/Preinc.pm CExpr/SeqExpression.pm CExpr/ShiftLeft.pm CExpr/ShiftRight.pm CExpr/SizeofExpr.pm CExpr/Unary/.arch-ids/=id CExpr/Unary/.arch-ids/AddressOf.pm.id CExpr/Unary/.arch-ids/BitNot.pm.id CExpr/Unary/.arch-ids/BoolNot.pm.id CExpr/Unary/.arch-ids/Deref.pm.id CExpr/Unary/.arch-ids/Negative.pm.id CExpr/Unary/.arch-ids/Positive.pm.id CExpr/Unary/AddressOf.pm CExpr/Unary/BitNot.pm CExpr/Unary/BoolNot.pm CExpr/Unary/Deref.pm CExpr/Unary/Negative.pm CExpr/Unary/Positive.pm New-directories: CExpr/Assign CExpr/Assign/.arch-ids CExpr/Unary CExpr/Unary/.arch-ids Modified-files: CDecl.pm CExpr.pm CExpr/Add.pm CExpr/Divide.pm CExpr/Integer.pm CExpr/Modulus.pm CExpr/Multiply.pm CExpr/Subtract.pm CParse/Op/ArraySubscript.pm CParse/Op/Assign/Add.pm CParse/Op/Assign/BitAnd.pm CParse/Op/Assign/BitOr.pm CParse/Op/Assign/BitXor.pm CParse/Op/Assign/Divide.pm CParse/Op/Assign/Modulus.pm CParse/Op/Assign/Multiply.pm CParse/Op/Assign/ShiftLeft.pm CParse/Op/Assign/ShiftRight.pm CParse/Op/Assign/Subtract.pm CParse/Op/BitAnd.pm CParse/Op/BitOr.pm CParse/Op/BitXor.pm CParse/Op/BoolAnd.pm CParse/Op/BoolOr.pm CParse/Op/Cast.pm CParse/Op/Conditional.pm CParse/Op/Equal.pm CParse/Op/Expression.pm CParse/Op/Member.pm CParse/Op/MemberIndirect.pm CParse/Op/NotEqual.pm CParse/Op/Postdec.pm CParse/Op/Postinc.pm CParse/Op/Predec.pm CParse/Op/Preinc.pm CParse/Op/Relation/Greater.pm CParse/Op/Relation/GreaterEqual.pm CParse/Op/Relation/Less.pm CParse/Op/Relation/LessEqual.pm CParse/Op/Shift/Left.pm CParse/Op/Shift/Right.pm CParse/Op/SizeofExpr.pm CParse/Op/Unary/AddressOf.pm CParse/Op/Unary/BitNot.pm CParse/Op/Unary/BoolNot.pm CParse/Op/Unary/Deref.pm CParse/Op/Unary/Negative.pm CParse/Op/Unary/Positive.pm CParse/Parser/Perl.pm New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-4 Summary: fill in most of the operators Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-25icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000055310273204214032657 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-25 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Fri Jun 24 18:14:32 BST 2005 Standard-date: 2005-06-24 17:14:32 GMT Modified-files: CParse/Namespace.pm ChangeLog New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-25 Summary: fix baseline processing Keywords: ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-8icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000061710273204214032660 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-8 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sat Mar 19 14:39:10 GMT 2005 Standard-date: 2005-03-19 14:39:10 GMT Modified-files: CDecl.pm CType/Function.pm CType/Pointer.pm CType/Ref.pm CType/Struct.pm New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-8 Summary: fix a few bugs Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-21icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000057110273204214032657 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-21 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sun May 8 20:08:41 BST 2005 Standard-date: 2005-05-08 19:08:41 GMT Modified-files: CParse.pm CParse/Char.pm ChangeLog New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-21 Summary: handle characters as expressions Keywords: ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-2icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000105410273204214032654 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-2 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Wed Mar 9 01:01:12 GMT 2005 Standard-date: 2005-03-09 01:01:12 GMT Modified-files: CExpr.pm CExpr/Add.pm CExpr/Divide.pm CExpr/Integer.pm CExpr/Modulus.pm CExpr/Multiply.pm CExpr/Sizeof.pm CExpr/Subtract.pm CParse/EnumRef.pm CType/Array.pm CType/Enum.pm CType/Ref.pm CType/Struct.pm CType/Union.pm New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-2 Summary: fix enum checking Keywords: ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-1icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000120410273204214032651 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-1 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Tue Mar 8 22:35:47 GMT 2005 Standard-date: 2005-03-08 22:35:47 GMT Modified-files: CExpr/Add.pm CExpr/Divide.pm CExpr/Integer.pm CExpr/Modulus.pm CExpr/Multiply.pm CExpr/Sizeof.pm CExpr/Subtract.pm CParse/Enum.pm CParse/Enumerator.pm CParse/Parser/Perl.pm CType.pm CType/Array.pm CType/Enum.pm CType/Fundamental.pm CType/Ref.pm CType/Struct.pm CType/Union.pm Makefile typegen.pl New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-1 Summary: add enum support Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-23icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000057410273204214032662 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-23 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Fri Jun 17 15:44:14 BST 2005 Standard-date: 2005-06-17 14:44:14 GMT Modified-files: CParse/Namespace.pm ChangeLog New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-23 Summary: fix a method call on an undefined object Keywords: ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-3icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000052410273204214032655 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-3 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Wed Mar 9 01:15:53 GMT 2005 Standard-date: 2005-03-09 01:15:53 GMT Modified-files: icheck New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-3 Summary: finish cleaning up icheck Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-28icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000135110273204214032654 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-28 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sun Jul 3 21:14:05 BST 2005 Standard-date: 2005-07-03 20:14:05 GMT New-files: t/03_baseline/.arch-ids/=id t/03_baseline/.arch-ids/baseline.id t/03_baseline/.arch-ids/canonical.id t/03_baseline/baseline t/03_baseline/canonical t/03_baseline/source/.arch-ids/=id t/03_baseline/source/.arch-ids/foo.c.id t/03_baseline/source/foo.c New-directories: t/03_baseline t/03_baseline/.arch-ids t/03_baseline/source t/03_baseline/source/.arch-ids Modified-files: ChangeLog New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-28 Summary: add test for baseline support Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-38icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000065710273206717032676 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-38 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sun Jul 31 18:43:31 BST 2005 Standard-date: 2005-07-31 17:43:31 GMT Modified-files: CParse/Enum.pm CParse/Struct.pm CParse/Union.pm ChangeLog New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-38 Summary: improve heuristic for eliminating bogus redefinition errors Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-37icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000052510273204251032657 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-37 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sun Jul 31 18:20:59 BST 2005 Standard-date: 2005-07-31 17:20:59 GMT Modified-files: ChangeLog NEWS New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-37 Summary: update NEWS file Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-40icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000116710273271261032667 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-40 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Mon Aug 1 01:42:33 BST 2005 Standard-date: 2005-08-01 00:42:33 GMT Modified-files: CDecl.pm CExpr/Alignof.pm CType.pm CType/Array.pm CType/BitField.pm CType/Enum.pm CType/Fundamental.pm CType/Ref.pm CType/Struct.pm CType/Union.pm ChangeLog Makefile NEWS t/02_struct/canonical t/04_align/canonical t/04_align/diff t/04_align/source/foo.c New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-40 Summary: adjust the alignment canonicalisation some more Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-15icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000077210273204214032662 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-15 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Wed Mar 23 22:39:13 GMT 2005 Standard-date: 2005-03-23 22:39:13 GMT Modified-files: CParse/Parser/Perl.pm CParse/Parser/Token/Keyword.pm CParse/Parser/Token/String.pm ChangeLog New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-15 Summary: implement parsing of asm expressions, string concatenation, __extension__ expressions, __inline Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-29icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000056110273204214032656 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-29 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sun Jul 3 21:30:24 BST 2005 Standard-date: 2005-07-03 20:30:24 GMT Modified-files: ChangeLog test.pl New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-29 Summary: 'make test' should fail if any tests fail Keywords: ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/base-0icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/b0000644000175000017500000001745610273204214032653 0ustar asuffieldasuffieldRevision: icheck--main--0--base-0 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Tue Mar 8 18:01:51 GMT 2005 Standard-date: 2005-03-08 18:01:51 GMT Summary: initial import New-files: .arch-ids/.arch-inventory.id .arch-ids/CDecl.pm.id .arch-ids/CExpr.pm.id .arch-ids/CParse.pm.id .arch-ids/CType.pm.id .arch-ids/Makefile.id .arch-ids/icheck.id .arch-ids/typegen.pl.id .arch-inventory CDecl.pm CExpr.pm CExpr/.arch-ids/=id CExpr/.arch-ids/Add.pm.id CExpr/.arch-ids/Divide.pm.id CExpr/.arch-ids/Integer.pm.id CExpr/.arch-ids/Modulus.pm.id CExpr/.arch-ids/Multiply.pm.id CExpr/.arch-ids/Sizeof.pm.id CExpr/.arch-ids/Subtract.pm.id CExpr/Add.pm CExpr/Divide.pm CExpr/Integer.pm CExpr/Modulus.pm CExpr/Multiply.pm CExpr/Sizeof.pm CExpr/Subtract.pm CParse.pm CParse/.arch-ids/=id CParse/.arch-ids/Attribute.pm.id CParse/.arch-ids/AttributeList.pm.id CParse/.arch-ids/Char.pm.id CParse/.arch-ids/Declaration.pm.id CParse/.arch-ids/Declarator.pm.id CParse/.arch-ids/Enum.pm.id CParse/.arch-ids/EnumRef.pm.id CParse/.arch-ids/Enumerator.pm.id CParse/.arch-ids/Extension.pm.id CParse/.arch-ids/Float.pm.id CParse/.arch-ids/Function.pm.id CParse/.arch-ids/FunctionSpecifier.pm.id CParse/.arch-ids/Identifier.pm.id CParse/.arch-ids/Integer.pm.id CParse/.arch-ids/Namespace.pm.id CParse/.arch-ids/Op.pm.id CParse/.arch-ids/ParameterDeclaration.pm.id CParse/.arch-ids/Pointer.pm.id CParse/.arch-ids/StorageClass.pm.id CParse/.arch-ids/String.pm.id CParse/.arch-ids/Struct.pm.id CParse/.arch-ids/StructDeclaration.pm.id CParse/.arch-ids/StructDeclarator.pm.id CParse/.arch-ids/StructRef.pm.id CParse/.arch-ids/TypeName.pm.id CParse/.arch-ids/TypeQualifier.pm.id CParse/.arch-ids/TypeSpecifier.pm.id CParse/.arch-ids/Union.pm.id CParse/.arch-ids/UnionRef.pm.id CParse/Attribute.pm CParse/AttributeList.pm CParse/Char.pm CParse/Declaration.pm CParse/Declarator.pm CParse/Declarator/.arch-ids/=id CParse/Declarator/.arch-ids/Array.pm.id CParse/Declarator/.arch-ids/Direct.pm.id CParse/Declarator/.arch-ids/Function.pm.id CParse/Declarator/Array.pm CParse/Declarator/Direct.pm CParse/Declarator/Function.pm CParse/Enum.pm CParse/EnumRef.pm CParse/Enumerator.pm CParse/Extension.pm CParse/Float.pm CParse/Function.pm CParse/FunctionSpecifier.pm CParse/Identifier.pm CParse/Integer.pm CParse/Namespace.pm CParse/Op.pm CParse/Op/.arch-ids/=id CParse/Op/.arch-ids/Add.pm.id CParse/Op/.arch-ids/ArraySubscript.pm.id CParse/Op/.arch-ids/Assign.pm.id CParse/Op/.arch-ids/BitAnd.pm.id CParse/Op/.arch-ids/BitOr.pm.id CParse/Op/.arch-ids/BitXor.pm.id CParse/Op/.arch-ids/BoolAnd.pm.id CParse/Op/.arch-ids/BoolOr.pm.id CParse/Op/.arch-ids/Call.pm.id CParse/Op/.arch-ids/Cast.pm.id CParse/Op/.arch-ids/Conditional.pm.id CParse/Op/.arch-ids/Divide.pm.id CParse/Op/.arch-ids/Equal.pm.id CParse/Op/.arch-ids/Expression.pm.id CParse/Op/.arch-ids/Member.pm.id CParse/Op/.arch-ids/MemberIndirect.pm.id CParse/Op/.arch-ids/Modulus.pm.id CParse/Op/.arch-ids/Multiply.pm.id CParse/Op/.arch-ids/NotEqual.pm.id CParse/Op/.arch-ids/Postdec.pm.id CParse/Op/.arch-ids/Postfix.pm.id CParse/Op/.arch-ids/Postinc.pm.id CParse/Op/.arch-ids/Predec.pm.id CParse/Op/.arch-ids/Preinc.pm.id CParse/Op/.arch-ids/Relation.pm.id CParse/Op/.arch-ids/Shift.pm.id CParse/Op/.arch-ids/Sizeof.pm.id CParse/Op/.arch-ids/SizeofExpr.pm.id CParse/Op/.arch-ids/Subtract.pm.id CParse/Op/.arch-ids/Unary.pm.id CParse/Op/Add.pm CParse/Op/ArraySubscript.pm CParse/Op/Assign.pm CParse/Op/Assign/.arch-ids/=id CParse/Op/Assign/.arch-ids/Add.pm.id CParse/Op/Assign/.arch-ids/BitAnd.pm.id CParse/Op/Assign/.arch-ids/BitOr.pm.id CParse/Op/Assign/.arch-ids/BitXor.pm.id CParse/Op/Assign/.arch-ids/Divide.pm.id CParse/Op/Assign/.arch-ids/Modulus.pm.id CParse/Op/Assign/.arch-ids/Multiply.pm.id CParse/Op/Assign/.arch-ids/ShiftLeft.pm.id CParse/Op/Assign/.arch-ids/ShiftRight.pm.id CParse/Op/Assign/.arch-ids/Subtract.pm.id CParse/Op/Assign/Add.pm CParse/Op/Assign/BitAnd.pm CParse/Op/Assign/BitOr.pm CParse/Op/Assign/BitXor.pm CParse/Op/Assign/Divide.pm CParse/Op/Assign/Modulus.pm CParse/Op/Assign/Multiply.pm CParse/Op/Assign/ShiftLeft.pm CParse/Op/Assign/ShiftRight.pm CParse/Op/Assign/Subtract.pm CParse/Op/BitAnd.pm CParse/Op/BitOr.pm CParse/Op/BitXor.pm CParse/Op/BoolAnd.pm CParse/Op/BoolOr.pm CParse/Op/Call.pm CParse/Op/Cast.pm CParse/Op/Conditional.pm CParse/Op/Divide.pm CParse/Op/Equal.pm CParse/Op/Expression.pm CParse/Op/Member.pm CParse/Op/MemberIndirect.pm CParse/Op/Modulus.pm CParse/Op/Multiply.pm CParse/Op/NotEqual.pm CParse/Op/Postdec.pm CParse/Op/Postfix.pm CParse/Op/Postinc.pm CParse/Op/Predec.pm CParse/Op/Preinc.pm CParse/Op/Relation.pm CParse/Op/Relation/.arch-ids/=id CParse/Op/Relation/.arch-ids/Greater.pm.id CParse/Op/Relation/.arch-ids/GreaterEqual.pm.id CParse/Op/Relation/.arch-ids/Less.pm.id CParse/Op/Relation/.arch-ids/LessEqual.pm.id CParse/Op/Relation/Greater.pm CParse/Op/Relation/GreaterEqual.pm CParse/Op/Relation/Less.pm CParse/Op/Relation/LessEqual.pm CParse/Op/Shift.pm CParse/Op/Shift/.arch-ids/=id CParse/Op/Shift/.arch-ids/Left.pm.id CParse/Op/Shift/.arch-ids/Right.pm.id CParse/Op/Shift/Left.pm CParse/Op/Shift/Right.pm CParse/Op/Sizeof.pm CParse/Op/SizeofExpr.pm CParse/Op/Subtract.pm CParse/Op/Unary.pm CParse/Op/Unary/.arch-ids/=id CParse/Op/Unary/.arch-ids/AddressOf.pm.id CParse/Op/Unary/.arch-ids/BitNot.pm.id CParse/Op/Unary/.arch-ids/BoolNot.pm.id CParse/Op/Unary/.arch-ids/Deref.pm.id CParse/Op/Unary/.arch-ids/Negative.pm.id CParse/Op/Unary/.arch-ids/Positive.pm.id CParse/Op/Unary/AddressOf.pm CParse/Op/Unary/BitNot.pm CParse/Op/Unary/BoolNot.pm CParse/Op/Unary/Deref.pm CParse/Op/Unary/Negative.pm CParse/Op/Unary/Positive.pm CParse/ParameterDeclaration.pm CParse/Parser/.arch-ids/=id CParse/Parser/.arch-ids/Perl.pm.id CParse/Parser/Perl.pm CParse/Parser/Token/.arch-ids/=id CParse/Parser/Token/.arch-ids/Character.pm.id CParse/Parser/Token/.arch-ids/Float.pm.id CParse/Parser/Token/.arch-ids/Identifier.pm.id CParse/Parser/Token/.arch-ids/Integer.pm.id CParse/Parser/Token/.arch-ids/Keyword.pm.id CParse/Parser/Token/.arch-ids/Punctuator.pm.id CParse/Parser/Token/.arch-ids/String.pm.id CParse/Parser/Token/Character.pm CParse/Parser/Token/Float.pm CParse/Parser/Token/Identifier.pm CParse/Parser/Token/Integer.pm CParse/Parser/Token/Keyword.pm CParse/Parser/Token/Punctuator.pm CParse/Parser/Token/String.pm CParse/Pointer.pm CParse/StorageClass.pm CParse/String.pm CParse/Struct.pm CParse/StructDeclaration.pm CParse/StructDeclarator.pm CParse/StructRef.pm CParse/TypeName.pm CParse/TypeQualifier.pm CParse/TypeSpecifier.pm CParse/Union.pm CParse/UnionRef.pm CType.pm CType/.arch-ids/.arch-inventory.id CType/.arch-ids/=id CType/.arch-ids/Array.pm.id CType/.arch-ids/BitField.pm.id CType/.arch-ids/Builtin.pm.id CType/.arch-ids/Enum.pm.id CType/.arch-ids/Function.pm.id CType/.arch-ids/Fundamental.pm.id CType/.arch-ids/Pointer.pm.id CType/.arch-ids/Ref.pm.id CType/.arch-ids/Struct.pm.id CType/.arch-ids/Union.pm.id CType/.arch-inventory CType/Array.pm CType/BitField.pm CType/Builtin.pm CType/Enum.pm CType/Function.pm CType/Fundamental.pm CType/Pointer.pm CType/Ref.pm CType/Struct.pm CType/Union.pm Makefile icheck typegen.pl New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--base-0 (automatically generated log message) ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-13icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000052710273204214032660 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-13 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Wed Mar 23 22:00:21 GMT 2005 Standard-date: 2005-03-23 22:00:21 GMT Modified-files: ChangeLog icheck New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-13 Summary: fix include path Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-10icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000054110273204214032654 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-10 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sun Mar 20 05:53:13 GMT 2005 Standard-date: 2005-03-20 05:53:13 GMT Modified-files: ChangeLog icheck New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-10 Summary: adjust module search paths Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-14icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000063010273204214032653 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-14 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Wed Mar 23 22:07:02 GMT 2005 Standard-date: 2005-03-23 22:07:02 GMT Modified-files: CParse/Parser/Perl.pm CParse/Parser/Token/Keyword.pm ChangeLog New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-14 Summary: implement parsing of asm labels Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-19icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000056710273204214032664 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-19 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Fri Mar 25 17:41:22 GMT 2005 Standard-date: 2005-03-25 17:41:22 GMT Modified-files: CParse/Namespace.pm CType/Enum.pm ChangeLog New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-19 Summary: fix checking of enums Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-26icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000301410273204214032652 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-26 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sun Jul 3 18:15:50 BST 2005 Standard-date: 2005-07-03 17:15:50 GMT New-files: .arch-ids/make_test.pl.id .arch-ids/make_tests.pl.id .arch-ids/run_test.pl.id .arch-ids/test.pl.id make_test.pl make_tests.pl run_test.pl t/.arch-ids/=id t/00_empty/.arch-ids/=id t/00_empty/.arch-ids/canonical.id t/00_empty/.arch-ids/diff.id t/00_empty/.arch-ids/original.id t/00_empty/canonical t/00_empty/diff t/00_empty/original t/00_empty/source/.arch-ids/=id t/01_fundamental/.arch-ids/=id t/01_fundamental/.arch-ids/canonical.id t/01_fundamental/canonical t/01_fundamental/source/.arch-ids/=id t/01_fundamental/source/.arch-ids/foo.c.id t/01_fundamental/source/foo.c t/02_struct/.arch-ids/=id t/02_struct/.arch-ids/canonical.id t/02_struct/canonical t/02_struct/source/.arch-ids/=id t/02_struct/source/.arch-ids/bar.c.id t/02_struct/source/bar.c test.pl New-directories: t t/.arch-ids t/00_empty t/00_empty/.arch-ids t/00_empty/source t/00_empty/source/.arch-ids t/01_fundamental t/01_fundamental/.arch-ids t/01_fundamental/source t/01_fundamental/source/.arch-ids t/02_struct t/02_struct/.arch-ids t/02_struct/source t/02_struct/source/.arch-ids Modified-files: CDecl.pm ChangeLog typegen.pl New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-26 Summary: add test suite framework, and fix a bug it found Keywords: ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-9icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000075010273204214032656 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-9 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sat Mar 19 15:47:56 GMT 2005 Standard-date: 2005-03-19 15:47:56 GMT New-files: .arch-ids/COPYING.id .arch-ids/ChangeLog.id .arch-ids/LICENSE.id .arch-ids/NEWS.id .arch-ids/README.id COPYING ChangeLog LICENSE NEWS README New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-9 Summary: add the usual documentation cocktail Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-32icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000052010273204214032651 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-32 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Wed Jul 6 19:47:23 BST 2005 Standard-date: 2005-07-06 18:47:23 GMT Modified-files: ChangeLog NEWS New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-32 Summary: update NEWS Keywords: ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-6icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000106610273204214032657 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-6 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sun Mar 13 12:56:29 GMT 2005 Standard-date: 2005-03-13 12:56:29 GMT New-files: CExpr/.arch-ids/Alignof.pm.id CExpr/Alignof.pm CParse/Op/.arch-ids/Alignof.pm.id CParse/Op/Alignof.pm Modified-files: CParse/Parser/Perl.pm CParse/Parser/Token/Keyword.pm CParse/Pointer.pm CType/Array.pm CType/Pointer.pm New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-6 Summary: fix various obscure C features Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-41icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000053410273273314032665 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-41 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Mon Aug 1 01:56:09 BST 2005 Standard-date: 2005-08-01 00:56:09 GMT Modified-files: ChangeLog Makefile New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-41 Summary: fix up clean target Keywords: ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-5icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000331510273204214032656 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-5 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sun Mar 13 05:29:56 GMT 2005 Standard-date: 2005-03-13 05:29:56 GMT New-files: CDecl/.arch-ids/=id CDecl/.arch-ids/Enumerator.pm.id CDecl/Enumerator.pm CExpr/.arch-ids/Ref.pm.id CExpr/Ref.pm New-directories: CDecl CDecl/.arch-ids Modified-files: CDecl.pm CExpr/Add.pm CExpr/ArraySubscript.pm CExpr/Assign/Add.pm CExpr/Assign/BitAnd.pm CExpr/Assign/BitOr.pm CExpr/Assign/BitXor.pm CExpr/Assign/Divide.pm CExpr/Assign/Modulus.pm CExpr/Assign/Multiply.pm CExpr/Assign/ShiftLeft.pm CExpr/Assign/ShiftRight.pm CExpr/Assign/Subtract.pm CExpr/BitAnd.pm CExpr/BitOr.pm CExpr/BitXor.pm CExpr/BoolAnd.pm CExpr/BoolOr.pm CExpr/Cast.pm CExpr/Conditional.pm CExpr/Divide.pm CExpr/Equal.pm CExpr/Greater.pm CExpr/GreaterEqual.pm CExpr/Less.pm CExpr/LessEqual.pm CExpr/Member.pm CExpr/MemberIndirect.pm CExpr/Modulus.pm CExpr/Multiply.pm CExpr/NotEqual.pm CExpr/Postdec.pm CExpr/Postinc.pm CExpr/Predec.pm CExpr/Preinc.pm CExpr/SeqExpression.pm CExpr/ShiftLeft.pm CExpr/ShiftRight.pm CExpr/Sizeof.pm CExpr/SizeofExpr.pm CExpr/Subtract.pm CExpr/Unary/AddressOf.pm CExpr/Unary/BitNot.pm CExpr/Unary/BoolNot.pm CExpr/Unary/Deref.pm CExpr/Unary/Negative.pm CExpr/Unary/Positive.pm CParse.pm CParse/Declarator/Array.pm CParse/Enum.pm CParse/Identifier.pm CParse/Namespace.pm CParse/Parser/Perl.pm CType/Array.pm CType/Enum.pm CType/Function.pm CType/Ref.pm CType/Struct.pm CType/Union.pm icheck New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-5 Summary: add support for self-referential enums Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-12icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000052210273204214032653 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-12 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sun Mar 20 06:23:40 GMT 2005 Standard-date: 2005-03-20 06:23:40 GMT Modified-files: ChangeLog NEWS New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-12 Summary: fix NEWS file Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-42icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000060010273455727032671 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-42 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Mon Aug 1 06:24:35 BST 2005 Standard-date: 2005-08-01 05:24:35 GMT Modified-files: ChangeLog run_test.pl New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-42 Summary: add test suite checks for canonical form correctness Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-27icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000136410273204214032660 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-27 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sun Jul 3 18:44:12 BST 2005 Standard-date: 2005-07-03 17:44:12 GMT New-files: t/01_fundamental/.arch-ids/diff.id t/01_fundamental/.arch-ids/original.id t/01_fundamental/.arch-ids/result.compare.id t/01_fundamental/diff t/01_fundamental/original t/01_fundamental/result.compare Modified-files: CParse/Namespace.pm CType/Fundamental.pm ChangeLog Makefile make_test.pl run_test.pl t/01_fundamental/canonical New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-27 Summary: finish testsuite, fix bugs found Keywords: Fix canonification of _Bool types Fix comparison of missing enums ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-22icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000056610273204214032663 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-22 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Fri Jun 17 10:19:53 BST 2005 Standard-date: 2005-06-17 09:19:53 GMT Modified-files: CParse/Namespace.pm ChangeLog NEWS icheck New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-22 Summary: add --baseline support Keywords: ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-7icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000063210273204214032655 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-7 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sat Mar 19 12:47:46 GMT 2005 Standard-date: 2005-03-19 12:47:46 GMT Modified-files: CParse/Namespace.pm CType.pm CType/BitField.pm CType/Struct.pm icheck New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-7 Summary: finish support for bitfields Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-24icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000054410273204214032657 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-24 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sun Jun 19 13:45:00 BST 2005 Standard-date: 2005-06-19 12:45:00 GMT Modified-files: ChangeLog icheck New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-24 Summary: fix baseline argument parsing Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-34icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000176210273204251032663 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-34 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sat Jul 23 17:11:59 BST 2005 Standard-date: 2005-07-23 16:11:59 GMT New-files: t/04_align/.arch-ids/=id t/04_align/.arch-ids/canonical.id t/04_align/.arch-ids/diff.id t/04_align/.arch-ids/original.id t/04_align/.arch-ids/result.compare.id t/04_align/canonical t/04_align/diff t/04_align/original t/04_align/result.compare t/04_align/source/.arch-ids/=id t/04_align/source/.arch-ids/foo.c.id t/04_align/source/foo.c New-directories: t/04_align t/04_align/.arch-ids t/04_align/source t/04_align/source/.arch-ids Modified-files: CDecl.pm CExpr/Alignof.pm CType.pm CType/BitField.pm CType/Fundamental.pm CType/Struct.pm CType/Union.pm ChangeLog t/02_struct/canonical t/03_baseline/canonical New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-34 Summary: fix alignment handling to be arch-independent Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-30icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000055610273204214032662 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-30 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Wed Jul 6 00:24:30 BST 2005 Standard-date: 2005-07-05 23:24:30 GMT Modified-files: ChangeLog NEWS icheck New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-30 Summary: fix handling of -- on command line Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-33icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000167110273204251032662 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-33 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sat Jul 23 15:32:06 BST 2005 Standard-date: 2005-07-23 14:32:06 GMT New-files: ext/.arch-ids/=id ext/CParse-Parser-PerlXS/.arch-ids/.arch-inventory.id ext/CParse-Parser-PerlXS/.arch-ids/=id ext/CParse-Parser-PerlXS/.arch-ids/Makefile.PL.id ext/CParse-Parser-PerlXS/.arch-ids/PerlXS.pm.id ext/CParse-Parser-PerlXS/.arch-ids/PerlXS.xs.id ext/CParse-Parser-PerlXS/.arch-inventory ext/CParse-Parser-PerlXS/Makefile.PL ext/CParse-Parser-PerlXS/PerlXS.pm ext/CParse-Parser-PerlXS/PerlXS.xs New-directories: ext ext/.arch-ids ext/CParse-Parser-PerlXS ext/CParse-Parser-PerlXS/.arch-ids Modified-files: CParse.pm CParse/Parser/Perl.pm ChangeLog Makefile icheck New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-33 Summary: start implementing XSUB parser Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-18icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000056610273204214032663 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-18 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Fri Mar 25 16:49:41 GMT 2005 Standard-date: 2005-03-25 16:49:41 GMT Modified-files: CParse/Namespace.pm ChangeLog New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-18 Summary: fix braindamage in typedef dumping Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-11icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000054710273204214032662 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-11 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Sun Mar 20 06:22:20 GMT 2005 Standard-date: 2005-03-20 06:22:20 GMT Modified-files: ChangeLog Makefile New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-11 Summary: add install target to Makefile Keywords: ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrooticheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/patch-35icheck-0.9.7/{arch}/icheck/icheck--main/icheck--main--0/asuffield@debian.org--gluck-2005/patch-log/p0000644000175000017500000000061110273204251032653 0ustar asuffieldasuffieldRevision: icheck--main--0--patch-35 Archive: asuffield@debian.org--gluck-2005 Creator: Andrew Suffield Date: Wed Jul 27 18:34:48 BST 2005 Standard-date: 2005-07-27 17:34:48 GMT Modified-files: CType/Array.pm CType/Ref.pm ChangeLog New-patches: asuffield@debian.org--gluck-2005/icheck--main--0--patch-35 Summary: fill in some missing alignment_expr functions Keywords: icheck-0.9.7/{arch}/++default-version0000644000175000017500000000006110273204214020120 0ustar asuffieldasuffieldasuffield@debian.org--gluck-2005/icheck--main--0 icheck-0.9.7/run_test.pl0000755000175000017500000002070010273455727015661 0ustar asuffieldasuffield#!/usr/bin/perl use strict; use 5.6.0; use warnings; use File::Spec; use POSIX; use Text::Diff; use File::Find; use IO::Handle; use IPC::Open3; use IO::File; my $test = shift or die "No test supplied\n"; -d $test or die "No such directory $test\n"; my $args = File::Spec->catfile($test, 'args'); my $args_canonify = File::Spec->catfile($test, 'args.canonify'); my $args_compare = File::Spec->catfile($test, 'args.compare'); my $baseline = File::Spec->catfile($test, 'baseline'); my $canonical = File::Spec->catfile($test, 'canonical'); my $errors = File::Spec->catfile($test, 'errors'); my $errors_canonify = File::Spec->catfile($test, 'errors.canonify'); my $errors_compare = File::Spec->catfile($test, 'errors.compare'); my $original = File::Spec->catfile($test, 'original'); my $result = File::Spec->catfile($test, 'result'); my $result_canonify = File::Spec->catfile($test, 'result.canonify'); my $result_compare = File::Spec->catfile($test, 'result.compare'); my $source = File::Spec->catfile($test, 'source'); my $diff = File::Spec->catfile($test, 'diff'); my @sources; if (-d $source) { find(sub {return $File::Find::prune = 1 if /^\../ or /~$/; push @sources, $File::Find::name if -f $_}, $source); } elsif (-f $source) { push @sources, $source; } else { undef $source; } undef $args unless -f $args; undef $args_canonify unless -f $args_canonify; undef $args_compare unless -f $args_compare; undef $baseline unless -f $baseline; undef $canonical unless -f $canonical; undef $errors unless -f $errors; undef $errors_canonify unless -f $errors_canonify; undef $errors_compare unless -f $errors_compare; undef $original unless -f $original; undef $result unless -f $result; undef $result_canonify unless -f $result_canonify; undef $result_compare unless -f $result_compare; undef $diff unless -f $diff; my $canonify = 0; $canonify = 1 if $source and $canonical; $canonify = 1 if $original and $diff and $source and not $canonical; my $compare = 0; $compare = 1 if ($canonical or $canonify) and $original and $diff; my $fail = 0; sub compare_str { my $desc = shift; my $expect = shift; my $got = shift; return if $expect eq $got; print "Differences in $desc\n"; if (length $expect) { diff \$expect, \$got, {STYLE => 'Unified', OUTPUT => \*STDOUT}; } else { print "Expected nothing, got:\n"; print "---\n"; print $got; print "---\n" } $fail = 1; } sub compare_int { my $desc = shift; my $expect = shift; my $got = shift; return if $expect == $got; print "Differences in $desc: expected $expect, got $got\n"; $fail = 1; } my $canonical_data; if ($canonify) { my $expect_result = 0; if ($result_canonify) { my $fh = new IO::File $result_canonify, 'r'; $expect_result = <$fh>; chomp $expect_result; } elsif ($result) { my $fh = new IO::File $result, 'r'; $expect_result = <$fh>; chomp $expect_result; } my $expect_errors = ""; if ($errors_canonify) { my $fh = new IO::File $errors_canonify, 'r'; $expect_errors .= $_ while <$fh>; } elsif ($errors) { my $fh = new IO::File $errors, 'r'; $expect_errors .= $_ while <$fh>; } my @args; if ($args_canonify) { my $fh = new IO::File $args_canonify, 'r'; while (<$fh>) {chomp; push @args, $_} } elsif ($args) { my $fh = new IO::File $args, 'r'; while (<$fh>) {chomp; push @args, $_} } my $canonify_output = ""; my $canonify_errors = ""; my $canonify_result; { my ($write, $read, $err) = (new IO::Handle, new IO::Handle, new IO::Handle); my @cmd = ('./icheck', '--canonify', $baseline ? ('--baseline', $baseline) : (), @sources, @args); if ($ENV{TEST_VERBOSE}) { print join(' ', @cmd) . "\n"; } my $pid = open3($write, $read, $err, @cmd); close $write; $canonify_output .= $_ while <$read>; close $read; $canonify_errors .= $_ while <$err>; close $err; waitpid $pid, 0; if (WIFSIGNALED($?)) { die "icheck killed by signal " . WTERMSIG($?) . "\n"; } unless (WIFEXITED($?)) { die "icheck died wierdly (waitpid gave $?)\n"; } $canonify_result = WEXITSTATUS($?); } compare_str('canonify errors', $expect_errors, $canonify_errors); compare_int('canonify result', $expect_result, $canonify_result); if ($canonical) { $canonical_data = ''; my $fh = new IO::File $canonical, 'r'; $canonical_data .= $_ while <$fh>; compare_str('canonify output', $canonical_data, $canonify_output); } else { $canonical_data = $canonify_output; } # Now we check that the canonical form is in fact canonical - # canonify(canonify(x)) == canonify(x) for all x if ($canonical) { my ($canonify2_output, $canonify2_errors, $canonify2_result) = ("", "", undef); { my ($write, $read, $err) = (new IO::Handle, new IO::Handle, new IO::Handle); my @cmd = ('./icheck', '--canonify', $baseline ? ('--baseline', $baseline) : (), $baseline ? ($baseline) : (), $canonical); if ($ENV{TEST_VERBOSE}) { print join(' ', @cmd) . "\n"; } my $pid = open3($write, $read, $err, @cmd); close $write; $canonify2_output .= $_ while <$read>; close $read; $canonify2_errors .= $_ while <$err>; close $err; waitpid $pid, 0; if (WIFSIGNALED($?)) { die "icheck killed by signal " . WTERMSIG($?) . "\n"; } unless (WIFEXITED($?)) { die "icheck died wierdly (waitpid gave $?)\n"; } $canonify2_result = WEXITSTATUS($?); } # A canonical form *must* parse correctly, so this can't have errors compare_str('second canonify output', $canonical_data, $canonify2_output); compare_str('second canonify errors', '', $canonify2_errors); compare_int('second canonify result', 0, $canonify2_result); } } if ($compare) { my $expect_result = 0; if ($result_compare) { my $fh = new IO::File $result_compare, 'r'; $expect_result = <$fh>; chomp $expect_result; } elsif ($result) { my $fh = new IO::File $result, 'r'; $expect_result = <$fh>; chomp $expect_result; } my $expect_errors = ""; if ($errors_compare) { my $fh = new IO::File $errors_compare, 'r'; $expect_errors .= $_ while <$fh>; } elsif ($errors) { my $fh = new IO::File $errors, 'r'; $expect_errors .= $_ while <$fh>; } my @args; if ($args_compare) { my $fh = new IO::File $args_compare, 'r'; while (<$fh>) {chomp; push @args, $_} } elsif ($args) { my $fh = new IO::File $args, 'r'; while (<$fh>) {chomp; push @args, $_} } my $compare_output = ""; my $compare_errors = ""; my $compare_result; { my ($write, $read, $err) = (new IO::Handle, new IO::Handle, new IO::Handle); my @cmd = ('./icheck', '--compare', $original, $canonical ? $canonical : '-', @args); if ($ENV{TEST_VERBOSE}) { print join(' ', @cmd) . "\n"; } my $pid = open3($write, $read, $err, @cmd); if (not $canonical) { print $write $canonical_data; } close $write; $compare_output .= $_ while <$read>; close $read; $compare_errors .= $_ while <$err>; close $err; waitpid $pid, 0; if (WIFSIGNALED($?)) { die "icheck killed by signal " . WTERMSIG($?) . "\n"; } unless (WIFEXITED($?)) { die "icheck died wierdly (waitpid gave $?)\n"; } $compare_result = WEXITSTATUS($?); } compare_str('compare errors', $expect_errors, $compare_errors); compare_int('compare result', $expect_result, $compare_result); my $diff_data = ''; my $fh = new IO::File $diff, 'r'; $diff_data .= $_ while <$fh>; compare_str('compare output', $diff_data, $compare_output); } exit 1 if $fail; icheck-0.9.7/test.pl0000755000175000017500000000154610273204214014763 0ustar asuffieldasuffield#!/usr/bin/perl use strict; use 5.6.0; use warnings; use IO::Dir; use File::Spec; use POSIX; my $dirname = shift or die "No test directory supplied\n"; my $dir = new IO::Dir $dirname or die "Failed to open dir $dirname: $!\n"; my @tests; push @tests, $_ while defined($_ = $dir->read); undef $dir; @tests = grep {-d $_} map {File::Spec->catdir($dirname, $_)} grep {!/^\./ and !/~$/} @tests; my $passed = 0; my $failed = 0; foreach my $test (sort @tests) { print "Processing $test...\n"; system('./run_test.pl', $test); die "Failed to run run-test.pl $test: $!" if $? == -1; $? == 0 ? $passed++ : $failed++; print "Test $test failed\n" if $? != 0; } print '-' x 72 . "\n"; my $total = scalar @tests; my $percent = $passed * 100 / $total; printf '%d/%d (%d%%) tests passed' . "\n", $passed, $total, $percent; exit 1 if $passed < $total; icheck-0.9.7/CType/0000755000175000017500000000000010273455727014503 5ustar asuffieldasuffieldicheck-0.9.7/CType/Pointer.pm0000644000175000017500000000557710273204214016456 0ustar asuffieldasuffieldpackage CType::Pointer; use 5.6.0; use strict; use warnings; use CType; use CType::Fundamental; no warnings 'recursion'; our @ISA = qw/CType::Fundamental::VoidPtr/; sub new { my $this = shift; my $class = ref($this) || $this; my $type = shift; my $qualifiers = shift; my $attributes = shift; my $const = 0; my $restrict = 0; my $volatile = 0; foreach my $qualifier (@$qualifiers) { if ($qualifier->isa('CParse::TypeQualifier')) { if ($qualifier->name eq 'const') { $const = 1; } elsif ($qualifier->name eq 'volatile') { $volatile = 1; } elsif ($qualifier->name eq 'restrict') { $restrict = 1; } else { die "Internal error: unknown type qualifier " . $qualifier->name; } } else { die "Internal error: unknown type qualifier $qualifier"; } } my $self = {type => $type, attributes => $attributes, const => $const, restrict => $restrict, volatile => $volatile, }; bless $self, $class; $self->process_attributes($attributes); return $self; } sub describe { my $self = shift; my $qualifiers = $self->describe_qualifiers; $qualifiers .= ' ' if $qualifiers; my $type = $self->{type}->describe; return $qualifiers . "pointer to " . $type; } sub dump_c { my $self = shift; my $skip_cpp = shift; my $name = shift; my $qualifiers = $self->dump_c_qualifiers; my $str = ''; $str .= '*'; $str .= ' ' . $qualifiers if $qualifiers; $str .= ' ' . $name if $name; if ($self->{type}->capture_declarator) { unless ($self->{type}->isa('CType::Pointer')) { # Anything that captures, and isn't a pointer, needs to be # protected with parentheses $str = "($str)"; } $str = $self->{type}->dump_c($skip_cpp, $str); } else { $str = $self->{type}->dump_c($skip_cpp) . ' ' . $str; } return $str; } sub capture_declarator { return 1; } sub _check_interface { my $self = shift; my $other = shift; return 'both' unless $other->isa('CType::Pointer'); my @ret; push @ret, $self->check_sizes($other); push @ret, $self->check_qualifiers($other); push @ret, $self->{type}->check_interface($other->{type}); return @ret; } sub get_refs { my $self = shift; return $self->{type}->get_refs; } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $accept_incomplete = 1; $self->{type}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CType/Array.pm0000644000175000017500000000472210273271261016111 0ustar asuffieldasuffieldpackage CType::Array; use 5.6.0; use strict; use warnings; use CType; our @ISA = qw/CType/; sub new { my $this = shift; my $class = ref($this) || $this; my $type = shift; my $size = shift; my $attributes = shift; my $self = {type => $type, size => $size, attributes => $attributes, }; bless $self, $class; $self->process_attributes($attributes); return $self; } sub size { my $self = shift; return $self->{size}; } sub element_type { my $self = shift; return $self->{type}->type; } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; return if exists $self->{width}; if ($self->{size}) { $self->{size}->layout(0, $namespace); $self->element_type->layout($accept_incomplete, $namespace); $self->{width} = $self->element_type->width * $self->{size}->compute; } else { $self->{width} = undef; } } sub alignment { my $self = shift; return $self->element_type->alignment; } sub alignment_exprs { my $self = shift; return $self->element_type->alignment_exprs; } sub describe { my $self = shift; my $size = $self->{size} ? $self->{size}->compute . " element " : ""; my $type = $self->{type}->describe; return $size . "array of $type"; } sub capture_declarator { return 1; } sub dump_c { my $self = shift; my $skip_cpp = shift; my $name = shift; my $str = ''; my $declarator = $name || ""; my $size = $self->{size} ? $self->{size}->dump_c($skip_cpp) : ''; if ($self->{type}->capture_declarator) { $str .= $self->{type}->dump_c($skip_cpp, "$declarator\[$size]"); } else { my $type = $self->{type}->dump_c($skip_cpp); $str .= "$type $declarator\[$size]"; } return $str; } sub _check_interface { my $self = shift; my $other = shift; return 'both' unless $other->isa('CType::Array'); my @ret; my $size = $self->{size} ? $self->{size}->compute : "x"; my $other_size = $other->{size} ? $other->{size}->compute : "x"; if ($size ne $other_size) { push @ret, 'abi'; } push @ret, $self->{type}->check_interface($other->{type}); return @ret; } sub get_refs { my $self = shift; return ($self->{type}->get_refs, $self->{size} ? $self->{size}->get_refs : ()); } 1; icheck-0.9.7/CType/.arch-ids/0000755000175000017500000000000010273455727016253 5ustar asuffieldasuffieldicheck-0.9.7/CType/.arch-ids/Pointer.pm.id0000644000175000017500000000011110273204214020574 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28703.46 icheck-0.9.7/CType/.arch-ids/Ref.pm.id0000644000175000017500000000011110273204214017670 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28703.47 icheck-0.9.7/CType/.arch-ids/.arch-inventory.id0000644000175000017500000000011010273204214021566 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:48:14 2005 28777.1 icheck-0.9.7/CType/.arch-ids/Structural.pm.id0000644000175000017500000000011010273455727021344 0ustar asuffieldasuffieldAndrew Suffield Mon Aug 1 18:26:13 2005 18008.0 icheck-0.9.7/CType/.arch-ids/Builtin.pm.id0000644000175000017500000000011110273204214020562 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28703.41 icheck-0.9.7/CType/.arch-ids/Enum.pm.id0000644000175000017500000000011110273204214020060 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28703.42 icheck-0.9.7/CType/.arch-ids/Union.pm.id0000644000175000017500000000011110273204214020244 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28703.49 icheck-0.9.7/CType/.arch-ids/=id0000644000175000017500000000011010273204214016636 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:20 2005 28700.5 icheck-0.9.7/CType/.arch-ids/Fundamental.pm.id0000644000175000017500000000011110273204214021412 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28703.44 icheck-0.9.7/CType/.arch-ids/Array.pm.id0000644000175000017500000000011110273204214020232 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28703.39 icheck-0.9.7/CType/.arch-ids/Struct.pm.id0000644000175000017500000000011110273204214020440 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28703.48 icheck-0.9.7/CType/.arch-ids/Function.pm.id0000644000175000017500000000011110273204214020741 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28703.43 icheck-0.9.7/CType/.arch-ids/BitField.pm.id0000644000175000017500000000011110273204214020636 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28703.40 icheck-0.9.7/CType/Structural.pm0000644000175000017500000000517110273455727017215 0ustar asuffieldasuffieldpackage CType::Structural; # Common functions for all structural types use 5.6.0; use strict; use warnings; use CType::Fundamental qw/compare_ord/; sub alignment_exprs { my $self = shift; return @{$self->{alignment_exprs}}; } sub compute_alignment { my $self = shift; my $alignment = 1; foreach my $a ($self->alignment_exprs) { my $n = $a->compute; if (not defined $alignment or $alignment < $n) { $alignment = $n; } } return $alignment; } sub add_alignment { my $self = shift; my $new = shift; my @alignment; # We special-case the handling of explicit integer alignment if ($new->isa('CExpr::Integer')) { foreach my $a ($self->alignment_exprs) { if ($a->isa('CExpr::Integer')) { # Integer values are compared numerically if ($new->compute > $a->compute) { # Discard the current value in favour of the new one next; } else { # Discard the new value in favour of the current one return; } } else { # Integer values ignore non-integer ones push @alignment, $a; } } unshift @alignment, $new; $self->{alignment_exprs} = \@alignment; return; } foreach my $a ($self->alignment_exprs) { if ($new->isa('CExpr::Integer') and $a->isa('CExpr::Integer')) { # Integer values are compared numerically if ($new->compute > $a->compute) { # Discard the current value in favour of the new one next; } else { # Discard the new value in favour of the current one return; } } my $c = compare_ord($a, $new); if (defined $c and ($c == 1 or $c == 0)) { # There is already an alignment listed which is ordinally # greater or equal, so we don't need to add this one return; } if (defined $c and ($c == -1)) { # This alignment is ordinally greater than one which is # currently listed, so we dump the current one in favour # of this one next; } push @alignment, $a; } push @alignment, $new; $self->{alignment_exprs} = \@alignment; } 1; icheck-0.9.7/CType/Builtin.pm0000644000175000017500000000175410273204214016435 0ustar asuffieldasuffieldpackage CType::Builtin; use 5.6.0; use strict; use warnings; use CType; our @ISA = qw/CType/; sub new { my $this = shift; my $class = ref($this) || $this; my $name = shift; my $self = {name => $name, }; bless $self, $class; return $self } sub name { my $self = shift; return $self->{name}; } sub layout { } my @builtins = qw/__builtin_va_list/; sub register_builtins { my $namespace = shift; $namespace->set('ordinary', $_, new CType::Builtin $_) foreach @builtins; } sub describe { my $self = shift; return "builtin $self->{name}"; } sub dump_c { my $self = shift; my $skip_cpp = shift; my $str = ''; $str .= $self->{name}; return $str; } sub get_refs { return (); } sub _check_interface { my $self = shift; my $other = shift; return 'both' unless $other->isa('CType::Builtin'); return 'both' unless $other->name eq $self->name; return 'ok'; } 1; icheck-0.9.7/CType/Fundamental.pm0000644000175000017500000003206310273455727017303 0ustar asuffieldasuffieldpackage CType::Fundamental; use 5.6.0; use strict; use warnings; use Exporter; use CType; use CExpr::Alignof; our @ISA = qw/Exporter CType/; our @EXPORT_OK = qw/register_type_attrs compare_ord/; # These are all the fundamental types my %types; my %type_info = (Void => {name => 'void', nature => 'void', ord => 0, }, VoidPtr => {name => 'void *', nature => 'int', ord => 'undef', }, Char => {name => 'char', nature => 'int', ord => 1, }, SignedChar => {name => 'signed char', nature => 'int', ord => 2, }, UnsignedChar => {name => 'unsigned char', nature => 'int', ord => 2, }, Short => {name => 'short int', nature => 'int', ord => 3, }, UnsignedShort => {name => 'unsigned short int', nature => 'int', ord => 3, }, Int => {name => 'int', nature => 'int', ord => 4, }, UnsignedInt => {name => 'unsigned int', nature => 'int', ord => 4, }, Long => {name => 'long int', nature => 'int', ord => 5, }, UnsignedLong => {name => 'unsigned long int', nature => 'int', ord => 5, }, LongLong => {name => 'long long int', nature => 'int', ord => 6, }, UnsignedLongLong => {name => 'unsigned long long int', nature => 'int', ord => 6, }, Float => {name => 'float', nature => 'float', ord => 1, }, Double => {name => 'double', nature => 'float', ord => 2, }, LongDouble => {name => 'long double', nature => 'float', ord => 3, }, Bool => {name => '_Bool', nature => 'int', ord => 'undef', }, FloatComplex => {name => 'float complex', nature => 'complex', ord => 1, }, DoubleComplex => {name => 'double complex', nature => 'complex', ord => 2, }, LongDoubleComplex => {name => 'long double complex', nature => 'complex', ord => 3, }, FloatImaginary => {name => 'float imaginary', nature => 'imaginary', ord => 1, }, DoubleImaginary => {name => 'double imaginary', nature => 'imaginary', ord => 2, }, LongDoubleImaginary => {name => 'long double imaginary', nature => 'imaginary', ord => 3, }, Enum => {name => '', nature => 'int', ord => 'undef', }, ); foreach my $class (keys %type_info) { eval <<"END"; package CType::Fundamental::$class; our \@ISA = qw/CType::Fundamental/; sub nature {return '$type_info{$class}{nature}';} sub name {return '$type_info{$class}{name}';} sub ord {return $type_info{$class}{ord};} END die if $@; } sub _add_type { my $specifiers = shift; my $class = shift; my $nature = shift; my $type_key = join(' ', sort @$specifiers); die "Duplicate type key $type_key" if exists $types{$type_key}; $types{$type_key} = 'CType::Fundamental::' . $class; } # These are all the valid type names, and their relationship to the # fundamental types. Some types have multiple names, some do not. # These are all the valid type specifier combinations and their # meaning, taken from the list in ISO C99 6.7.2.2 _add_type([qw/void/], 'Void'); _add_type([qw/void */], 'VoidPtr'); _add_type([qw/char/], 'Char'); _add_type([qw/signed char/], 'SignedChar'); _add_type([qw/unsigned char/], 'UnsignedChar'); _add_type([qw/short/], 'Short'); _add_type([qw/signed short/], 'Short'); _add_type([qw/short int/], 'Short'); _add_type([qw/signed short int/], 'Short'); _add_type([qw/unsigned short/], 'UnsignedShort'); _add_type([qw/unsigned short int/], 'UnsignedShort'); _add_type([qw/int/], 'Int'); _add_type([qw/signed/], 'Int'); _add_type([qw/signed int/], 'Int'); _add_type([qw/unsigned/], 'UnsignedInt'); _add_type([qw/unsigned int/], 'UnsignedInt'); _add_type([qw/long/], 'Long'); _add_type([qw/signed long/], 'Long'); _add_type([qw/long int/], 'Long'); _add_type([qw/signed long int/], 'Long'); _add_type([qw/unsigned long/], 'UnsignedLong'); _add_type([qw/unsigned long int/], 'UnsignedLong'); _add_type([qw/long long/], 'LongLong'); _add_type([qw/signed long long/], 'LongLong'); _add_type([qw/long long int/], 'LongLong'); _add_type([qw/signed long long int/], 'LongLong'); _add_type([qw/unsigned long long/], 'UnsignedLongLong'); _add_type([qw/unsigned long long int/], 'UnsignedLongLong'); _add_type([qw/float/], 'Float'); _add_type([qw/double/], 'Double'); _add_type([qw/long double/], 'LongDouble'); _add_type([qw/_Bool/], 'Bool'); _add_type([qw/float _Complex/], 'FloatComplex'); _add_type([qw/double _Complex/], 'DoubleComplex'); _add_type([qw/long double _Complex/], 'LongDoubleComplex'); _add_type([qw/float _Imaginary/], 'FloatImaginary'); _add_type([qw/double _Imaginary/], 'DoubleImaginary'); _add_type([qw/long double _Imaginary/], 'LongDoubleImaginary'); _add_type([qw/enum null_enum/], 'Enum'); sub new { my $this = shift; my $class = ref($this) || $this; my $specifiers = shift; my $attributes = shift; my $type_key = join(' ', sort @$specifiers); unless (exists $types{$type_key}) { die "unknown type " . join(' ', @$specifiers); } my $type_class = $types{$type_key}; my $self = {attributes => $attributes, }; bless $self, $type_class; $self->process_attributes($attributes); return $self } sub new_class { my $type_class = shift; my $attributes = []; my $self = {attributes => $attributes, }; bless $self, $type_class; $self->process_attributes($attributes); return $self } sub CType::Fundamental::Void::describe { my $self = shift; return "void"; } sub describe { my $self = shift; my $qualifiers = $self->describe_qualifiers; $qualifiers .= ' ' if $qualifiers; my $signed = $self->signed ? 'signed' : 'unsigned'; my $width = $self->width . "-bit"; my $nature = $self->nature; return "$qualifiers$signed $width $nature"; } sub dump_c { my $self = shift; my $skip_cpp = shift; my $qualifiers = $self->dump_c_qualifiers; my $str = ''; $str .= $self->name; $str .= ' ' . $qualifiers if $qualifiers; return $str; } # This function contemplates the fundamental size relationships # between types as laid down in the C spec. This is different from the # *actual* sizes of the types. 'int' and 'long int' may be the same # size on this platform, but 'long int' always has a higher # ordinality, because the C spec says that long int must always be *at # least* as big as int. # # So, what we're talking about here is the *possible* ordering on some # platforms. Some types compare equal - signed char and unsigned char # are always the same thing, for example. Some types do not have a # meaningful comparison - there is no fixed relation between int and # void *; on some platforms one is larger, and on some the other is. # # This function returns 0 if the types are ordinally equal, 1 if $a is # larger, -1 if $b is larger, and undef if it can't tell. This is an # expanded starship operator. # # This information is used in alignment analysis, to determine which # the dominant types are. If a structure has long int alignment, then # we don't need to note that it's also aligned for short int, because # that's ordinally smaller. But if it has both int and void * # alignment, we need both because they're ordinally undefined. sub compare_ord { my $a = shift; my $b = shift; $a = $a->type if $a->isa('CExpr::Alignof'); $b = $b->type if $b->isa('CExpr::Alignof'); # Anything that's the same type is equal return 0 if ref $a eq ref $b; # All pointers are equal return 0 if $a->isa('CType::Fundamental::VoidPtr') and $b->isa('CType::Fundamental::VoidPtr'); # Anything that's not a fundamental type is undef return undef unless $a->isa('CType::Fundamental'); return undef unless $b->isa('CType::Fundamental'); # Two types of differing nature are undef return undef if $a->nature ne $b->nature; # Certain types have no ordinal relations, like void *; we use an # undef ordinal value to indicate this return undef if not defined $a->ord; return undef if not defined $b->ord; return $a->ord <=> $b->ord; } sub compare { my $self = shift; my $other = shift; } our %min_values; our %max_values; our %alignment_exprs; sub register_type_attrs { my $type = shift; my $width = shift; my $alignment = shift; my $signed = shift; my $min_value = shift; my $max_value = shift; my @specifiers = split / /, $type; my $type_key = join(' ', sort @specifiers); unless (exists $types{$type_key}) { die "unknown type $type"; } my $type_class = $types{$type_key}; $min_values{$type_class} = $min_value; $max_values{$type_class} = $max_value; eval <<"END"; package ${type_class}; use CExpr::Alignof; sub width {my \$self = shift; return (ref \$self ? \$self->{width} : undef) || $width;} sub alignment {my \$self = shift; return (ref \$self ? \$self->{alignment} : undef) || $alignment;} sub alignment_exprs {my \$self = shift; return (ref \$self ? \$self->{alignment_exprs} : undef) || \$CType::Fundamental::alignment_exprs{'$type_class'};} sub signed {my \$self = shift; return (ref \$self ? \$self->{signed} : undef) || $signed;} sub min_value {my \$self = shift; return (ref \$self ? \$self->{min_value} : undef) || \$CType::Fundamental::min_values{'$type_class'};} sub max_value {my \$self = shift; return (ref \$self ? \$self->{max_value} : undef) || \$CType::Fundamental::max_values{'$type_class'};} END die if $@; my $type_obj = new_class($type_class); $alignment_exprs{$type_class} = new CExpr::Alignof $type_obj; } register_type_attrs('void', 0, 0, 0, 0, 0); sub can_represent { my $self = shift; my $value = shift; return 0 if $value < $self->min_value; return 0 if $value > $self->max_value; return 1; } sub pick_smallest_type { my $min_value = shift; my $max_value = shift; my $best = undef; foreach my $type_class (map {'CType::Fundamental::' . $_} keys %type_info) { next unless $type_class->can('min_value'); next unless $type_class->can('max_value'); next if $type_class->min_value == $type_class->max_value; next if $type_class->min_value > $min_value; next if $type_class->max_value < $max_value; next if defined $best and $best->width < $type_class->width; next if defined $best and $best->width == $type_class->width and $best->signed < $type_class->signed; $best = $type_class; } return $best; } sub layout { } sub _check_interface { my $self = shift; my $other = shift; return 'both' unless $other->isa('CType::Fundamental'); my @ret; push @ret, $self->check_sizes($other); push @ret, $self->check_qualifiers($other); if ($self->nature ne $other->nature) { push @ret, 'both'; } return @ret; } sub get_refs { return (); } 1; icheck-0.9.7/CType/Union.pm0000644000175000017500000001111610273455727016131 0ustar asuffieldasuffieldpackage CType::Union; use 5.6.0; use strict; use warnings; use CType; use CExpr::Integer; use CType::Structural; our @ISA = qw/CType::Structural CType/; sub new { my $this = shift; my $class = ref($this) || $this; my $members = shift; my $attributes = shift; my $location = shift; my $self = {members => $members, attributes => $attributes, file => $location->{file}, line => $location->{line}, pos => $location->{pos}, alignment_exprs => [], }; bless $self, $class; $self->process_attributes($attributes); return $self; } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; return if defined $self->{width}; $_->layout($accept_incomplete, $namespace) foreach @{$self->{members}}; if ($accept_incomplete and grep {not $_->complete} @{$self->{members}}) { # This type is incomplete and we don't care return; } my $width = 0; foreach my $member (@{$self->{members}}) { $width = $member->width if $member->width > $width; $self->add_alignment($_) foreach $member->alignment_exprs; } $self->{width} = $width; $self->{alignment} = $self->compute_alignment; } sub complete { my $self = shift; return defined $self->{width} ? 1 : 0; } sub describe { my $self = shift; my @members = map {$_->describe} @{$self->{members}}; return "union {" . join(', ', @members) . "}"; } sub dump_c { my $self = shift; my $skip_cpp = shift; my $tag = shift; my $str = ""; $str .= $self->dump_location($skip_cpp); my $qualifiers = $self->dump_c_qualifiers; $str .= 'union'; if ($qualifiers) { $str .= ' '; $str .= $qualifiers; } if ($tag) { $str .= ' '; $str .= $tag; } $str .= "\n"; $str .= " {\n"; my @members = map {split /\n/, $_->dump_c($skip_cpp)} @{$self->{members}}; $str .= " $_\n" foreach @members; $str .= " }\n"; return $str; } sub get_refs { my $self = shift; return (map {$_->get_refs} @{$self->{members}}); } sub _check_interface { my $self = shift; my $other = shift; return 'both' unless $other->isa('CType::Union'); my %self_member_name_index; foreach my $member (@{$self->{members}}) { $self_member_name_index{$member->identifier} = $member; } my %other_member_name_index; foreach my $member (@{$other->{members}}) { $other_member_name_index{$member->identifier} = $member; } my @ret; if ($self->{width} and $other->{width}) { if ($self->{width} != $other->{width}) { print "ABI mismatch: size of $self->{width} versus $other->{width}\n"; push @ret, {abi_forward => 1, abi_backward => 1}; } } elsif ($self->{width}) { print "Can't check type (old version is incomplete)\n"; return {abi_forward => 1, abi_backward => 1, api_forward => 1, api_backward => 1}; } elsif ($other->{width}) { print "Can't check type (new version is incomplete)\n"; return {abi_forward => 1, abi_backward => 1, api_forward => 1, api_backward => 1}; } if ($self->alignment != $other->alignment) { print "ABI mismatch: alignment of " . $self->alignment . " versus " . $other->alignment . "\n"; push @ret, {abi_forward => 1, abi_backward => 1}; } # First, we take out all the things with matching identifiers foreach my $member (sort {$a->identifier cmp $b->identifier} values %self_member_name_index) { my $other_member = $other_member_name_index{$member->identifier}; next unless $other_member; push @ret, $member->check_interface($other_member); delete $self_member_name_index{$member->identifier}; delete $other_member_name_index{$member->identifier}; } # Now we hit all the stuff that's been added or removed foreach my $member (sort {$a->identifier cmp $b->identifier} values %other_member_name_index) { print "API and ABI removal: member " . $member->identifier . " is gone\n"; push @ret, {api_backward => 1, abi_backward => 1}; } foreach my $member (sort {$a->identifier cmp $b->identifier} values %self_member_name_index) { print "API and ABI addition: member " . $member->identifier . " is new\n"; push @ret, {api_forward => 1, abi_forward => 1}; } return @ret; } 1; icheck-0.9.7/CType/BitField.pm0000644000175000017500000000316710273271261016517 0ustar asuffieldasuffieldpackage CType::BitField; use 5.6.0; use strict; use warnings; use CType; our @ISA = qw/CType/; sub new { my $this = shift; my $class = ref($this) || $this; my $type = shift; my $width = shift; my $self = {type => $type, width => $width->compute, }; bless $self, $class; return $self; } sub width { my $self = shift; return $self->{width}; } sub alignment { my $self = shift; return $self->{type}->alignment; } sub alignment_exprs { my $self = shift; return $self->{type}->alignment_exprs; } sub layout { } sub dump_c { my $self = shift; my $skip_cpp = shift; my $name = shift; my $str = ""; $str .= $self->dump_location($skip_cpp); if ($self->{type}->capture_declarator) { $str .= $self->{type}->dump_c($skip_cpp, $name); } else { $str .= $self->{type}->dump_c($skip_cpp) . ' ' . $name; } $str .= ' : '; $str .= $self->{width}; return $str; } sub capture_declarator { return 1; } sub describe { my $self = shift; my $width = $self->{width} . "-bit"; my $type = $self->{type}->describe; return "$width bitfield of $type"; } sub get_refs { my $self = shift; return $self->{type}->get_refs; } sub _check_interface { my $self = shift; my $other = shift; return 'both' unless $other->isa('CType::BitField'); my @ret; unless ($self->width == $other->width) { push @ret, 'abi'; } push @ret, $self->{type}->check_interface($other->{type}); return @ret; } 1; icheck-0.9.7/CType/Function.pm0000644000175000017500000000457610273204214016621 0ustar asuffieldasuffieldpackage CType::Function; use 5.6.0; use strict; use warnings; use CType; no warnings 'recursion'; our @ISA = qw/CType/; sub new { my $this = shift; my $class = ref($this) || $this; my $type = shift; my $params = shift; my $attributes = shift; my $variadic = shift; my $self = {type => $type, params => $params, attributes => $attributes, variadic => $variadic, }; bless $self, $class; $self->process_attributes($attributes); return $self; } sub set_inline { my $self = shift; $self->{inline} = shift; } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $_->layout(0, $namespace) foreach @{$self->{params}}; } sub describe { my $self = shift; my $type = $self->{type}->describe; my @params = map {$_->describe} @{$self->{params}}; if (scalar @params == 0) { return "function taking no arguments, returning $type"; } else { return "function taking (" . join(', ', @params) . "), returning $type"; } } sub dump_c { my $self = shift; my $skip_cpp = shift; my $name = shift; my $str = ''; my $declarator = $name || ""; my @params = map {$_->dump_c($skip_cpp)} @{$self->{params}}; unless (scalar @params) { @params = ('void'); } my $params = join(', ', @params); if ($self->{type}->capture_declarator) { $str .= $self->{type}->dump_c($skip_cpp, "$declarator($params)"); } else { my $type = $self->{type}->dump_c($skip_cpp); $str .= "$type $declarator($params)"; } return $str; } sub capture_declarator { return 1; } sub _check_interface { my $self = shift; my $other = shift; return 'both' unless $other->isa('CType::Function'); my @ret; push @ret, $self->{type}->check_interface($other->{type}); push @ret, 'both' if scalar @{$self->{params}} != scalar @{$other->{params}}; foreach my $i (0 .. scalar @{$self->{params}} - 1) { last if $i >= scalar @{$other->{params}}; push @ret, $self->{params}[$i]->check_interface($other->{params}[$i], 1); } return @ret; } sub get_refs { my $self = shift; return ($self->{type}->get_refs, map {$_->get_refs} @{$self->{params}}); } 1; icheck-0.9.7/CType/.arch-inventory0000644000175000017500000000002610273204214017431 0ustar asuffieldasuffieldprecious ^Native\.pm$ icheck-0.9.7/CType/Ref.pm0000644000175000017500000000662710273271261015555 0ustar asuffieldasuffieldpackage CType::Ref; use 5.6.0; use strict; use warnings; use Carp; use CType; no warnings 'recursion'; our @ISA = qw/CType/; my @refs; sub new { my $this = shift; my $class = ref($this) || $this; my $kind = shift; my $name = shift; my $namespace = shift; my $self = {kind => $kind, name => $name, type => undef, }; bless $self, $class; $self->do_complete($namespace) if $namespace; push @refs, $self unless $self->{type}; return $self; } sub kind { my $self = shift; return $self->{kind}; } sub name { my $self = shift; return $self->{name}; } sub complete_refs { my $namespace = shift; $_->do_complete($namespace) foreach @refs; @refs = (); } sub do_complete { my $self = shift; my $namespace = shift; $self->{type} = $namespace->get($self->{kind}, $self->{name}); } sub complete { my $self = shift; return $self->{type} ? $self->{type}->complete : 0; } sub best_type_for_comparison { my $self = shift; return $self unless $self->{type}; if ($self->{kind} eq 'ordinary') { # We look through typedefs, so that we can compare 'int' and # 'foo', where 'typedef int foo' return $self->{type}->best_type_for_comparison; } else { # We don't look through anything else, because 'int' and # 'struct foo' are always a mismatch return $self; } } sub type { my $self = shift; my $accept_incomplete = shift; unless ($self->{type}) { return undef if $accept_incomplete; confess "$self->{kind} $self->{name} is incomplete"; } return $self->{type}->type($accept_incomplete); } sub describe { my $self = shift; my $qualifiers = $self->describe_qualifiers; $qualifiers .= ' ' if $qualifiers; my $str = $qualifiers; if ($self->{kind} eq 'ordinary') { $str .= $self->{name}; } else { $str .= "$self->{kind} $self->{name}"; } return $str; } sub dump_c { my $self = shift; my $skip_cpp = shift; my $qualifiers = $self->dump_c_qualifiers; my $str = ''; if ($self->{kind} eq 'ordinary') { $str .= $self->{name}; } else { $str .= "$self->{kind} $self->{name}"; } $str .= ' ' . $qualifiers if $qualifiers; return $str; } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; # It's possible for us to get loops here, so we break cycles return if $self->{laying_out}; $self->{laying_out} = 1; my $type = $self->type($accept_incomplete); $type->layout($accept_incomplete, $namespace) if $type; $self->{laying_out} = 0; } sub _check_interface { my $self = shift; my $other = shift; return 'both' unless $other->isa('CType::Ref'); return 'both' if $self->{kind} ne $other->{kind}; return 'both' if $self->{name} ne $other->{name}; return 'ok'; } sub get_refs { my $self = shift; return ($self); } sub width { my $self = shift; return $self->type->width; } sub alignment { my $self = shift; return $self->type->alignment; } sub alignment_exprs { my $self = shift; return $self->type->alignment_exprs; } sub signed { my $self = shift; return $self->type->signed; } 1; icheck-0.9.7/CType/Enum.pm0000644000175000017500000001277310273455727015757 0ustar asuffieldasuffieldpackage CType::Enum; use 5.6.0; use strict; use warnings; use CType; use CType::Fundamental; use CType::Structural; use CExpr::Integer; use CDecl::Enumerator; our @ISA = qw/CType::Structural CType::Fundamental::Enum/; sub new { my $this = shift; my $class = ref($this) || $this; my $members = shift; my $attributes = shift; my $location = shift; my $self = {members => $members, attributes => $attributes, file => $location->{file}, line => $location->{line}, pos => $location->{pos}, alignment_exprs => [], }; bless $self, $class; $self->process_attributes($attributes); foreach my $attribute (@$attributes) { if ($attribute->name eq 'packed') { $self->{packed} = 1; } } return $self; } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; return if $self->{completed}; # Stop recursion return if $self->{laying_out}; $self->{laying_out} = 1; # Enums must always be complete $accept_incomplete = 0; my $min_value = undef; my $max_value = undef; my $last = undef; my %index; $self->{member_index} = \%index; foreach my $member (@{$self->{members}}) { if ($member->{value}) { $member->{value}->layout($accept_incomplete, $namespace); } else { if ($last) { $member->{value} = new CExpr::Integer ($last->compute + 1); } else { $member->{value} = new CExpr::Integer 0; } } my $this_value = $member->{value}->compute; $min_value = $this_value if not defined $min_value or $min_value > $this_value; $max_value = $this_value if not defined $max_value or $max_value < $this_value; $last = $member->{value}; $index{$member->{name}} = $member; # And update the namespace with a proper reference to the # enumerator. It'll all get horribly confused if we leave the # reference to $self in there $namespace->set('ordinary', $member->{name}, (new CDecl::Enumerator $self, $member->{name})); } if ($self->{packed}) { my $class = CType::Fundamental::pick_smallest_type $min_value, $max_value; $self->{width} = $class->width; $self->{signed} = $class->signed; $self->add_alignment(new CExpr::Integer ($class->alignment / 8)); } $self->{alignment} = $self->compute_alignment if scalar $self->alignment_exprs; $self->{laying_out} = 0; $self->{completed} = 1; } sub describe { my $self = shift; my @members = map {$_->{name} . ' = ' . $_->{value}->dump_c} @{$self->{members}}; return "enum {" . join(', ', @members) . "}"; } sub dump_c { my $self = shift; my $skip_cpp = shift; my $tag = shift; my $str = ""; $str .= $self->dump_location($skip_cpp); my $qualifiers = $self->dump_c_qualifiers; $str .= 'enum'; if ($qualifiers) { $str .= ' '; $str .= $qualifiers; } if ($tag) { $str .= ' '; $str .= $tag; } $str .= "\n"; $str .= " {\n"; my @members = map {$_->{name} . ' = ' . $_->{value}->dump_c} @{$self->{members}}; $str .= " $_,\n" foreach @members; $str .= " }\n"; return $str; } sub get_refs { my $self = shift; return (map {$_->{value}->get_refs} @{$self->{members}}); } sub get_value { my $self = shift; my $name = shift; return undef unless exists $self->{member_index}{$name}; return $self->{member_index}{$name}{value}; } sub _check_interface { my $self = shift; my $other = shift; return 'both' unless $other->isa('CType::Enum'); my %self_member_name_index = %{$self->{member_index}}; my %other_member_name_index = %{$other->{member_index}}; my @ret; if ($self->width != $other->width) { print "ABI mismatch: size of " . $self->width . " versus " . $other->width . "\n"; push @ret, {abi_forward => 1, abi_backward => 1}; } # First, we take out all the things with matching identifiers foreach my $member (sort {$a->{name} cmp $b->{name}} values %self_member_name_index) { my $other_member = $other_member_name_index{$member->{name}}; next unless $other_member; my $this_value = $member->{value}->compute; my $other_value = $other_member->{value}->compute; if ($this_value != $other_value) { print "ABI mismatch between values $this_value and $other_value for enumerator $member->{name}\n"; push @ret, {abi_forward => 1, abi_backward => 1}; } else { push @ret, 'ok'; } delete $self_member_name_index{$member->{name}}; delete $other_member_name_index{$member->{name}}; } # Now we hit all the stuff that's been added or removed foreach my $member (sort {$a->{name} cmp $b->{name}} values %other_member_name_index) { print "API removal: enumerator " . $member->{name} . " is gone\n"; push @ret, {api_backward => 1}; } foreach my $member (sort {$a->{name} cmp $b->{name}} values %self_member_name_index) { print "API addition: enumerator " . $member->{name} . " is new\n"; push @ret, {api_forward => 1}; } return @ret; } 1; icheck-0.9.7/CType/Struct.pm0000644000175000017500000002532410273455727016333 0ustar asuffieldasuffieldpackage CType::Struct; use 5.6.0; use strict; use warnings; use Carp; use CType; use CExpr::Integer; use CType::Structural; no warnings 'recursion'; our @ISA = qw/CType::Structural CType/; sub new { my $this = shift; my $class = ref($this) || $this; my $members = shift; my $attributes = shift; my $location = shift; my $self = {members => $members, attributes => $attributes, file => $location->{file}, line => $location->{line}, pos => $location->{pos}, alignment_exprs => [], }; bless $self, $class; $self->process_attributes($attributes); return $self; } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; return if defined $self->{width}; $_->layout($accept_incomplete, $namespace) foreach @{$self->{members}}; if ($accept_incomplete and grep {not $_->complete} @{$self->{members}}) { # This type is incomplete and we don't care return; } foreach my $attribute (@{$self->{attributes}}) { # A packed struct is an automatic packed attribute on all the # member declarations if ($attribute->name eq 'packed') { foreach (@{$self->{members}}) { if ($_->type->isa('CType::Struct') or $_->type->isa('CType::Enum') or $_->type->isa('CType::Union')) { $_->set_packed(1); } } } } my $offset = 0; my $have_variable_array = 0; my $previous_was_bitfield = 0; my @members; foreach my $member (@{$self->{members}}) { if ($have_variable_array) { die "Variable-length array is not the last struct member"; } if ($member->type->isa('CType::BitField')) { if ($member->type->width == 0) { # Zero-width bitfields are magic. This magic is # inexplicable. I'm just duplicating what gcc does. if ($previous_was_bitfield) { # The alignment of the struct is affected by a # zero-width bitfield if and only if the previous # member was a non-zero-width bitfield $self->add_alignment($_) foreach $member->alignment_exprs; } $previous_was_bitfield = undef; # And the less magic part: a zero-width bitfield # advances to the next 8-bit boundary (before # considering alignment), such that the previous and # next bitfields won't occupy the same byte my $x = $offset % 8; if ($x != 0) { # This value needs to be aligned, so we pad it $offset += 8 - $x; } } else { # The type of bitfields affects the alignment $self->add_alignment($_) foreach $member->alignment_exprs; $previous_was_bitfield = $member; # Declarations without identifiers are padding, not members if ($member->identifier) { push @members, $member; } } } elsif ($member->type->isa('CType::Array') and not $member->type->size) { $have_variable_array = 1; # We can't align a variable length array. Just note its position $member->set_offset($offset); push @members, $member; # Now, we should be exiting the loop here, since a # variable length array must be the last member; if we # don't, then the test at the top will report the error next; } else { if (not $member->packed) { # The type of unpacked fields affects the alignment $self->add_alignment($_) foreach $member->alignment_exprs; # And, of course, the offset my $x = $offset % $member->alignment; if ($x != 0) { # This value needs to be aligned, so we pad it $offset += $member->alignment - $x; } } push @members, $member; $previous_was_bitfield = undef; } $member->set_offset($offset); $offset += $member->width; } # And then pad out the struct to its own alignment my $alignment = $self->compute_alignment * 8; my $x = $offset % $alignment; if ($x != 0) { # This value needs to be aligned, so we pad it $offset += $alignment - $x; } $self->{width} = $offset; $self->{alignment} = $alignment; $self->{members} = \@members; } sub complete { my $self = shift; return defined $self->{width} ? 1 : 0; } sub describe { my $self = shift; my @members = map {$_->describe} @{$self->{members}}; return "struct {" . join(', ', @members) . "} of width $self->{width} and alignment $self->{alignment}"; } sub dump_c { my $self = shift; my $skip_cpp = shift; my $tag = shift; my $str = ""; $str .= $self->dump_location($skip_cpp); my $qualifiers = $self->dump_c_qualifiers; $str .= 'struct'; if ($qualifiers) { $str .= ' '; $str .= $qualifiers; } if ($tag) { $str .= ' '; $str .= $tag; } $str .= "\n"; $str .= " {\n"; my $offset = 0; foreach my $member (@{$self->{members}}) { if ($member->type->isa('CType::BitField')) { } elsif ($member->type->isa('CType::Array') and not $member->type->size) { # We can't do much with this, and it's the end of the array foreach my $line (split /\n/, $member->dump_c($skip_cpp)) { $str .= " $line\n" } last; } else { if (not $member->packed) { my $x = $offset % $member->alignment; if ($x != 0) { # This value needs to be aligned, so we pad it $offset += $member->alignment - $x; } } } if ($member->{offset} < $offset) { # Whoops, it didn't fit die; } if ($member->{offset} > $offset) { # We need some padding my $padding = $member->{offset} - $offset; $str .= " char : $padding;\n"; $offset += $padding; } foreach my $line (split /\n/, $member->dump_c($skip_cpp)) { $str .= " $line\n" } $offset += $member->width; } $str .= " }\n"; return $str; } sub get_refs { my $self = shift; return (map {$_->get_refs} @{$self->{members}}); } sub _check_interface { my $self = shift; my $other = shift; return 'both' unless $other->isa('CType::Struct'); my @ret; if ($self->{width} and $other->{width}) { if ($self->{width} != $other->{width}) { print "ABI mismatch: size of $self->{width} versus $other->{width}\n"; push @ret, {abi_forward => 1, abi_backward => 1}; } } elsif ($self->{width}) { print "Can't check type (old version is incomplete)\n"; return {abi_forward => 1, abi_backward => 1, api_forward => 1, api_backward => 1}; } elsif ($other->{width}) { print "Can't check type (new version is incomplete)\n"; return {abi_forward => 1, abi_backward => 1, api_forward => 1, api_backward => 1}; } if ($self->alignment != $other->alignment) { print "ABI mismatch: alignment of " . $self->alignment . " versus " . $other->alignment . "\n"; push @ret, {abi_forward => 1, abi_backward => 1}; } # We aren't interested in members without identifiers; padding can # change in any way without mattering to us. my %other_member_name_index; my %other_member_offset_index; foreach my $member (@{$other->{members}}) { next unless $member->identifier; $other_member_name_index{$member->identifier} = $member; $other_member_offset_index{$member->offset} = $member; } # We make multiple passes over the list of members, because we # want name matches to take absolute priority over offset matches # - if there is both a name and an offset match, we must always # pick the name match. Otherwise things get ugly when a struct # member is inserted in the middle. my %done; # Okay, first we'll try the member with the same name foreach my $member (@{$self->{members}}) { next unless $member->identifier; if ($other_member_name_index{$member->identifier}) { my $other_member = $other_member_name_index{$member->identifier}; push @ret, $member->check_interface($other_member); delete $other_member_name_index{$other_member->identifier}; delete $other_member_offset_index{$other_member->offset}; $done{$member}++; } } # Then the member at the same offset foreach my $member (@{$self->{members}}) { next unless $member->identifier; next if $done{$member}; if ($other_member_offset_index{$member->offset}) { my $other_member = $other_member_offset_index{$member->offset}; push @ret, $member->check_interface($other_member); delete $other_member_name_index{$other_member->identifier}; delete $other_member_offset_index{$other_member->offset}; $done{$member}++; } } foreach my $member (@{$self->{members}}) { next unless $member->identifier; next if $done{$member}; # A member has been removed. This is a # forwards-incompatible change print "API and ABI addition: member " . $member->identifier . " is new\n"; push @ret, {api_forward => 1, abi_forward => 1}; } # We've been removing members from the indices as we check them # off. If anything's left, members have been added. foreach my $member (sort {$a->identifier cmp $b->identifier} values %other_member_name_index) { print "API and ABI removal: member " . $member->identifier . " is gone\n"; push @ret, {api_backward => 1, abi_backward => 1}; } return @ret; } 1; icheck-0.9.7/CParse.pm0000644000175000017500000000272410273204251015157 0ustar asuffieldasuffieldpackage CParse; use 5.6.0; use strict; use warnings; use Exporter; use CParse::Parser::Perl; use CParse::Parser::PerlXS; our @ISA = qw/Exporter/; our @EXPORT = qw/parse_file/; our $current_location = undef; $::RD_HINT = 1 if $ENV{RD_HINT}; $::RD_TRACE = 1 if $ENV{RD_TRACE}; my $parser = $ENV{ICHECK_PARSER_XSUB} ? new CParse::Parser::PerlXS : new CParse::Parser::Perl; die "Couldn't create parser" unless $parser; sub parse_file { my $filename = shift; my @args = @_; my $fh; open($fh, "-|", "gcc", @args, "-E", "-x", "c-header", $filename) or die "Failed to spawn gcc: $!"; my %line_map; my $current_line = 1; my $current_file = $filename; my @data; while (<$fh>) { chomp; if (/^#/) { if (/^# (\d+) "(.*)"((?: \d+)*)/) { ($current_line, $current_file, my $flags) = ($1, $2, $3); my %flags = map {$_=>1} split / /, $flags; next; } } else { my $data_line = scalar @data; $line_map{$data_line} = {file => $current_file, line => $current_line}; push @data, $_; } $current_line++; } close $fh; if ($?) { exit 1; } my $unit = $parser->unit(\@data, \%line_map); unless (defined $unit) { print STDERR "Failed to parse file $filename\n"; exit 1; } return $unit; } 1; icheck-0.9.7/NEWS0000644000175000017500000000111210273271261014136 0ustar asuffieldasuffieldHey, emacs! This is a -*- text -*- file icheck 0.9.6 ------------ * Bugfix release icheck 0.9.5 ------------ * Implement new parser in C. Set ICHECK_PARSER_XSUB=1 in the environment to use it. Roughly twice as fast as the perl parser. icheck 0.9.4 ------------ * Minor bugfix release * Add manpage icheck 0.9.3 ------------ * Significantly improve the description of struct differences * Add support for baseline files icheck 0.9.2 ------------ * Handle type conversions in enum values * Handle some more obscure gcc extensions icheck 0.9.1 ------------ * Initial release icheck-0.9.7/Makefile0000644000175000017500000001207610273273314015113 0ustar asuffieldasuffieldall: CType/Native.pm parser-perlxs clean: rm -f typegen.c typegen CType/Native.pm -$(MAKE) -C ext/CParse-Parser-PerlXS clean rm -f ext/CParse-Parser-PerlXS/Makefile.old prefix=/usr DESTDIR= INSTALL_bin_FILES = icheck INSTALL_perl_FILES = \ CDecl.pm CExpr.pm CParse.pm CType.pm \ CDecl/Enumerator.pm \ CExpr/Add.pm \ CExpr/Alignof.pm \ CExpr/ArraySubscript.pm \ CExpr/Assign/Add.pm \ CExpr/Assign/BitAnd.pm \ CExpr/Assign/BitOr.pm \ CExpr/Assign/BitXor.pm \ CExpr/Assign/Divide.pm \ CExpr/Assign/Modulus.pm \ CExpr/Assign/Multiply.pm \ CExpr/Assign/ShiftLeft.pm \ CExpr/Assign/ShiftRight.pm \ CExpr/Assign/Subtract.pm \ CExpr/BitAnd.pm \ CExpr/BitOr.pm \ CExpr/BitXor.pm \ CExpr/BoolAnd.pm \ CExpr/BoolOr.pm \ CExpr/Cast.pm \ CExpr/Conditional.pm \ CExpr/Divide.pm \ CExpr/Equal.pm \ CExpr/Greater.pm \ CExpr/GreaterEqual.pm \ CExpr/Integer.pm \ CExpr/Less.pm \ CExpr/LessEqual.pm \ CExpr/Member.pm \ CExpr/MemberIndirect.pm \ CExpr/Modulus.pm \ CExpr/Multiply.pm \ CExpr/NotEqual.pm \ CExpr/Postdec.pm \ CExpr/Postinc.pm \ CExpr/Predec.pm \ CExpr/Preinc.pm \ CExpr/Ref.pm \ CExpr/SeqExpression.pm \ CExpr/ShiftLeft.pm \ CExpr/ShiftRight.pm \ CExpr/Sizeof.pm \ CExpr/SizeofExpr.pm \ CExpr/Subtract.pm \ CExpr/Unary/AddressOf.pm \ CExpr/Unary/BitNot.pm \ CExpr/Unary/BoolNot.pm \ CExpr/Unary/Deref.pm \ CExpr/Unary/Negative.pm \ CExpr/Unary/Positive.pm \ CParse/Attribute.pm \ CParse/AttributeList.pm \ CParse/Char.pm \ CParse/Declaration.pm \ CParse/Declarator.pm \ CParse/Declarator/Array.pm \ CParse/Declarator/Direct.pm \ CParse/Declarator/Function.pm \ CParse/Enum.pm \ CParse/EnumRef.pm \ CParse/Enumerator.pm \ CParse/Extension.pm \ CParse/Float.pm \ CParse/Function.pm \ CParse/FunctionSpecifier.pm \ CParse/Identifier.pm \ CParse/Integer.pm \ CParse/Namespace.pm \ CParse/Op.pm \ CParse/Op/Add.pm \ CParse/Op/Alignof.pm \ CParse/Op/ArraySubscript.pm \ CParse/Op/Assign.pm \ CParse/Op/Assign/Add.pm \ CParse/Op/Assign/BitAnd.pm \ CParse/Op/Assign/BitOr.pm \ CParse/Op/Assign/BitXor.pm \ CParse/Op/Assign/Divide.pm \ CParse/Op/Assign/Modulus.pm \ CParse/Op/Assign/Multiply.pm \ CParse/Op/Assign/ShiftLeft.pm \ CParse/Op/Assign/ShiftRight.pm \ CParse/Op/Assign/Subtract.pm \ CParse/Op/BitAnd.pm \ CParse/Op/BitOr.pm \ CParse/Op/BitXor.pm \ CParse/Op/BoolAnd.pm \ CParse/Op/BoolOr.pm \ CParse/Op/Call.pm \ CParse/Op/Cast.pm \ CParse/Op/Conditional.pm \ CParse/Op/Divide.pm \ CParse/Op/Equal.pm \ CParse/Op/Expression.pm \ CParse/Op/Member.pm \ CParse/Op/MemberIndirect.pm \ CParse/Op/Modulus.pm \ CParse/Op/Multiply.pm \ CParse/Op/NotEqual.pm \ CParse/Op/Postdec.pm \ CParse/Op/Postfix.pm \ CParse/Op/Postinc.pm \ CParse/Op/Predec.pm \ CParse/Op/Preinc.pm \ CParse/Op/Relation.pm \ CParse/Op/Relation/Greater.pm \ CParse/Op/Relation/GreaterEqual.pm \ CParse/Op/Relation/Less.pm \ CParse/Op/Relation/LessEqual.pm \ CParse/Op/Shift.pm \ CParse/Op/Shift/Left.pm \ CParse/Op/Shift/Right.pm \ CParse/Op/Sizeof.pm \ CParse/Op/SizeofExpr.pm \ CParse/Op/Subtract.pm \ CParse/Op/Unary.pm \ CParse/Op/Unary/AddressOf.pm \ CParse/Op/Unary/BitNot.pm \ CParse/Op/Unary/BoolNot.pm \ CParse/Op/Unary/Deref.pm \ CParse/Op/Unary/Negative.pm \ CParse/Op/Unary/Positive.pm \ CParse/ParameterDeclaration.pm \ CParse/Parser/Perl.pm \ CParse/Parser/Token/Character.pm \ CParse/Parser/Token/Float.pm \ CParse/Parser/Token/Identifier.pm \ CParse/Parser/Token/Integer.pm \ CParse/Parser/Token/Keyword.pm \ CParse/Parser/Token/Punctuator.pm \ CParse/Parser/Token/String.pm \ CParse/Pointer.pm \ CParse/StorageClass.pm \ CParse/String.pm \ CParse/Struct.pm \ CParse/StructDeclaration.pm \ CParse/StructDeclarator.pm \ CParse/StructRef.pm \ CParse/TypeName.pm \ CParse/TypeQualifier.pm \ CParse/TypeSpecifier.pm \ CParse/Union.pm \ CParse/UnionRef.pm \ CType/Array.pm \ CType/BitField.pm \ CType/Builtin.pm \ CType/Enum.pm \ CType/Function.pm \ CType/Fundamental.pm \ CType/Native.pm \ CType/Pointer.pm \ CType/Ref.pm \ CType/Struct.pm \ CType/Union.pm INSTALL_arch_perl_FILES = CType/Native.pm install: mkdir -p "$(DESTDIR)$(prefix)/bin" for i in $(INSTALL_bin_FILES); \ do \ cp $$i "$(DESTDIR)$(prefix)/bin/$$i"; \ done for i in $(INSTALL_perl_FILES); \ do \ mkdir -p `dirname "$(DESTDIR)$(prefix)/share/icheck/perl5/$$i"`; \ cp $$i "$(DESTDIR)$(prefix)/share/icheck/perl5/$$i"; \ done for i in $(INSTALL_arch_perl_FILES); \ do \ mkdir -p `dirname "$(DESTDIR)$(prefix)/lib/icheck/perl5/$$i"`; \ cp $$i "$(DESTDIR)$(prefix)/lib/icheck/perl5/$$i"; \ done $(MAKE) -C ext/CParse-Parser-PerlXS install test: ./test.pl t gen-tests: ./make_tests.pl t typegen.c: typegen.pl ./typegen.pl > typegen.c.new mv typegen.c.new typegen.c typegen: typegen.c gcc -std=gnu99 -o typegen typegen.c CType/Native.pm: typegen ./typegen > CType/Native.pm.new mv CType/Native.pm.new CType/Native.pm parser-perlxs: (cd ext/CParse-Parser-PerlXS && perl Makefile.PL INSTALLSITELIB=$(DESTDIR)$(prefix)/share/icheck/perl5/ INSTALLSITEARCH=$(DESTDIR)$(prefix)/lib/icheck/perl5 OPTIMIZE="-O2 -Wall -g") $(MAKE) -C ext/CParse-Parser-PerlXS icheck-0.9.7/.arch-inventory0000644000175000017500000000004010273204213016400 0ustar asuffieldasuffieldprecious ^(typegen|typegen\.c)$ icheck-0.9.7/CDecl.pm0000644000175000017500000001527310273271261014764 0ustar asuffieldasuffieldpackage CDecl; use 5.6.0; use strict; use warnings; no warnings 'recursion'; sub new { my $this = shift; my $class = ref($this) || $this; my $storage_class = shift; my $identifier = shift; my $type = shift; my $location = shift; my $self = {class => $storage_class, identifier => $identifier, type => $type, file => $location->{file}, line => $location->{line}, pos => $location->{pos}, }; bless $self, $class; return $self; } sub identifier { my $self = shift; return $self->{identifier}; } sub file { my $self = shift; return $self->{file}; } sub location { my $self = shift; return '' unless $self->{file}; return "$self->{file}:$self->{line}"; } sub describe_name { my $self = shift; my $name = ""; if ($self->{class}) { $name = $self->{class} . " "; } $name .= $self->{identifier} || ""; } sub dump_c { my $self = shift; my $skip_cpp = shift; my $cpp_line = ''; if ($self->{class} ne 'param' and $self->{file} and not $skip_cpp) { $cpp_line = "# $self->{line} \"$self->{file}\"\n"; } # We've now dumped cpp, so we don't do it again in this decl $skip_cpp = 1; my $class_prefix; if ($self->{class} eq 'member' or $self->{class} eq 'param') { $class_prefix = ''; } else { $class_prefix = $self->{class} . ' '; } my $decl_suffix; if ($self->{class} eq 'param') { $decl_suffix = ''; } else { $decl_suffix = ";\n"; } if ($self->{type}->capture_declarator) { my $str = $self->{type}->dump_c($skip_cpp, $self->{identifier}); $str =~ s/\n*$//; return $cpp_line . $class_prefix . $str . $decl_suffix; } my $declarator = $self->{identifier} ? " $self->{identifier}" : ""; my $str = $self->{type}->dump_c($skip_cpp); $str =~ s/\n*$//; return $cpp_line . $class_prefix . $str . $declarator . $decl_suffix; } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $accept_incomplete = 1 if $self->{class} eq 'extern'; return if $accept_incomplete and not $self->type($accept_incomplete); eval {$self->type($accept_incomplete)->layout($accept_incomplete, $namespace)}; if ($@) { print STDERR "While laying out " . $self->dump_c(1) . ":\n"; die; } } sub type { my $self = shift; my $accept_incomplete = shift; return $self->{type}->type($accept_incomplete); } sub alignment { my $self = shift; return $self->type->alignment; } sub alignment_exprs { my $self = shift; return $self->type->alignment_exprs; } sub width { my $self = shift; return $self->type->width(@_); } sub signed { my $self = shift; return $self->type->signed(@_); } sub set_packed { my $self = shift; $self->{packed} = shift; } sub packed { my $self = shift; return $self->{packed} if defined $self->{packed}; return $self->type->packed(@_); } sub set_offset { my $self = shift; $self->{offset} = shift; } sub offset { my $self = shift; return $self->{offset}; } sub describe { my $self = shift; my $str = ""; if (defined $self->{offset} and $self->{identifier}) { $str .= " " if length $str; $str .= "$self->{offset} $self->{identifier}:"; } elsif (defined $self->{offset}) { $str .= " " if length $str; $str .= "$self->{offset}:"; } elsif ($self->{identifier}) { $str .= " " if length $str; $str .= "$self->{identifier}:"; } if ($self->{class} eq 'param' or $self->{class} eq 'member') { } else { $str .= " " if length $str; $str .= $self->{class}; } if ($self->{type}) { $str .= " " if length $str; $str .= $self->{type}->describe; } return $str; } sub check_interface { my $self = shift; my $other = shift; my $ignore_identifiers = shift; unless ($self->{type} and $other->{type}) { die "Unable to check types due to missing prototype; please don't use K&R C"; } my @ret = $self->{type}->check_interface($other->{type}); my $ret = {}; foreach (@ret) { foreach my $key (keys %$_) { $ret->{$key} = 1 if $_->{$key}; } } if ($self->{class} ne $other->{class}) { print "API and ABI mismatch: storage class '$self->{class}' versus '$other->{class}'\n"; $ret->{api_forward} = 1; $ret->{api_backward} = 1; $ret->{abi_forward} = 1; $ret->{abi_backward} = 1; } if (not $ignore_identifiers) { if (defined $self->{identifier} and defined $other->{identifier}) { if ($self->{identifier} ne $other->{identifier}) { print "API mismatch: identifier '$self->{identifier}' versus '$other->{identifier}'\n"; $ret->{api_forward} = 1; $ret->{api_backward} = 1; } } elsif (defined $self->{identifier} or defined $other->{identifier}) { die; } } if (defined $self->{offset} and defined $other->{offset}) { if ($self->{offset} != $other->{offset}) { print "ABI mismatch: offset of $self->{offset} versus $other->{offset}\n"; $ret->{abi_forward} = 1; $ret->{abi_backward} = 1; } } elsif (defined $self->{offset} or defined $other->{offset}) { die "Internal error: offset for one decl but not the other"; } if (grep {$ret->{$_}} keys %$ret) { my $location = $self->location; if ($location) { print " in declaration at $location:\n"; } else { print " in declaration:\n"; } my $dump = $self->dump_c(1); $dump =~ s/\n?$/\n/; print $dump; my $other_location = $other->location; if ($other_location) { print " versus declaration at $location:\n"; } else { print " versus declaration:\n"; } my $other_dump = $other->dump_c(1); $other_dump =~ s/\n?$/\n/; print $other_dump; } return $ret; } sub get_refs { my $self = shift; return $self->{type}->get_refs; } sub complete { my $self = shift; return $self->{type}->complete; } 1; icheck-0.9.7/CParse/0000755000175000017500000000000010273206717014625 5ustar asuffieldasuffieldicheck-0.9.7/CParse/StructRef.pm0000644000175000017500000000075710273204214017103 0ustar asuffieldasuffieldpackage CParse::StructRef; use 5.6.0; use strict; use warnings; use CType::Ref; sub new { my $this = shift; my $class = ref($this) || $this; my $tag = shift; my $self = {tag => $tag, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $tag = $self->{tag}; return "struct $tag"; } sub get_type { my $self = shift; my $namespace = shift; return new CType::Ref 'struct', $self->{tag}; } 1; icheck-0.9.7/CParse/TypeName.pm0000644000175000017500000000204510273204214016674 0ustar asuffieldasuffieldpackage CParse::TypeName; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $class = ref($this) || $this; my $specifiers = shift; my $declarator = shift; my $self = {declarator => $declarator, specifiers => $specifiers, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $str = join(' ', map {$_->dump_c} @{$self->{specifiers}}); if (defined $self->{declarator}) { $str .= " " . $self->{declarator}->dump_c; } return "$str"; } sub get_type { my $self = shift; my $namespace = shift; my @attributes; my @specifiers; foreach my $specifier (@{$self->{specifiers}}) { if ($specifier->isa('CParse::AttributeList')) { push @attributes, $specifier->attributes; } else { push @specifiers, $specifier; } } return $self->{declarator}->get_decl_type($namespace, \@specifiers, \@attributes); } 1; icheck-0.9.7/CParse/TypeSpecifier.pm0000644000175000017500000000062010273204214017722 0ustar asuffieldasuffieldpackage CParse::TypeSpecifier; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $class = ref($this) || $this; my $name = shift; my $self = {name => $name, }; bless $self, $class; return $self; } sub name { my $self = shift; return $self->{name}; } sub dump_c { my $self = shift; return $self->{name}; } 1; icheck-0.9.7/CParse/StorageClass.pm0000644000175000017500000000062510273204214017546 0ustar asuffieldasuffieldpackage CParse::StorageClass; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $class = ref($this) || $this; my $sclass = shift; my $self = {class => $sclass, }; bless $self, $class; return $self; } sub class { my $self = shift; return $self->{class}; } sub dump_c { my $self = shift; return $self->class; } 1; icheck-0.9.7/CParse/Declarator.pm0000644000175000017500000002013710273204213017233 0ustar asuffieldasuffieldpackage CParse::Declarator; use 5.6.0; use strict; use warnings; use CDecl; use CType::BitField; use CType::Fundamental; use CType::Ref; sub new { my $this = shift; my $class = ref($this) || $this; my $declarator = shift; my $pointer = shift; my $attributes1 = shift; my $attributes2 = shift; my $self = {declarator => $declarator, pointer => $pointer, attributes1 => $attributes1, attributes2 => $attributes2, }; bless $self, $class; return $self; } sub pointer { my $self = shift; return $self->{pointer}; } sub declarator { my $self = shift; return $self->{declarator}; } sub dump_c { my $self = shift; my $str = ""; if ($self->{attributes1}) { $str .= $self->{attributes1}->dump_c; } if (defined $self->{pointer}) { $str .= $self->{pointer}->dump_c; } if (defined $self->{declarator}) { $str .= " " if length $str; $str .= $self->{declarator}->dump_c; } if ($self->{attributes2}) { $str .= " " if length $str; $str .= $self->{attributes2}->dump_c; } return "$str"; } sub get_identifier { my $self = shift; return undef unless $self->{declarator}; return $self->{declarator}->get_identifier; } sub get_type { my $self = shift; my $namespace = shift; my $base_type = shift; my $attributes = shift; my $type = $base_type; if ($self->{pointer}) { $type = $self->{pointer}->get_type($type); } if ($self->{declarator}) { $type = $self->{declarator}->get_type($namespace, $type, $attributes); } return $type; } sub get_decl_type { my $self = shift; my $namespace = shift; my $specifiers = shift; my $decl_attributes = shift; my $parameter_name_magic = shift; my @attributes = (@$decl_attributes); push @attributes, $self->{attributes1}->attributes if $self->{attributes1}; push @attributes, $self->{attributes2}->attributes if $self->{attributes2}; my $maybe_identifier = undef; my %base_qualifiers; my @base_specifiers; my $base_type; foreach my $specifier (@$specifiers) { if ($specifier->isa('CParse::TypeQualifier')) { $base_qualifiers{$specifier->name} = 1; } elsif ($specifier->isa('CParse::TypeSpecifier')) { push @base_specifiers, $specifier->name; } elsif ($specifier->isa('CParse::Extension')) { # Ignore this next; } else { # Should be a type of some kind my $type; if ($specifier->isa('CParse::Identifier')) { # If we're doing the magic for function parameter # names, and this is an identifier for which we # already have a type, then we'll reclassify it as an # identifier if ($parameter_name_magic and (scalar @base_specifiers or $base_type)) { # If we get more than one of these, the first is actually an error if ($maybe_identifier) { die "Undefined identifier " . $maybe_identifier->name . "\n"; } $maybe_identifier = $specifier; next; } # We'll check that it exists now, but we'll put a # reference in anyway, so that output later retains # this as a reference rather than duplicating the type # definition unless ($namespace->get('ordinary', $specifier->name)) { die "Undefined identifier " . $specifier->name . "\n"; } $type = new CType::Ref 'ordinary', $specifier->name, $namespace; } elsif ($specifier->isa('CParse::Struct') or $specifier->isa('CParse::Union') or $specifier->isa('CParse::Enum')) { $type = $specifier->get_type($namespace, undef, []); } elsif ($specifier->isa('CParse::StructRef') or $specifier->isa('CParse::UnionRef') or $specifier->isa('CParse::EnumRef')) { $type = $specifier->get_type($namespace, undef, []); } else { die "Unhandled specifier $specifier\n"; } if (defined $base_type) { die "Syntax error, multiple types in declaration\n"; } $base_type = $type; } } if ($base_type and scalar @base_specifiers) { die "Syntax error, both type identifier and specifiers in declaration\n"; } if (not $base_type and not scalar @base_specifiers) { die "Syntax error, no type in declaration\n"; } if (not $base_type) { $base_type = new CType::Fundamental \@base_specifiers, \@attributes; } $base_type->set_qualifiers([keys %base_qualifiers]); return $self->get_type($namespace, $base_type, []); } sub get_member { my $self = shift; my $namespace = shift; my $field_width = shift; my $specifiers = shift; my $decl_attributes = shift; my $identifier = $self->{declarator} ? $self->{declarator}->get_identifier : undef; if (not $identifier and scalar @$specifiers) { # Maybe our identifier got lost; the parser doesn't know what # is a valid type, so declarator identifiers can end up on the # end of the list of type specifiers instead my $specifier = $specifiers->[-1]; if ($specifier->isa('CParse::Identifier') and not $namespace->get('ordinary', $specifier->name)) { # This is an undefined identifier. We should be defining it; it's not part of our type $identifier = $specifier->name; pop @$specifiers; } } if (not $identifier) { # Bitfields can lack identifiers. Everything else must have them. if (not $field_width) { die "Member declaration lacks an identifier\n"; } } my $type = $self->get_decl_type($namespace, $specifiers, $decl_attributes); if ($field_width) { $type = new CType::BitField $type, $field_width->get_expr($namespace); } return new CDecl 'member', $identifier, $type; } sub process_decl { my $self = shift; my $namespace = shift; my $storage_class = shift; my $specifiers = shift; my $inline = shift; my $decl_attributes = shift; my $identifier = $self->{declarator}->get_identifier; if (not $identifier and scalar @$specifiers) { # Maybe our identifier got lost; the parser doesn't know what # is a valid type, so declarator identifiers can end up on the # end of the list of type specifiers instead my $specifier = $specifiers->[-1]; if ($specifier->isa('CParse::Identifier') and not $namespace->get('ordinary', $specifier->name)) { # This is an undefined identifier. We should be defining it; it's not part of our type $identifier = $specifier->name; pop @$specifiers; } } unless (defined $identifier) { die "Declaration lacks an identifier\n"; } my $type = $self->get_decl_type($namespace, $specifiers, $decl_attributes); if ($type->isa('CType::Function')) { $type->set_inline($inline); } if ($storage_class and $storage_class->class eq 'typedef') { $type->set_location($CParse::current_location); $namespace->set('ordinary', $identifier, $type); } else { # Unclassified decls are extern, or near enough my $class = $storage_class ? $storage_class->class : 'extern'; my $decl = new CDecl $class, $identifier, $type, $CParse::current_location; $namespace->set('ordinary', $identifier, $decl); } } 1; icheck-0.9.7/CParse/Char.pm0000644000175000017500000000113310273204213016023 0ustar asuffieldasuffieldpackage CParse::Char; use 5.6.0; use strict; use warnings; use CParse::String qw/escape/; sub new { my $this = shift; my $class = ref($this) || $this; my $char = shift; my $wide = shift; my $self = {value => $char, wide => $wide, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $value = escape($self->{value}); return $self->{wide} ? "L'$value'" : "'$value'"; } sub get_expr { my $self = shift; my $namespace = shift; return new CExpr::Integer ord($self->{value}); } 1; icheck-0.9.7/CParse/Pointer.pm0000644000175000017500000000246410273204214016577 0ustar asuffieldasuffieldpackage CParse::Pointer; use 5.6.0; use strict; use warnings; use CType::Pointer; sub new { my $this = shift; my $class = ref($this) || $this; my $qualifiers = shift; my $pointer = shift; my $self = {qualifiers => $qualifiers, pointer => $pointer, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $str; if (scalar @{$self->{qualifiers}}) { my $qualifiers = join(' ', map {$_->dump_c} @{$self->{qualifiers}}); $str = "* $qualifiers"; } else { $str = "*"; } if (defined $self->{pointer}) { $str .= " " . $self->{pointer}->dump_c; } return $str; } sub get_type { my $self = shift; my $pointer_to_type = shift; my @attributes; my @qualifiers; foreach my $specifier (@{$self->{qualifiers}}) { if ($specifier->isa('CParse::AttributeList')) { push @attributes, $specifier->attributes; } else { push @qualifiers, $specifier; } } my $type = new CType::Pointer $pointer_to_type, \@qualifiers, \@attributes; if ($self->{pointer}) { $type = $self->{pointer}->get_type($type); } return $type; } 1; icheck-0.9.7/CParse/FunctionSpecifier.pm0000644000175000017500000000062410273204213020571 0ustar asuffieldasuffieldpackage CParse::FunctionSpecifier; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $class = ref($this) || $this; my $name = shift; my $self = {name => $name, }; bless $self, $class; return $self; } sub name { my $self = shift; return $self->{name}; } sub dump_c { my $self = shift; return $self->{name}; } 1; icheck-0.9.7/CParse/Integer.pm0000644000175000017500000000073010273204213016545 0ustar asuffieldasuffieldpackage CParse::Integer; use 5.6.0; use strict; use warnings; use CExpr::Integer; sub new { my $this = shift; my $class = ref($this) || $this; my $value = shift; my $self = {value => $value, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; return $self->{value}; } sub get_expr { my $self = shift; my $namespace = shift; return new CExpr::Integer $self->{value}; } 1; icheck-0.9.7/CParse/.arch-ids/0000755000175000017500000000000010273204213016362 5ustar asuffieldasuffieldicheck-0.9.7/CParse/.arch-ids/Integer.pm.id0000644000175000017500000000011110273204213020701 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.21 icheck-0.9.7/CParse/.arch-ids/Pointer.pm.id0000644000175000017500000000011110273204213020724 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.27 icheck-0.9.7/CParse/.arch-ids/StorageClass.pm.id0000644000175000017500000000011110273204213021676 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.28 icheck-0.9.7/CParse/.arch-ids/StructDeclaration.pm.id0000644000175000017500000000011110273204213022736 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.31 icheck-0.9.7/CParse/.arch-ids/Attribute.pm.id0000644000175000017500000000011010273204213021246 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.7 icheck-0.9.7/CParse/.arch-ids/StructDeclarator.pm.id0000644000175000017500000000011110273204213022571 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.32 icheck-0.9.7/CParse/.arch-ids/ParameterDeclaration.pm.id0000644000175000017500000000011110273204213023372 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.25 icheck-0.9.7/CParse/.arch-ids/Identifier.pm.id0000644000175000017500000000011110273204213021366 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.20 icheck-0.9.7/CParse/.arch-ids/StructRef.pm.id0000644000175000017500000000011110273204213021225 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.33 icheck-0.9.7/CParse/.arch-ids/TypeSpecifier.pm.id0000644000175000017500000000011110273204213022057 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28703.36 icheck-0.9.7/CParse/.arch-ids/Declarator.pm.id0000644000175000017500000000011110273204213021364 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.12 icheck-0.9.7/CParse/.arch-ids/Enum.pm.id0000644000175000017500000000011110273204213020210 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.13 icheck-0.9.7/CParse/.arch-ids/Float.pm.id0000644000175000017500000000011110273204213020351 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.17 icheck-0.9.7/CParse/.arch-ids/EnumRef.pm.id0000644000175000017500000000011110273204213020645 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.14 icheck-0.9.7/CParse/.arch-ids/Union.pm.id0000644000175000017500000000011110273204213020374 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28703.37 icheck-0.9.7/CParse/.arch-ids/=id0000644000175000017500000000011010273204213016766 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:20 2005 28700.3 icheck-0.9.7/CParse/.arch-ids/Enumerator.pm.id0000644000175000017500000000011110273204213021425 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.15 icheck-0.9.7/CParse/.arch-ids/Namespace.pm.id0000644000175000017500000000011110273204213021200 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.22 icheck-0.9.7/CParse/.arch-ids/FunctionSpecifier.pm.id0000644000175000017500000000011110273204213022723 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.19 icheck-0.9.7/CParse/.arch-ids/Extension.pm.id0000644000175000017500000000011110273204213021260 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.16 icheck-0.9.7/CParse/.arch-ids/String.pm.id0000644000175000017500000000011110273204213020552 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.29 icheck-0.9.7/CParse/.arch-ids/Char.pm.id0000644000175000017500000000011010273204213020160 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.9 icheck-0.9.7/CParse/.arch-ids/AttributeList.pm.id0000644000175000017500000000011010273204213022102 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.8 icheck-0.9.7/CParse/.arch-ids/UnionRef.pm.id0000644000175000017500000000011110273204213021031 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28703.38 icheck-0.9.7/CParse/.arch-ids/Struct.pm.id0000644000175000017500000000011110273204213020570 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.30 icheck-0.9.7/CParse/.arch-ids/Declaration.pm.id0000644000175000017500000000011110273204213021531 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.10 icheck-0.9.7/CParse/.arch-ids/Function.pm.id0000644000175000017500000000011110273204213021071 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.18 icheck-0.9.7/CParse/.arch-ids/Op.pm.id0000644000175000017500000000011110273204213017662 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.24 icheck-0.9.7/CParse/.arch-ids/TypeName.pm.id0000644000175000017500000000011110273204213021026 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.34 icheck-0.9.7/CParse/.arch-ids/TypeQualifier.pm.id0000644000175000017500000000011110273204213022067 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28703.35 icheck-0.9.7/CParse/StructDeclarator.pm0000644000175000017500000000133010273204214020433 0ustar asuffieldasuffieldpackage CParse::StructDeclarator; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $class = ref($this) || $this; my $declarator = shift; my $field_width = shift; my $self = {declarator => $declarator, field_width => $field_width, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $str = $self->{declarator}->dump_c; if (defined $self->{field_width}) { $str .= " : " . $self->{field_width}->dump_c; } return $str; } sub get_member { my $self = shift; my $namespace = shift; return $self->{declarator}->get_member($namespace, $self->{field_width}, @_); } 1; icheck-0.9.7/CParse/TypeQualifier.pm0000644000175000017500000000062010273204214017732 0ustar asuffieldasuffieldpackage CParse::TypeQualifier; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $class = ref($this) || $this; my $name = shift; my $self = {name => $name, }; bless $self, $class; return $self; } sub name { my $self = shift; return $self->{name}; } sub dump_c { my $self = shift; return $self->{name}; } 1; icheck-0.9.7/CParse/Op.pm0000644000175000017500000000076010273204213015531 0ustar asuffieldasuffieldpackage CParse::Op; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $list = shift; my $class = shift; eval "use $class;"; while (scalar @$list > 1) { my $left = shift @$list; my $op = shift @$list; my $right = shift @$list; unless (defined $right) { die; } my $new = $class->new($left, $right, $op); unshift @$list, $new; } return $list->[0]; } 1; icheck-0.9.7/CParse/Attribute.pm0000644000175000017500000000122510273204213017113 0ustar asuffieldasuffieldpackage CParse::Attribute; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $class = ref($this) || $this; my $name = shift; my $args = shift; my $self = {name => $name, args => $args, }; bless $self, $class; return $self; } sub name { my $self = shift; return $self->{name}; } sub args { my $self = shift; return $self->{args}; } sub dump_c { my $self = shift; my $str = $self->{name}; if (scalar @{$self->{args}}) { $str .= "(" . join(', ', map {$_->dump_c} @{$self->{args}}) . ")"; } return $str; } 1; icheck-0.9.7/CParse/Identifier.pm0000644000175000017500000000135510273204213017236 0ustar asuffieldasuffieldpackage CParse::Identifier; use 5.6.0; use strict; use warnings; use CExpr::Ref; sub new { my $this = shift; my $class = ref($this) || $this; my $name = shift; my $self = {name => $name, }; bless $self, $class; return $self; } sub name { my $self = shift; return $self->{name}; } sub dump_c { my $self = shift; return $self->name; } sub get_identifier { my $self = shift; return $self->name; } sub get_type { my $self = shift; my $namespace = shift; my $base_type = shift; my $attributes = shift; return $base_type; } sub get_expr { my $self = shift; my $namespace = shift; return new CExpr::Ref $self->name; } 1; icheck-0.9.7/CParse/Union.pm0000644000175000017500000000505010273206717016253 0ustar asuffieldasuffieldpackage CParse::Union; use 5.6.0; use strict; use warnings; use File::Spec; use CType::Union; use CType::Ref; sub new { my $this = shift; my $class = ref($this) || $this; my $tag = shift; my $declarations = shift; my $attributes1 = shift; my $attributes2 = shift; my $self = {tag => $tag, declarations => $declarations, attributes1 => $attributes1, attributes2 => $attributes2, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $str = "union"; if ($self->{attributes1}) { $str .= " " . $self->{attributes1}->dump_c; } if ($self->{tag}) { $str .= " $self->{tag}"; } $str .= "\n{\n"; foreach my $declaration (@{$self->{declarations}}) { my @dump = split /\n/, $declaration->dump_c; $str .= join('', map {" $_\n"} @dump); } $str .= "}"; if ($self->{attributes2}) { $str .= " " . $self->{attributes2}->dump_c; } return $str; } sub construct_type { my $self = shift; my $namespace = shift; my @attributes; push @attributes, $self->{attributes1}->attributes if $self->{attributes1}; push @attributes, $self->{attributes2}->attributes if $self->{attributes2}; $_->process($namespace) foreach grep {$_->isa('CParse::Struct') or $_->isa('CParse::Union') or $_->isa('CParse::Enum')} @{$self->{declarations}}; my @members = map {$_->get_members($namespace)} @{$self->{declarations}}; return new CType::Union \@members, \@attributes, $CParse::current_location; } sub process { my $self = shift; my $namespace = shift; if ($self->{tag}) { # Heuristic: we'll ignore redefinitions that occur at the same file:line my $old = $namespace->get('union', $self->{tag}); if ($old and (File::Spec->canonpath($old->{file}) ne File::Spec->canonpath($CParse::current_location->{file}) or $old->{line} ne $CParse::current_location->{line})) { die "Redefinition of union $self->{tag}\n (old definition at $old->{file}:$old->{line})\n"; } my $type = $self->construct_type($namespace); $namespace->set('union', $self->{tag}, $type); } } sub get_type { my $self = shift; my $namespace = shift; if ($self->{tag}) { return new CType::Ref 'union', $self->{tag}, $namespace; } else { return $self->construct_type($namespace); } } 1; icheck-0.9.7/CParse/Namespace.pm0000644000175000017500000004244510273204213017055 0ustar asuffieldasuffieldpackage CParse::Namespace; use 5.6.0; use strict; use warnings; use Carp; sub new { my $this = shift; my $class = ref($this) || $this; my $self = {label => {}, struct => {}, union => {}, enum => {}, ordinary => {}, baseline => undef, skip_from => {}, skip_from_re => [], only_from => {}, only_from_re => [], }; bless $self, $class; return $self; } sub baseline { my $self = shift; $self->{baseline} = shift; } sub skip_from { my $self = shift; $self->{skip_from}{$_} = 1 foreach @_; } sub skip_from_re { my $self = shift; push @{$self->{skip_from_re}}, @_; } sub only_from { my $self = shift; $self->{only_from}{$_} = 1 foreach @_; } sub only_from_re { my $self = shift; push @{$self->{only_from_re}}, @_; } sub should_skip { my $self = shift; my $data = shift; my $kind = shift; my $name = shift; if ($self->{baseline}) { return 1 if $self->{baseline}->get($kind, $name); } if ($data->file) { my $file = $data->file; # Skips first return 1 if $self->{skip_from}{$file}; foreach (@{$self->{skip_from_re}}) { return 1 if $file =~ $_; } # Stop if we don't have any onlys return 0 if not scalar keys %{$self->{only_from}} and not scalar @{$self->{only_from_re}}; # Then the onlys return 0 if $self->{only_from}{$file}; foreach (@{$self->{only_from_re}}) { return 0 if $file =~ $_; } return 1; } else { return 0; } } sub struct { my $self = shift; return $self->{struct}; } sub union { my $self = shift; return $self->{union}; } sub enum { my $self = shift; return $self->{enum}; } sub ordinary { my $self = shift; return $self->{ordinary}; } sub describe_thing { my $self = shift; my $kind = shift; my $name = shift; my $data = $self->get($kind, $name); unless ($data) { die "No such " . $self->describe_name($kind, $name); } if ($kind eq 'ordinary') { if ($data->isa('CDecl::Enumerator')) { } elsif ($data->isa('CDecl')) { print $data->describe($name) . "\n"; } else { return if $data->isa('CType::Builtin') and $data->name eq $name; print "typedef $name: " . $data->describe . "\n"; } } else { print "$kind $name: " . $data->describe . "\n"; } } sub describe { my $self = shift; return $self->describe_thing(@_) if scalar @_; foreach my $kind (qw/struct union enum ordinary/) { foreach my $name (sort keys %{$self->{$kind}}) { my $data = $self->get($kind, $name); next if $self->should_skip($data, $kind, $name); $self->describe_thing($kind, $name); } } } sub _dump_one_thing { my $self = shift; my $kind = shift; my $name = shift; my $skip_cpp = shift; my $data = $self->get($kind, $name); unless ($data) { die "No such " . $self->describe_name($kind, $name); } if ($kind eq 'ordinary') { if ($data->isa('CDecl::Enumerator')) { # We don't dump these directly, they're emitted as part of # the enum. We only find them here because enumerators get # pushed into the containing scope return; } elsif ($data->isa('CDecl')) { print $data->dump_c($skip_cpp); } else { return if $data->isa('CType::Builtin') and $data->name eq $name; if ($data->capture_declarator) { my $str = $data->dump_c(1, $name); $str =~ s/\n*$//; print $data->dump_location($skip_cpp); print "typedef $str;\n"; } else { my $str = $data->dump_c(1); $str =~ s/\n*$//; print $data->dump_location($skip_cpp); print "typedef $str $name;\n"; } } } else { my $str = $data->dump_c($skip_cpp, $name); $str =~ s/\n*$//; print $str . ";\n"; } } sub _dump_some_things { my $self = shift; my $things = shift; my $skip_cpp = shift; # First the declarations for the types that need them. This avoids # interdependencies foreach my $kind (qw/struct union enum/) { foreach my $name (sort keys %{$things->{$kind}}) { print "$kind $name;\n"; } } # Then the typedefs # # typedefs must be topologically sorted, because they have # interdependencies, and can't be pre-declared. This is the # depth-counting topological sort variant. my %depth; my @stack = map {{name => $_, depth => 1}} (keys %{$things->{ordinary}}); while (scalar @stack) { my $x = pop @stack; if (not defined $depth{$x->{name}} or $depth{$x->{name}} < $x->{depth}) { $depth{$x->{name}} = $x->{depth}; } my $data = $self->get('ordinary', $x->{name}); foreach my $ref ($data->get_refs) { # Only interested in typedefs. Everything else has already # been declared. next unless $ref->kind eq 'ordinary'; # We don't worry about incomplete types here next unless $self->get($ref->kind, $ref->name); unshift @stack, {name => $ref->name, depth => $x->{depth} + 1}; } } my @sequence = sort {$depth{$b} <=> $depth{$a} || $a cmp $b} keys %{$things->{ordinary}}; foreach my $name (@sequence) { my $data = $self->get('ordinary', $name); next if $data->isa('CDecl'); $self->_dump_one_thing('ordinary', $name, $skip_cpp); } # Then the structural types foreach my $kind (qw/struct union enum/) { foreach my $name (sort keys %{$things->{$kind}}) { $self->_dump_one_thing($kind, $name, $skip_cpp); } } # Then the external declarations foreach my $name (sort keys %{$things->{ordinary}}) { my $data = $self->get('ordinary', $name); next unless $data->isa('CDecl'); $self->_dump_one_thing('ordinary', $name, $skip_cpp); } } sub dump_thing { my $self = shift; my $kind = shift; my $name = shift; my $skip_cpp = shift; my $things = {}; $things->{$kind}{$name} = 1; my $deps = $self->find_deps(undef, $things); $self->_dump_some_things($deps, $skip_cpp); } sub dump { my $self = shift; my $skip_cpp = shift; my $things; foreach my $kind (qw/label struct union enum ordinary/) { foreach my $name (keys %{$self->{$kind}}) { my $data = $self->get($kind, $name); next if $self->should_skip($data, $kind, $name); $things->{$kind}{$name} = 1; } } my $deps = $self->find_deps(undef, $things); $self->_dump_some_things($deps, $skip_cpp); } sub compare_one_thing { my $self = shift; my $old = shift; my $kind = shift; my $name = shift; my $get_this = $self->get($kind, $name); my $get_old = $old->get($kind, $name); # We're not interested in comparing enumerators here; they are # handled in the comparison of the enum type itself. There are # five possible cases here: # (enun and enum) - ignore # (enum and missing) - ignore # (missing and enum) - ignore # (enum and X) - treat as (missing and X) # (X and enum) - treat as (X and missing) # Factor these two values out to make this more readable my $this_enum = $get_this && $get_this->isa('CDecl::Enumerator'); my $old_enum = $get_old && $get_old->isa('CDecl::Enumerator'); if ($get_this and $get_old) { if ($this_enum and $old_enum) { return {}; } elsif ($this_enum) { $get_this = undef; } elsif ($old_enum) { $get_old = undef; } } else { if ($this_enum) { return {}; } elsif ($old_enum) { return {}; } } if (not $get_this and not $get_old) { die "No such " . $self->describe_name($kind, $name); } elsif (not $get_this) { return if $self->should_skip($get_old, $kind, $name); my $ret; if ($kind eq 'ordinary' and $get_old->isa('CDecl')) { print "API and ABI removal: " . $self->describe_name($kind, $name) . " is gone\n"; $ret = {api_forward => 1, abi_forward => 1}; } else { print "API removal: " . $self->describe_name($kind, $name) . " is gone\n"; $ret = {api_forward => 1}; } my $location = $get_old->location; if ($location) { print " was defined at $location:\n"; } else { print " was:\n"; } $old->_dump_one_thing($kind, $name, 1); return $ret; } elsif (not $get_old) { return if $self->should_skip($get_this, $kind, $name); my $ret; if ($kind eq 'ordinary' and $get_this->isa('CDecl')) { print "API and ABI addition: " . $self->describe_name($kind, $name) . " is new\n"; $ret = {api_backward => 1, abi_backward => 1}; } else { print "API addition: " . $self->describe_name($kind, $name) . " is new\n"; $ret = {api_backward => 1}; } my $location = $get_this->location; if ($location) { print " is now defined at $location:\n"; } else { print " is now:\n"; } $self->_dump_one_thing($kind, $name, 1); return $ret; } else { if ($kind ne 'ordinary' or $get_this->isa('CDecl') and $get_old->isa('CDecl')) { my $ret; eval { $ret = $get_this->check_interface($get_old); }; if ($@) { print STDERR "While trying to check " . $self->describe_name($kind, $name) . ":\n"; die; } if ($kind ne 'ordinary' and grep {$ret->{$_}} keys %$ret) { my $location = $get_this->location; if ($location) { print " in type defined at $location:\n"; } else { print " in type:\n"; } $self->_dump_one_thing($kind, $name, 1); my $old_location = $get_old->location; if ($old_location) { print " versus type defined at $old_location:\n"; } else { print " versus type:\n"; } $old->_dump_one_thing($kind, $name, 1); } return $ret; } elsif ($get_this->isa('CDecl')) { print "API and ABI mismatch: declaration $name has become a typedef\n"; return {api_forward => 1, api_backward => 1, abi_forward => 1, abi_backward => 1}; } elsif ($get_old->isa('CDecl')) { print "API and ABI mismatch: typedef $name has become a declaration\n"; return {api_forward => 1, api_backward => 1, abi_forward => 1, abi_backward => 1}; } else { my @ret = $get_this->check_interface($get_old); my $ret = {}; foreach (@ret) { foreach my $key (keys %$_) { $ret->{$key} = 1 if $_->{$key}; } } if (grep {$ret->{$_}} keys %$ret) { my $location = $get_this->location; if ($location) { print " in declaration at $location:\n"; } else { print " in declaration:\n"; } $self->_dump_one_thing($kind, $name, 1); my $old_location = $get_old->location; if ($old_location) { print " versus declaration at $old_location:\n"; } else { print " versus declaration:\n"; } $old->_dump_one_thing($kind, $name, 1); } return $ret; } } } sub find_deps { my $self = shift; my $old = shift; my $things = shift; my %deps; my @queue; foreach my $kind (qw/struct union enum ordinary/) { foreach my $name (sort keys %{$things->{$kind}}) { push @queue, {kind => $kind, name => $name}; } } while (scalar @queue) { my $x = shift @queue; my $kind = $x->{kind}; my $name = $x->{name}; next if $deps{$kind}{$name}; $deps{$kind}{$name} = 1; foreach my $data (grep {defined $_} ($self->get($kind, $name), $old ? $old->get($kind, $name) : undef)) { foreach my $ref ($data->get_refs) { # We don't (can't) follow stuff that's not complete somewhere next unless $self->get($ref->kind, $ref->name) or ($old and $old->get($ref->kind, $ref->name)); push @queue, {kind => $ref->kind, name => $ref->name}; } } } # Anything that's in the baseline does not need to be emitted here if ($self->{baseline}) { foreach my $kind (qw/struct union enum ordinary/) { foreach my $name (keys %{$deps{$kind}}) { if ($self->{baseline}->get($kind, $name)) { delete $deps{$kind}{$name}; } } } } return \%deps; } sub compare_thing { my $self = shift; my $old = shift; my $kind = shift; my $name = shift; my $things = {}; $things->{$kind}{$name} = 1; my $deps = $self->find_deps($old, $things); my $ret; foreach my $kind (qw/struct union enum ordinary/) { foreach my $name (sort keys %{$deps->{$kind}}) { my $r = $self->compare_one_thing($old, $kind, $name); print "\n" if grep {$r->{$_}} keys %$r; foreach my $key (keys %$r) { $ret->{$key} = 1 if $r->{$key}; } } } return $ret; } sub describe_name { my $self = shift; my $kind = shift; my $name = shift; my $data = $self->get($kind, $name); if ($kind eq 'ordinary') { if (not $data or $data->isa('CDecl')) { return "identifier $name"; } elsif ($data->isa('CDecl::Enumerator')) { return "enumerator $name"; } else { return "typedef $name"; } } else { return "$kind $name"; } } sub compare { my $self = shift; my $old = shift; my $ret; # We compare everything that's not in skip_from, plus everything # they depend on my $things; foreach my $kind (qw/struct union enum ordinary/) { foreach my $name (keys %{$self->{$kind}}, keys %{$old->{$kind}}) { my $data = $self->get($kind, $name); next if $data and $self->should_skip($data, $kind, $name); my $old_data = $old->get($kind, $name); next if $old_data and $self->should_skip($old_data, $kind, $name); $things->{$kind}{$name} = 1; } } my $deps = $self->find_deps($old, $things); foreach my $kind (qw/struct union enum ordinary/) { foreach my $name (sort keys %{$deps->{$kind}}) { my $r = $self->compare_one_thing($old, $kind, $name); print "\n" if grep {$r->{$_}} keys %$r; foreach my $key (keys %$r) { $ret->{$key} = 1 if $r->{$key}; } } } return $ret; } sub get_decls { my $self = shift; return grep {$_->isa('CDecl')} values %{$self->{ordinary}}; } sub get_types { my $self = shift; return (values %{$self->{struct}}, values %{$self->{union}}, values %{$self->{enum}}, grep {not $_->isa('CDecl')} values %{$self->{ordinary}}); } sub set { my $self = shift; my $kind = shift; my $name = shift; my $data = shift; $self->{$kind}{$name} = $data; } sub get { my $self = shift; my $kind = shift; my $name = shift; return $self->{$kind}{$name}; } 1; icheck-0.9.7/CParse/Enumerator.pm0000644000175000017500000000133610273204213017274 0ustar asuffieldasuffieldpackage CParse::Enumerator; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $class = ref($this) || $this; my $name = shift; my $value = shift; my $self = {name => $name, value => $value, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $name = $self->{name}; if (defined $self->{value}) { my $value = $self->{value}->dump_c; return "$name = $value"; } else { return $name; } } sub get_member { my $self = shift; my $namespace = shift; return {name => $self->{name}, value => $self->{value} ? $self->{value}->get_expr : undef}; } 1; icheck-0.9.7/CParse/String.pm0000644000175000017500000000513210273204214016420 0ustar asuffieldasuffieldpackage CParse::String; use 5.6.0; use strict; use warnings; use Exporter; our @ISA = qw/Exporter/; our @EXPORT_OK = qw/escape unescape/; sub escape { my $str = shift; $str =~ s/\\/\\\\/g; $str =~ s/\'/\\'/g; $str =~ s/\"/\\"/g; $str =~ s/\?/\\?/g; $str =~ s/\a/\\a/g; $str =~ s/\0x08/\\b/g; $str =~ s/\f/\\f/g; $str =~ s/\n/\\n/g; $str =~ s/\r/\\r/g; $str =~ s/\t/\\t/g; $str =~ s/\0x0b/\\v/g; $str =~ s/([^[:print]])/sprintf "\\x%x", ord($1)/ge; return $str; } sub unescape { my $str = shift; my $out = ""; while (length $str) { my $c = substr($str, 0, 1, ''); if ($c eq '\\') { $c = substr($str, 0, 1, ''); unless (defined $c) { die "Bad escape sequence\n"; } if ($c eq '\\') { $out .= '\\'; } elsif ($c eq '\'') { $out .= '\''; } elsif ($c eq '"') { $out .= '"'; } elsif ($c eq '?') { $out .= '?'; } elsif ($c eq 'a') { $out .= "\a"; } elsif ($c eq 'b') { $out .= "\0x08"; } elsif ($c eq 'f') { $out .= "\f"; } elsif ($c eq 'n') { $out .= "\n"; } elsif ($c eq 'r') { $out .= "\r"; } elsif ($c eq 't') { $out .= "\t"; } elsif ($c eq 'v') { $out .= "\0x0b"; } elsif ($c eq 'x') { $str =~ s/^([[:xdigit:]]+)//; $out .= chr(hex($1)); } elsif ($c =~ /^[0-7]$/) { $str =~ s/^([0-7]{0,2})//; $out .= chr(oct($c . $1)); } } else { $out .= $c; } } return $out; } sub new { my $this = shift; my $class = ref($this) || $this; my $str = shift; my $wide = shift; my $self = {value => $str, wide => $wide, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $value = escape($self->{value}); return $self->{wide} ? "L\"$value\"" : "\"$value\""; } 1; icheck-0.9.7/CParse/StructDeclaration.pm0000644000175000017500000000246110273204214020606 0ustar asuffieldasuffieldpackage CParse::StructDeclaration; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $class = ref($this) || $this; my $specifiers = shift; my $declarators = shift; my $self = {specifiers => $specifiers, declarators => $declarators, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $specifiers = join(' ', grep {$_} map {$_->dump_c} @{$self->{specifiers}}); my $declarators = join(', ', map {$_->dump_c} @{$self->{declarators}}); return "$specifiers $declarators;\n"; } sub get_members { my $self = shift; my $namespace = shift; my @attributes; my @specifiers; foreach my $specifier (@{$self->{specifiers}}) { if ($specifier->isa('CParse::AttributeList')) { push @attributes, $specifier->attributes; } elsif ($specifier->isa('CParse::Struct') or $specifier->isa('CParse::Union') or $specifier->isa('CParse::Enum')) { $specifier->process($namespace); push @specifiers, $specifier; } else { push @specifiers, $specifier; } } return map {$_->get_member($namespace, \@specifiers, \@attributes)} @{$self->{declarators}}; } 1; icheck-0.9.7/CParse/Function.pm0000644000175000017500000000623110273204213016737 0ustar asuffieldasuffieldpackage CParse::Function; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $class = ref($this) || $this; my $specifiers = shift; my $declarator = shift; my $declarations = shift; my $self = {specifiers => $specifiers, declarator => $declarator, declarations => $declarations, }; bless $self, $class; if (scalar @$declarations) { print STDERR $self->dump_c; die "K&R function definition, go away"; } return $self; } sub dump_c { my $self = shift; my $specifiers = join(' ', grep {$_} map {$_->dump_c} @{$self->{specifiers}}); my $declarator = $self->{declarator}->dump_c; my $declarations = join('', map {' ' . $_->dump_c . "\n"} @{$self->{declarations}}); return "$specifiers\n$declarator\n$declarations\{\n /* ... */\n}\n"; } sub set_location { my $self = shift; $self->{file} = shift; $self->{line} = shift; $self->{pos} = shift; } sub process { my $self = shift; my $namespace = shift; my $storage_class; my $inline; my @attributes; my @specifiers; my @process_specifiers; $CParse::current_location = $self; foreach my $specifier (@{$self->{specifiers}}) { if ($specifier->isa('CParse::StorageClass')) { if ($storage_class) { print STDERR "$self->{file}:$self->{line}:$self->{pos}: multiple storage class specifiers\n"; print STDERR "$self->{file}:$self->{line}:$self->{pos}: in " . $self->dump_c; exit 1; } $storage_class = $specifier; } elsif ($specifier->isa('CParse::FunctionSpecifier')) { if ($specifier->name ne 'inline') { die "Internal error: unrecognised storage class specifier " . $specifier->name; } $inline = 1; } elsif ($specifier->isa('CParse::AttributeList')) { push @attributes, $specifier->attributes; } elsif ($specifier->isa('CParse::Struct') or $specifier->isa('CParse::Union')) { push @specifiers, $specifier; push @process_specifiers, $specifier; } else { push @specifiers, $specifier; } } eval { $_->process($namespace) foreach @process_specifiers; $self->{declarator}->process_decl($namespace, $storage_class, \@specifiers, $inline, \@attributes); }; if ($@) { my $err = $@; $err =~ s/\n*$//; my @err = split /\n/, $err; print STDERR "$self->{file}:$self->{line}:$self->{pos}: $_\n" foreach @err; my $dump = eval {$self->dump_c}; if ($dump) { my @dump = split /\n/, $dump; my $first = 1; foreach (@dump) { print STDERR "$self->{file}:$self->{line}:$self->{pos}: " . ($first ? "in" : " ") . " $_\n"; $first = 0; } } exit 1; } $CParse::current_location = undef; } 1; icheck-0.9.7/CParse/UnionRef.pm0000644000175000017500000000075410273204214016704 0ustar asuffieldasuffieldpackage CParse::UnionRef; use 5.6.0; use strict; use warnings; use CType::Ref; sub new { my $this = shift; my $class = ref($this) || $this; my $tag = shift; my $self = {tag => $tag, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $tag = $self->{tag}; return "union $tag"; } sub get_type { my $self = shift; my $namespace = shift; return new CType::Ref 'union', $self->{tag}; } 1; icheck-0.9.7/CParse/Float.pm0000644000175000017500000000053710273204213016222 0ustar asuffieldasuffieldpackage CParse::Float; use 5.6.0; use strict; use warnings; use Math::BigFloat; sub new { my $this = shift; my $class = ref($this) || $this; my $value = shift; my $self = {value => $value, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; return $self->{value}; } 1; icheck-0.9.7/CParse/Enum.pm0000644000175000017500000000615610273206717016077 0ustar asuffieldasuffieldpackage CParse::Enum; use 5.6.0; use strict; use warnings; use File::Spec; use CType::Enum; use CType::Ref; sub new { my $this = shift; my $class = ref($this) || $this; my $tag = shift; my $enumerators = shift; my $attributes1 = shift; my $attributes2 = shift; my $self = {tag => $tag, enumerators => $enumerators, attributes1 => $attributes1, attributes2 => $attributes2, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $str = "enum"; if ($self->{attributes1}) { $str .= " " . $self->{attributes1}->dump_c; } if ($self->{tag}) { $str .= " $self->{tag}"; } $str .= "\n{\n"; foreach my $enumerator (@{$self->{enumerators}}) { $str .= " " . $enumerator->dump_c . ",\n"; } $str .= "}"; if ($self->{attributes2}) { $str .= " " . $self->{attributes2}->dump_c; } return $str; } sub construct_type { my $self = shift; my $namespace = shift; my @attributes; push @attributes, $self->{attributes1}->attributes if $self->{attributes1}; push @attributes, $self->{attributes2}->attributes if $self->{attributes2}; my @members = map {$_->get_member($namespace)} @{$self->{enumerators}}; my $type = new CType::Enum \@members, \@attributes, $CParse::current_location; # An enum defines every enumerator as an ordinary identifier in # the containing scope foreach my $member (@members) { my $old = $namespace->get('ordinary', $member->{name}); if ($old and (File::Spec->canonpath($old->{file}) ne File::Spec->canonpath($CParse::current_location->{file}) or $old->{line} ne $CParse::current_location->{line})) { die "Redefinition of identifier $member->{name}\n (old definition at $old->{file}:$old->{line})\n"; } # We aren't constructing values just yet, so what we do is # store a reference to the enum itself in the namespace. This # can be dereferenced later. $namespace->set('ordinary', $member->{name}, $type); } return $type; } sub process { my $self = shift; my $namespace = shift; if ($self->{tag}) { # Heuristic: we'll ignore redefinitions that occur at the same file:line my $old = $namespace->get('enum', $self->{tag}); if ($old and (File::Spec->canonpath($old->{file}) ne File::Spec->canonpath($CParse::current_location->{file}) or $old->{line} ne $CParse::current_location->{line})) { die "Redefinition of enum $self->{tag}\n (old definition at $old->{file}:$old->{line})\n"; } my $type = $self->construct_type($namespace); $namespace->set('enum', $self->{tag}, $type); } } sub get_type { my $self = shift; my $namespace = shift; if ($self->{tag}) { return new CType::Ref 'enum', $self->{tag}, $namespace; } else { return $self->construct_type($namespace); } } 1; icheck-0.9.7/CParse/ParameterDeclaration.pm0000644000175000017500000000331310273204214021237 0ustar asuffieldasuffieldpackage CParse::ParameterDeclaration; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $class = ref($this) || $this; my $specifiers = shift; my $declarator = shift; my $self = {specifiers => $specifiers, declarator => $declarator, }; bless $self, $class; return $self; } sub specifiers { my $self = shift; return $self->{specifiers}; } sub dump_c { my $self = shift; my $str = join(' ', map {$_->dump_c} @{$self->{specifiers}}); if (defined $self->{declarator}) { $str .= " " if length $str; $str .= $self->{declarator}->dump_c; } return $str; } sub get_type { my $self = shift; my $namespace = shift; my $storage_class; my @attributes; my @specifiers; foreach my $specifier (@{$self->{specifiers}}) { if ($specifier->isa('CParse::StorageClass')) { if ($storage_class) { die "multiple storage class specifiers\n"; } $storage_class = $specifier; } elsif ($specifier->isa('CParse::AttributeList')) { push @attributes, $specifier->attributes; } else { push @specifiers, $specifier; } } if ($storage_class and $storage_class->class ne 'register') { die "parameter declarations cannot have a storage class other than 'register'\n"; } my $type = $self->{declarator}->get_decl_type($namespace, \@specifiers, \@attributes, 1); return $type; } sub get_identifier { my $self = shift; return $self->{declarator}->get_identifier; } 1; icheck-0.9.7/CParse/Declarator/0000755000175000017500000000000010273204213016672 5ustar asuffieldasuffieldicheck-0.9.7/CParse/Declarator/Array.pm0000644000175000017500000000253310273204213020311 0ustar asuffieldasuffieldpackage CParse::Declarator::Array; use 5.6.0; use strict; use warnings; use CType::Array; sub new { my $this = shift; my $class = ref($this) || $this; my $size = shift; my $restrict = shift; my $self = {declarator => undef, size => $size, restrict => $restrict, }; bless $self, $class; return $self; } sub set_declarator { my $self = shift; $self->{declarator} = shift; } sub dump_c { my $self = shift; my $str = ''; if ($self->{declarator}) { $str .= $self->{declarator}->dump_c; } if (defined $self->{size}) { my $size = $self->{size}->dump_c; $str .= "[$size]"; return $str; } else { $str .= "[]"; return $str; } } sub get_identifier { my $self = shift; return undef unless $self->{declarator}; return $self->{declarator}->get_identifier; } sub get_type { my $self = shift; my $namespace = shift; my $base_type = shift; my $attributes = shift; my $size = $self->{size} ? $self->{size}->get_expr($namespace) : undef; my $type = new CType::Array $base_type, $size, $attributes; if ($self->{declarator}) { $type = $self->{declarator}->get_type($namespace, $type, []); } return $type; } 1; icheck-0.9.7/CParse/Declarator/.arch-ids/0000755000175000017500000000000010273204213020442 5ustar asuffieldasuffieldicheck-0.9.7/CParse/Declarator/.arch-ids/Direct.pm.id0000644000175000017500000000011010273204213022575 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.1 icheck-0.9.7/CParse/Declarator/.arch-ids/=id0000644000175000017500000000011110273204213021047 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.11 icheck-0.9.7/CParse/Declarator/.arch-ids/Array.pm.id0000644000175000017500000000011010273204213022441 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.0 icheck-0.9.7/CParse/Declarator/.arch-ids/Function.pm.id0000644000175000017500000000011010273204213023150 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.2 icheck-0.9.7/CParse/Declarator/Direct.pm0000644000175000017500000000055410273204213020446 0ustar asuffieldasuffieldpackage CParse::Declarator::Direct; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $class = ref($this) || $this; my $declarator = shift; my $suffixes = shift; foreach my $suffix (@$suffixes) { $suffix->set_declarator($declarator); $declarator = $suffix; } return $declarator; } 1; icheck-0.9.7/CParse/Declarator/Function.pm0000644000175000017500000000421210273204213021014 0ustar asuffieldasuffieldpackage CParse::Declarator::Function; use 5.6.0; use strict; use warnings; use CDecl; use CType::Function; sub new { my $this = shift; my $class = ref($this) || $this; my $params = shift; my $variadic = shift; my $self = {declarator => undef, params => $params, variadic => $variadic, }; if (scalar @{$self->{params}} == 1 and scalar @{$self->{params}[0]->specifiers} == 1 and $self->{params}[0]->specifiers->[0]->isa('CParse::TypeSpecifier') and $self->{params}[0]->specifiers->[0]->name eq 'void') { # We have precisely one argument, which is just a single # 'void'. That's really 'no arguments'. $self->{params} = []; } bless $self, $class; return $self; } sub set_declarator { my $self = shift; $self->{declarator} = shift; } sub dump_c { my $self = shift; my $declarator = $self->{declarator} ? $self->{declarator}->dump_c : ''; my $params = join(', ', map {$_->dump_c} @{$self->{params}}); if ($self->{variadic}) { if (length $params) { $params .= ", ..."; } else { $params = "..."; } } unless (length $params) { $params = 'void'; } if ($self->{declarator} and $self->{declarator}->isa('CParse::Declarator') and $self->{declarator}->pointer) { return "($declarator)($params)" } else { return "$declarator($params)" } } sub get_identifier { my $self = shift; return undef unless $self->{declarator}; return $self->{declarator}->get_identifier; } sub get_type { my $self = shift; my $namespace = shift; my $base_type = shift; my $attributes = shift; my @arg_types = map {new CDecl 'param', $_->get_identifier, $_->get_type($namespace)} @{$self->{params}}; my $type = new CType::Function $base_type, \@arg_types, $attributes, $self->{variadic}; if ($self->{declarator}) { $type = $self->{declarator}->get_type($namespace, $type, []); } return $type; } 1; icheck-0.9.7/CParse/Parser/0000755000175000017500000000000010273204251016050 5ustar asuffieldasuffieldicheck-0.9.7/CParse/Parser/.arch-ids/0000755000175000017500000000000010273204214017617 5ustar asuffieldasuffieldicheck-0.9.7/CParse/Parser/.arch-ids/=id0000644000175000017500000000011110273204214020224 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.26 icheck-0.9.7/CParse/Parser/.arch-ids/Perl.pm.id0000644000175000017500000000011110273204214021443 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:24 2005 28706.37 icheck-0.9.7/CParse/Parser/Token/0000755000175000017500000000000010273204214017127 5ustar asuffieldasuffieldicheck-0.9.7/CParse/Parser/Token/Integer.pm0000644000175000017500000000226610273204214021070 0ustar asuffieldasuffieldpackage CParse::Parser::Token::Integer; use 5.6.0; use strict; use warnings; use Math::BigInt; use CParse::Integer; sub new { my $this = shift; my $class = ref($this) || $this; my $str = shift; my $line = shift; my $pos = shift; my $number; if ($str =~ /^0[0-7]/) { # Math::BigInt unhelpfully does not support octal $number = Math::BigInt->bzero(); # Kill the leading zero substr($str, 0, 1, ''); # Put the pesky thing together by hand while (length $str) { my $digit = substr($str, 0, 1, ''); $number *= 8; $number += $digit; } } else { $number = Math::BigInt->new($str); } my $self = {value => $number, line => $line, pos => $pos, }; bless $self, $class; return $self; } sub line { my $self = shift; return $self->{line}; } sub pos { my $self = shift; return $self->{pos}; } sub dump_c { my $self = shift; return $self->{value}; } sub process { my $self = shift; return new CParse::Integer $self->{value}; } 1; icheck-0.9.7/CParse/Parser/Token/.arch-ids/0000755000175000017500000000000010273204214020677 5ustar asuffieldasuffieldicheck-0.9.7/CParse/Parser/Token/.arch-ids/Character.pm.id0000644000175000017500000000011110273204214023515 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.22 icheck-0.9.7/CParse/Parser/Token/.arch-ids/Integer.pm.id0000644000175000017500000000011110273204214023216 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.25 icheck-0.9.7/CParse/Parser/Token/.arch-ids/Identifier.pm.id0000644000175000017500000000011110273204214023703 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.24 icheck-0.9.7/CParse/Parser/Token/.arch-ids/Float.pm.id0000644000175000017500000000011110273204214022666 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.23 icheck-0.9.7/CParse/Parser/Token/.arch-ids/Keyword.pm.id0000644000175000017500000000011110273204214023245 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:26 2005 28710.26 icheck-0.9.7/CParse/Parser/Token/.arch-ids/=id0000644000175000017500000000011110273204214021304 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:24 2005 28706.38 icheck-0.9.7/CParse/Parser/Token/.arch-ids/String.pm.id0000644000175000017500000000011110273204214023067 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:26 2005 28710.28 icheck-0.9.7/CParse/Parser/Token/.arch-ids/Punctuator.pm.id0000644000175000017500000000011110273204214023765 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:26 2005 28710.27 icheck-0.9.7/CParse/Parser/Token/Identifier.pm0000644000175000017500000000141110273204214021544 0ustar asuffieldasuffieldpackage CParse::Parser::Token::Identifier; use 5.6.0; use strict; use warnings; use CParse::Identifier; sub new { my $this = shift; my $class = ref($this) || $this; my $string = shift; my $line = shift; my $pos = shift; my $self = {string => $string, line => $line, pos => $pos, }; bless $self, $class; return $self; } sub line { my $self = shift; return $self->{line}; } sub pos { my $self = shift; return $self->{pos}; } sub string { my $self = shift; return $self->{string}; } sub dump_c { my $self = shift; return $self->{string}; } sub process { my $self = shift; return new CParse::Identifier $self->{string}; } 1; icheck-0.9.7/CParse/Parser/Token/Keyword.pm0000644000175000017500000000234510273204214021115 0ustar asuffieldasuffieldpackage CParse::Parser::Token::Keyword; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $class = ref($this) || $this; my $string = shift; my $line = shift; my $pos = shift; if ($string eq '__const' or $string eq '__restrict' or $string eq '__volatile') { $string =~ s/^__//; } if ($string eq '__const__' or $string eq '__restrict__' or $string eq '__volatile__') { $string =~ s/^__//; $string =~ s/__$//; } if ($string eq '__inline') { $string = 'inline'; } if ($string eq '__inline__') { $string = 'inline'; } if ($string eq '__attribute') { $string = '__attribute__'; } if ($string eq 'asm') { $string = '__asm__'; } my $self = {string => $string, line => $line, pos => $pos, }; bless $self, $class; return $self; } sub line { my $self = shift; return $self->{line}; } sub pos { my $self = shift; return $self->{pos}; } sub string { my $self = shift; return $self->{string}; } sub dump_c { my $self = shift; return $self->{string}; } 1; icheck-0.9.7/CParse/Parser/Token/String.pm0000644000175000017500000000220410273204214020731 0ustar asuffieldasuffieldpackage CParse::Parser::Token::String; use 5.6.0; use strict; use warnings; use CParse::String qw/escape unescape/; sub new { my $this = shift; my $class = ref($this) || $this; my $str = shift; my $line = shift; my $pos = shift; my $wide; if ($str =~ s/^L//) { $wide = 1; } else { $wide = 0; } $str =~ /^L?"(.*)"$/ or die; my $value = unescape($1); my $self = {value => $value, wide => $wide, line => $line, pos => $pos, }; bless $self, $class; return $self; } sub line { my $self = shift; return $self->{line}; } sub pos { my $self = shift; return $self->{pos}; } sub dump_c { my $self = shift; my $value = escape($self->{value}); return $self->{wide} ? "L\"$value\"" : "\"$value\""; } sub concatenate { my $self = shift; my $other = shift; $self->{wide} ||= $other->{wide}; $self->{value} .= $other->{value}; } sub process { my $self = shift; return new CParse::String $self->{value}, $self->{wide}; } 1; icheck-0.9.7/CParse/Parser/Token/Character.pm0000644000175000017500000000210010273204214021352 0ustar asuffieldasuffieldpackage CParse::Parser::Token::Character; use 5.6.0; use strict; use warnings; use CParse::Char; use CParse::String qw/escape unescape/; sub new { my $this = shift; my $class = ref($this) || $this; my $str = shift; my $line = shift; my $pos = shift; my $wide; if ($str =~ s/^L//) { $wide = 1; } else { $wide = 0; } $str =~ /^L?'(.*)'$/ or die; my $char = unescape($1); if (length $char == 0) { die "Empty character constants not supported"; } if (length $char > 1) { die "Multi-character constants not supported"; } my $self = {value => $char, wide => $wide, line => $line, pos => $pos, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $value = escape($self->{value}); return $self->{wide} ? "L'$value'" : "'$value'"; } sub process { my $self = shift; return new CParse::Char $self->{value}, $self->{wide}; } 1; icheck-0.9.7/CParse/Parser/Token/Float.pm0000644000175000017500000000156510273204214020541 0ustar asuffieldasuffieldpackage CParse::Parser::Token::Float; use 5.6.0; use strict; use warnings; use Math::BigFloat; use CParse::Float; sub new { my $this = shift; my $class = ref($this) || $this; my $str = shift; my $line = shift; my $pos = shift; my $number; if ($str =~ /^0x/) { die "Hexadeximal floats are not supported"; } else { $number = Math::BigFloat->new($str); } my $self = {value => $number, line => $line, pos => $pos, }; bless $self, $class; return $self; } sub line { my $self = shift; return $self->{line}; } sub pos { my $self = shift; return $self->{pos}; } sub dump_c { my $self = shift; return $self->{value}; } sub process { my $self = shift; return new CParse::Float $self->{value}; } 1; icheck-0.9.7/CParse/Parser/Token/Punctuator.pm0000644000175000017500000000122110273204214021625 0ustar asuffieldasuffieldpackage CParse::Parser::Token::Punctuator; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $class = ref($this) || $this; my $string = shift; my $line = shift; my $pos = shift; my $self = {string => $string, line => $line, pos => $pos, }; bless $self, $class; return $self; } sub line { my $self = shift; return $self->{line}; } sub pos { my $self = shift; return $self->{pos}; } sub string { my $self = shift; return $self->{string}; } sub dump_c { my $self = shift; return $self->{string}; } 1; icheck-0.9.7/CParse/Parser/Perl.pm0000644000175000017500000015402210273204251017314 0ustar asuffieldasuffieldpackage CParse::Parser::Perl; use 5.6.0; use strict; use warnings; no warnings "recursion"; use Carp; use CParse::Attribute; use CParse::AttributeList; use CParse::Declaration; use CParse::Declarator; use CParse::Declarator::Array; use CParse::Declarator::Direct; use CParse::Declarator::Function; use CParse::Enum; use CParse::EnumRef; use CParse::Enumerator; use CParse::Extension; use CParse::Function; use CParse::FunctionSpecifier; use CParse::Op; use CParse::Op::Add; use CParse::Op::ArraySubscript; use CParse::Op::Assign; use CParse::Op::BitAnd; use CParse::Op::BitOr; use CParse::Op::BitXor; use CParse::Op::BoolAnd; use CParse::Op::BoolOr; use CParse::Op::Cast; use CParse::Op::Call; use CParse::Op::Conditional; use CParse::Op::Equal; use CParse::Op::Expression; use CParse::Op::Member; use CParse::Op::MemberIndirect; use CParse::Op::Multiply; use CParse::Op::Preinc; use CParse::Op::Predec; use CParse::Op::Postinc; use CParse::Op::Postdec; use CParse::Op::Postfix; use CParse::Op::Relation; use CParse::Op::Shift; use CParse::Op::Alignof; use CParse::Op::Sizeof; use CParse::Op::SizeofExpr; use CParse::Op::Unary; use CParse::ParameterDeclaration; use CParse::Pointer; use CParse::StorageClass; use CParse::Struct; use CParse::StructDeclaration; use CParse::StructDeclarator; use CParse::StructRef; use CParse::TypeName; use CParse::TypeQualifier; use CParse::TypeSpecifier; use CParse::Union; use CParse::UnionRef; use CParse::Parser::Token::Keyword; use CParse::Parser::Token::Identifier; use CParse::Parser::Token::Integer; use CParse::Parser::Token::Float; use CParse::Parser::Token::Character; use CParse::Parser::Token::String; use CParse::Parser::Token::Punctuator; sub new { my $this = shift; my $class = ref($this) || $this; my $self = { }; bless $self, $class; return $self; } sub unit { my $self = shift; my $data = shift; my $linemap = shift; $self->{data} = $data; $self->{linemap} = $linemap; $self->{line} = 0; $self->{pos} = 0; $self->{errors} = 0; $self->{commit} = 0; $self->{skip_errors} = 0; $self->{token_queue} = []; $self->{trying_tokens} = []; my @external_decls; DECL: while (1) { if ($self->no_data_left) { last; } my $decl; foreach my $thing (qw/declaration function/) { $self->{skip_errors} = 0; $decl = $self->try_parse($thing); if ($decl) { my $data_line = $self->{trying_tokens}[0]->line; my $data_pos = $self->{trying_tokens}[0]->pos; my $file = $self->{linemap}{$data_line}{file} || ""; my $line = $self->{linemap}{$data_line}{line} || ""; $decl->set_location($file, $line, $data_pos); $self->{trying_tokens} = []; push @external_decls, $decl; next DECL; } last if $self->{errors}; } die if scalar @{$self->{trying_tokens}}; $self->syntax_error; last; } return undef if $self->{errors}; return \@external_decls; } sub error { my $self = shift; my $msg = shift; return if $self->{skip_errors}; my $data_line = scalar @{$self->{token_queue}} ? $self->{token_queue}[0]->line : $self->{line}; my $data_pos = scalar @{$self->{token_queue}} ? $self->{token_queue}[0]->pos : $self->{pos}; my $file = $self->{linemap}{$data_line}{file} || ""; my $line = $self->{linemap}{$data_line}{line} || ""; print STDERR "$file:$line:$data_pos: $msg\n"; foreach my $l ($data_line - 2 .. $data_line + 2) { next if $l < 0; last if $l >= scalar @{$self->{data}}; print STDERR $self->{data}[$l] . "\n"; print STDERR ' ' x $data_pos . "^-- Here\n" if $l == $data_line; } $self->{errors}++; } sub syntax_error { my $self = shift; my $thing = shift; if (defined $thing) { $self->error("syntax error while trying to parse $thing"); } else { $self->error("syntax error"); } } sub no_data_left { my $self = shift; return 0 if scalar @{$self->{token_queue}}; my $token = $self->next_token; if ($token) { $self->retry_tokens($token); return 0; } else { return 1; } } sub next_token { my $self = shift; if (scalar @{$self->{token_queue}}) { return shift @{$self->{token_queue}}; } while (1) { if ($self->{line} >= scalar @{$self->{data}}) { # No lines left, this is EOF return undef; } my $line = substr $self->{data}[$self->{line}], $self->{pos}; # Try to move to the next line if (length $line == 0) { $self->{line}++; $self->{pos} = 0; next; } # Try to consume whitespace if ($line =~ /^(\s+)/) { $self->{pos} += length $1; next; } # Try for a keyword if ($line =~ /^(auto|break|case|char|const|continue|default|do|double| else|enum|extern|float|for|goto|if|inline|int|long| register|restrict|return|short|signed|sizeof|static| struct|switch|typedef|union|unsigned|void|volatile| while|_Bool|_Complex|_Imaginary| __const|__restrict|__volatile|__const__|__restrict__| __volatile__|__attribute__|__attribute|__inline| __inline__|__extension__|__alignof__|asm|__asm__)\b/x) { my $len = length $1; my $token = new CParse::Parser::Token::Keyword $1, $self->{line}, $self->{pos}; $self->{pos} += $len; return $token; } # Try for an identifier if ($line =~ /^((?:[A-Za-z_]|\\u[[:xdigit:]]{4}|\\U[[:xdigit:]]{8})(?:\w|\\u[[:xdigit:]]{4}|\\U[[:xdigit:]]{8})*)/) { my $len = length $1; my $token = new CParse::Parser::Token::Identifier $1, $self->{line}, $self->{pos}; $self->{pos} += $len; return $token; } # Try for a constant if ($line =~ /^((0[xX][[:xdigit:]]+|[1-9]\d*|0[0-7]*)([uU](?:l|L|ll|LL)?|[lL][uU]?|ll[uU]?|LL[uU]?)?)/) { my $len = length $1; my $token = new CParse::Parser::Token::Integer $2, $3, $self->{line}, $self->{pos}; $self->{pos} += $len; return $token; } if ($line =~ /^(((?:\d+\.\d*|\.\d+|\d+)(?:[eE][+-]?\d+))([flFL])?)/) { my $len = length $1; my $token = new CParse::Parser::Token::Float $2, $3, $self->{line}, $self->{pos}; $self->{pos} += $len; return $token; } if ($line =~ /^((0x(?:[[:xdigit:]]+\.[[:xdigit:]]*|\.[[:xdigit:]]+|[[:xdigit:]]+)[pP][+-]?\d+)([flFL])?)/) { my $len = length $1; my $token = new CParse::Parser::Token::Float $2, $3, $self->{line}, $self->{pos}; $self->{pos} += $len; return $token; } if ($line =~ /^(L?'(?:[^'\\\n]|\\['"?abfnrtv\\]|\\[0-7]{1,3}|\\x[[:xdigit:]]+)*')/) { my $len = length $1; my $token = new CParse::Parser::Token::Character $1, $self->{line}, $self->{pos}; $self->{pos} += $len; return $token; } # Try for a string literal if ($line =~ /^(L?"(?:[^"\\\n]|\\['"?abfnrtv\\]|\\[0-7]{1,3}|\\x[[:xdigit:]]+)*")/) { my $len = length $1; my $token = new CParse::Parser::Token::String $1, $self->{line}, $self->{pos}; $self->{pos} += $len; return $token; } # Try for a punctuator if ($line =~ /^(==|!=|=|\*=|\/=|\%=|\+=|-=|>>=|<<=|&=|\^=|!=|\[|\]| \(|\)|{|}|\.\.\.|\.|->|\+\+|--|&|\*|\+|-|~|\/| \%|<<|>>|<=|>=|<|>|\^|&&|\|\||\||\?|:|;| ,|\#|\#\#|!|<:|:>|<\%|\%>|\%:|\%\%:)/x) { my $len = length $1; my $token = new CParse::Parser::Token::Punctuator $1, $self->{line}, $self->{pos}; $self->{pos} += $len; return $token; } $self->syntax_error; return undef; } } sub retry_tokens { my $self = shift; unshift @{$self->{token_queue}}, @_; } # Everything calls either try_token, or try_parse; all other try_ # calls get indirected through try_parse. These between them implement # backtracking. sub try_token { my $self = shift; my $token = $self->next_token; return undef unless $token; push @{$self->{trying_tokens}}, $token; return $token; } my %parse_funcs; sub try_parse { my $self = shift; my $thing = shift; local $self->{commit} = 0; # On leaving this function, either the tokens have been consumed # by us, and are therefore being tried by our parent, or pushed # back into the token stream. We start a fresh list of tokens to # be tried at this context, and reconstruct our parent's list # later. my $old_trying_tokens = $self->{trying_tokens}; $self->{trying_tokens} = []; my $description = join(' ', $thing, grep {defined $_} @_); unless ($self->can('try_' . $thing)) { confess "No such function try_$thing"; } print STDERR "CParse::Parser::Perl::try_parse: trying $description\n" if $ENV{ICHECK_DEBUG} > 0; $parse_funcs{$thing} = eval "\\\&try_${thing}" unless defined $parse_funcs{$thing}; die "No function for $thing found" unless $parse_funcs{$thing}; my $parsed = $parse_funcs{$thing}->($self, @_); die if $@; print STDERR "CParse::Parser::Perl::try_parse: " . ($parsed ? "found" : "failed") . " $description\n" if $ENV{ICHECK_DEBUG} > 0; print STDERR "CParse::Parser::Perl::try_parse: tokens: " . join(' ', map {$_->dump_c} @{$self->{trying_tokens}}) . "\n" if $ENV{ICHECK_DEBUG} > 1; if ($parsed) { # If we succeed, then push the tokens we consumed onto the try stack of our parent push @$old_trying_tokens, @{$self->{trying_tokens}}; $self->{trying_tokens} = $old_trying_tokens; } else { if ($self->committed) { $self->syntax_error($thing); $self->{skip_errors} = 1; } # If we failed, then push back all the tokens we tried into the token stream $self->retry_tokens(@{$self->{trying_tokens}}); $self->{trying_tokens} = $old_trying_tokens; } return $parsed; } sub commit { my $self = shift; $self->{commit} = 1; } sub uncommit { my $self = shift; $self->{commit} = 0; } sub committed { my $self = shift; return $self->{commit}; } sub try_op_list { my $self = shift; my $thing = shift; my $op = shift; my $op_arg = shift; my $end = shift; my $arg1 = $self->try_parse($thing); return undef unless $arg1; my @args = ($arg1); while (1) { if ($end) { last if $self->try_parse('punctuator', $end); my $op = $self->try_parse($op, $op_arg); return undef unless $op; push @args, $op; } else { my $op = $self->try_parse($op, $op_arg); last unless $op; push @args, $op; } my $arg = $self->try_parse($thing); return undef unless $arg; push @args, $arg; } return \@args; } sub try_identifier { my $self = shift; my $name = shift; my $token = $self->try_token; return undef unless $token; return undef unless $token->isa('CParse::Parser::Token::Identifier'); return $token unless $name; return undef unless $token->string eq $name; return $token; } sub try_keyword { my $self = shift; my $name = shift; my $token = $self->try_token; return undef unless $token; return undef unless $token->isa('CParse::Parser::Token::Keyword'); return $token unless $name; return undef unless $token->string eq $name; return $token; } sub try_punctuator { my $self = shift; my $name = shift; my $token = $self->try_token; return undef unless $token; return undef unless $token->isa('CParse::Parser::Token::Punctuator'); return $token unless $name; return undef unless $token->string eq $name; return $token; } sub try_integer_constant { my $self = shift; my $token = $self->try_token; return undef unless $token->isa('CParse::Parser::Token::Integer'); return $token; } sub try_floating_constant { my $self = shift; my $token = $self->try_token; return undef unless $token; return undef unless $token->isa('CParse::Parser::Token::Float'); return $token; } sub try_character_constant { my $self = shift; my $token = $self->try_token; return undef unless $token; return undef unless $token->isa('CParse::Parser::Token::Character'); return $token; } sub try_one_string_literal { my $self = shift; my $token = $self->try_token; return undef unless $token; return undef unless $token->isa('CParse::Parser::Token::String'); return $token; } sub try_string_literal { my $self = shift; my $string = $self->try_parse('one_string_literal'); return undef unless $string; my $next; while ($next = $self->try_parse('one_string_literal')) { $string->concatenate($next); } return $string; } my %storage_classes = map {$_=>1} qw/typedef extern static auto register/; sub try_storage_class_specifier { my $self = shift; my $name = shift; my $keyword = $self->try_parse('keyword', $name); return undef unless $keyword; return undef unless $storage_classes{$keyword->string}; return new CParse::StorageClass $keyword->string; } my %basic_types = map {$_=>1} qw/void char short int long float double signed unsigned _Bool _Complex _Imaginary/; sub try_type_specifier { my $self = shift; my $name = shift; my $identifier = $self->try_parse('identifier', $name); return $identifier->process if $identifier; my $keyword = $self->try_parse('keyword', $name); return undef unless $keyword; if ($basic_types{$keyword->string}) { return new CParse::TypeSpecifier $keyword->string; } if ($keyword->string eq '__extension__') { return new CParse::Extension; } if ($keyword->string eq 'struct') { return $self->try_parse('struct_specifier', @_); } if ($keyword->string eq 'union') { return $self->try_parse('union_specifier', @_); } if ($keyword->string eq 'enum') { return $self->try_parse('enum_specifier', @_); } return undef; } my %type_qualifiers = map {$_=>1} qw/const restrict volatile/; sub try_type_qualifier { my $self = shift; my $name = shift; my $keyword = $self->try_parse('keyword', $name); return undef unless $keyword; return undef unless $type_qualifiers{$keyword->string}; return new CParse::TypeQualifier $keyword->string; } my %function_specifiers = map {$_=>1} qw/inline/; sub try_function_specifier { my $self = shift; my $name = shift; my $keyword = $self->try_parse('keyword', $name); return undef unless $keyword; return undef unless $function_specifiers{$keyword->string}; return new CParse::FunctionSpecifier $keyword->string; } my %assignment_operators = map {$_=>1} qw/= *= \/= %= += -= <<= >>= &= ^= |=/; sub try_assignment_operator { my $self = shift; my $name = shift; my $punctuator = $self->try_parse('punctuator', $name); return undef unless $punctuator; return undef unless $assignment_operators{$punctuator->string}; return $punctuator->string; } my %unary_operators = map {$_=>1} qw/& * + - ~ !/; sub try_unary_operator { my $self = shift; my $name = shift; my $punctuator = $self->try_parse('punctuator', $name); return undef unless $punctuator; return undef unless $unary_operators{$punctuator->string}; return $punctuator->string; } my %equality_operators = map {$_=>1} qw/== !=/; sub try_equality_operator { my $self = shift; my $name = shift; my $punctuator = $self->try_parse('punctuator', $name); return undef unless $punctuator; return undef unless $equality_operators{$punctuator->string}; return $punctuator->string; } my %relational_operators = map {$_=>1} qw/< > <= >=/; sub try_relational_operator { my $self = shift; my $name = shift; my $punctuator = $self->try_parse('punctuator', $name); return undef unless $punctuator; return undef unless $relational_operators{$punctuator->string}; return $punctuator->string; } my %shift_operators = map {$_=>1} qw/<< >>/; sub try_shift_operator { my $self = shift; my $name = shift; my $punctuator = $self->try_parse('punctuator', $name); return undef unless $punctuator; return undef unless $shift_operators{$punctuator->string}; return $punctuator->string; } my %additive_operators = map {$_=>1} qw/+ -/; sub try_additive_operator { my $self = shift; my $name = shift; my $punctuator = $self->try_parse('punctuator', $name); return undef unless $punctuator; return undef unless $additive_operators{$punctuator->string}; return $punctuator->string; } my %multiplicative_operators = map {$_=>1} qw/* % \//; sub try_multiplicative_operator { my $self = shift; my $name = shift; my $punctuator = $self->try_parse('punctuator', $name); return undef unless $punctuator; return undef unless $multiplicative_operators{$punctuator->string}; return $punctuator->string; } sub try_declaration { my $self = shift; my @declaration_specifiers; my $declarators; while (1) { $declarators = $self->try_parse('declaration_declarator_list'); last if $declarators; my $specifier = $self->try_parse('declaration_specifier'); if ($specifier) { push @declaration_specifiers, $specifier; next; } return undef; } return new CParse::Declaration \@declaration_specifiers, $declarators; } sub try_declaration_declarator_list { my $self = shift; my @declarators; my $first = 1; while (1) { # Stop when we reach a ';' last if $self->try_parse('punctuator', ';'); # If this isn't the first parameter, we need a ',' return undef if not $first and not $self->try_parse('punctuator', ','); $first = 0; my $declarator = $self->try_parse('init_declarator'); return undef unless $declarator; push @declarators, $declarator; } return \@declarators; } sub try_init_declarator { my $self = shift; my $declarator = $self->try_parse('declarator'); return undef unless $declarator; my $initialiser; if ($self->try_parse('punctuator', '=')) { $initialiser = $self->try_parse('initialiser'); return undef unless $initialiser; } return $declarator; } sub try_initialiser { my $self = shift; if ($self->try_parse('punctuator', '{')) { my @initialisers; my $first = 1; while (1) { # Stop when we reach a '}' last if $self->try_parse('punctuator', '}'); # If this isn't the first parameter, we need a ',' return undef if not $first and not $self->try_parse('punctuator', ','); $first = 0; my $initialiser = $self->try_parse('designated_initialiser'); return undef unless $initialiser; push @initialisers, $initialiser; } return \@initialisers; } return $self->try_parse('assignment_expression'); } sub try_designated_initialiser { my $self = shift; if ($self->try_parse('punctuator', '[')) { $self->commit; my $expr = $self->try_parse('constant_expression'); return undef unless $expr; return undef unless $self->try_parse('punctuator', ']'); my $initialiser = $self->try_parse('initialiser'); return $initialiser; } if ($self->try_parse('punctuator', '.')) { $self->commit; my $id = $self->try_parse('identifier'); return undef unless $id; my $initialiser = $self->try_parse('initialiser'); return $initialiser; } my $initialiser = $self->try_parse('initialiser'); return $initialiser; } sub try_function { my $self = shift; my @declaration_specifiers; my $declarator; while (1) { $declarator = $self->try_parse('function_declarator'); last if $declarator; my $specifier = $self->try_parse('declaration_specifier'); if ($specifier) { push @declaration_specifiers, $specifier; next; } return undef; } my @declarations; while (my $declaration = $self->try_parse('declaration')) { push @declarations, $declaration; } my $body = $self->try_parse('compound_statement'); return undef unless $body; return new CParse::Function \@declaration_specifiers, $declarator, \@declarations; } sub try_function_declarator { my $self = shift; my $pointer = $self->try_parse('pointer'); my $prefix = $self->try_parse('direct_declarator_prefix'); return undef unless $prefix; my $suffix = $self->try_parse('direct_declarator_function_suffix'); return undef unless $suffix; return new CParse::Declarator((new CParse::Declarator::Direct $prefix, [$suffix]), $pointer); } sub try_direct_declarator_array_suffix { my $self = shift; my $restrict; my $expr; return undef unless $self->try_parse('punctuator', '['); $self->commit; if ($self->try_parse('punctuator', '*')) { die "Unhandled foo[*] construct"; } elsif ($self->try_parse('type_qualifier', 'restrict')) { # This is an undocumented gcc extension. I'm guessing at the # syntax here. $restrict = 1; } else { $expr = $self->try_parse('assignment_expression'); } return undef unless $self->try_parse('punctuator', ']'); return new CParse::Declarator::Array $expr, $restrict; } sub try_direct_declarator_function_suffix { my $self = shift; return undef unless $self->try_parse('punctuator', '('); if ($self->try_parse('punctuator', ')')) { return new CParse::Declarator::Function [], 1; } my @parameters; my $variadic = 0; my $first = 1; while (1) { # Stop when we reach a ')' last if $self->try_parse('punctuator', ')'); # If this isn't the first parameter, we need a ',' return undef if not $first and not $self->try_parse('punctuator', ','); $first = 0; if ($self->try_parse('punctuator', '...')) { # ... has to be the last parameter return undef unless $self->try_parse('punctuator', ')'); $variadic = 1; last; } my $parameter = $self->try_parse('parameter_declaration'); return undef unless $parameter; push @parameters, $parameter; } return new CParse::Declarator::Function \@parameters, $variadic; } sub try_parameter_declaration { my $self = shift; my @specifiers; while (1) { my $specifier = $self->try_parse('declaration_specifier'); last unless $specifier; push @specifiers, $specifier; } my $declarator = $self->try_parse('declarator'); $declarator = $self->try_parse('abstract_declarator') unless $declarator; # Stick a null declarator in here if necessary $declarator ||= new CParse::Declarator; return new CParse::ParameterDeclaration \@specifiers, $declarator; } sub try_direct_declarator_prefix { my $self = shift; my $prefix; if ($self->try_parse('punctuator', '(')) { $prefix = $self->try_parse('declarator'); return undef unless $self->try_parse('punctuator', ')'); return $prefix; } else { $prefix = $self->try_parse('identifier'); return undef unless $prefix; return $prefix->process; } return undef; } sub try_declarator { my $self = shift; my $attributes1 = $self->try_parse('attribute_specifier_list'); my $pointer = $self->try_parse('pointer'); my $prefix = $self->try_parse('direct_declarator_prefix'); return undef unless $prefix; my $had_function_suffix = 0; my @suffixes; while (1) { my $suffix = $self->try_parse('direct_declarator_array_suffix'); if ($suffix) { push @suffixes, $suffix; next; } unless ($had_function_suffix) { $suffix = $self->try_parse('direct_declarator_function_suffix'); if ($suffix) { $had_function_suffix = 1; push @suffixes, $suffix; next; } } last; } my $attributes2 = $self->try_parse('attribute_specifier_list'); return new CParse::Declarator((new CParse::Declarator::Direct $prefix, \@suffixes), $pointer, $attributes1, $attributes2); } sub try_declaration_specifier { my $self = shift; return $self->try_parse('storage_class_specifier') || $self->try_parse('type_qualifier') || $self->try_parse('function_specifier') || $self->try_parse('attribute_specifier') || $self->try_parse('type_specifier'); } sub try_pointer { my $self = shift; return undef unless $self->try_parse('punctuator', '*'); my @qualifiers; while (1) { my $attribute = $self->try_parse('attribute_specifier'); if ($attribute) { push @qualifiers, $attribute; next; } my $qualifier = $self->try_parse('type_qualifier'); last unless $qualifier; push @qualifiers, $qualifier; } my $pointer = $self->try_parse('pointer'); return new CParse::Pointer \@qualifiers, $pointer; } sub try_abstract_declarator { my $self = shift; my $attributes1 = $self->try_parse('attribute_specifier_list'); my $pointer = $self->try_parse('pointer'); my $direct_declarator = $self->try_parse('direct_abstract_declarator'); my $attributes2 = $self->try_parse('attribute_specifier_list'); return undef unless $pointer or $direct_declarator; return new CParse::Declarator $direct_declarator, $pointer, $attributes1, $attributes2; } sub try_direct_abstract_declarator { my $self = shift; # Note how $prefix can be undef my $prefix = $self->try_parse('abstract_declarator_prefix'); my @suffixes; while (1) { my $suffix = $self->try_parse('direct_declarator_array_suffix'); if ($suffix) { push @suffixes, $suffix; next; } $suffix = $self->try_parse('direct_declarator_function_suffix'); if ($suffix) { push @suffixes, $suffix; next; } last; } return new CParse::Declarator::Direct $prefix, \@suffixes; } sub try_abstract_declarator_prefix { my $self = shift; return undef unless $self->try_parse('punctuator', '('); my $declarator = $self->try_parse('abstract_declarator'); return undef unless $self->try_parse('punctuator', ')'); return $declarator; } sub try_struct_specifier { my $self = shift; my $attributes1 = $self->try_parse('attribute_specifier_list'); my $id = $self->try_parse('identifier'); if ($self->try_parse('punctuator', '{')) { $self->commit; my @declarations; while (1) { last if $self->try_parse('punctuator', '}'); my $declaration = $self->try_parse('struct_declaration'); return undef unless $declaration; push @declarations, $declaration; } my $attributes2 = $self->try_parse('attribute_specifier_list'); return new CParse::Struct $id ? $id->string : undef, \@declarations, $attributes1, $attributes2; } else { return undef unless $id; return new CParse::StructRef $id->string; } } sub try_union_specifier { my $self = shift; my $attributes1 = $self->try_parse('attribute_specifier_list'); my $id = $self->try_parse('identifier'); if ($self->try_parse('punctuator', '{')) { $self->commit; my @declarations; while (1) { last if $self->try_parse('punctuator', '}'); my $declaration = $self->try_parse('struct_declaration'); return undef unless $declaration; push @declarations, $declaration; } my $attributes2 = $self->try_parse('attribute_specifier_list'); return new CParse::Union $id ? $id->string : undef, \@declarations, $attributes1, $attributes2; } else { return undef unless $id; return new CParse::UnionRef $id->string; } } sub try_specifier_qualifier { my $self = shift; return $self->try_parse('attribute_specifier') || $self->try_parse('type_specifier') || $self->try_parse('type_qualifier'); } sub try_struct_declaration { my $self = shift; my @specifiers; my $declarators; while (1) { $declarators = $self->try_parse('struct_declaration_declarator_list'); last if $declarators; my $specifier = $self->try_parse('specifier_qualifier'); if ($specifier) { push @specifiers, $specifier; next; } return undef; } return new CParse::StructDeclaration \@specifiers, $declarators; } sub try_struct_declaration_declarator_list { my $self = shift; my @declarators; my $first = 1; while (1) { # Stop when we reach a ';' last if $self->try_parse('punctuator', ';'); # If this isn't the first parameter, we need a ',' return undef if not $first and not $self->try_parse('punctuator', ','); $first = 0; my $declarator = $self->try_parse('struct_declarator'); return undef unless $declarator; push @declarators, $declarator; } return \@declarators; } sub try_struct_declarator { my $self = shift; my $attributes1 = $self->try_parse('attribute_specifier_list'); my $declarator = $self->try_parse('declarator'); $declarator ||= new CParse::Declarator; if ($self->try_parse('punctuator', ':')) { my $expr = $self->try_parse('constant_expression'); my $attributes2 = $self->try_parse('attribute_specifier_list'); return undef unless $expr; return new CParse::StructDeclarator $declarator, $expr, $attributes1, $attributes2; } else { return undef unless $declarator; my $attributes2 = $self->try_parse('attribute_specifier_list'); return new CParse::StructDeclarator $declarator, undef, $attributes1, $attributes2; } } sub try_enum_specifier { my $self = shift; my $attributes1 = $self->try_parse('attribute_specifier_list'); my $id = $self->try_parse('identifier'); if ($self->try_parse('punctuator', '{')) { $self->commit; my @declarations; my $first = 1; while (1) { last if $self->try_parse('punctuator', '}'); return undef if not $first and not $self->try_parse('punctuator', ','); $first = 0; # enum is odd, it permits a trailing comma - so we could # also finish here last if $self->try_parse('punctuator', '}'); my $declaration = $self->try_parse('enumerator'); return undef unless $declaration; push @declarations, $declaration; } my $attributes2 = $self->try_parse('attribute_specifier_list'); return new CParse::Enum $id ? $id->string : undef, \@declarations, $attributes1, $attributes2; } else { return undef unless $id; return new CParse::EnumRef $id->string; } } sub try_enumerator { my $self = shift; my $identifier = $self->try_parse('identifier'); return undef unless $identifier; my $expr = undef; if ($self->try_parse('punctuator', '=')) { $expr = $self->try_parse('constant_expression'); return undef unless $expr; } return new CParse::Enumerator $identifier->string, $expr; } sub try_constant_expression { my $self = shift; return $self->try_parse('conditional_expression'); } sub try_expression { my $self = shift; my $list = $self->try_parse('op_list', 'assignment_expression', 'punctuator', ','); return undef unless $list; return new CParse::Op $list, 'CParse::Op::Expression'; } sub try_assignment_expression { my $self = shift; return $self->try_parse('assignment') || $self->try_parse('conditional_expression'); } sub try_assignment { my $self = shift; my $left_expr = $self->try_parse('unary_expression'); return undef unless $left_expr; my $op = $self->try_parse('assignment_operator'); return undef unless $op; my $right_expr = $self->try_parse('assignment_expression'); return undef unless $right_expr; return new CParse::Op::Assign $left_expr, $right_expr, $op; } sub try_conditional_expression { my $self = shift; my $cond_expr = $self->try_parse('logical_or_expression'); return undef unless $cond_expr; if ($self->try_parse('punctuator', '?')) { $self->commit; my $true_expr = $self->try_parse('expression'); return undef unless $true_expr; return undef unless $self->try_parse('punctuator', ':'); my $false_expr = $self->try_parse('conditional_expression'); return undef unless $false_expr; return new CParse::Op::Conditional $cond_expr, $true_expr, $false_expr; } else { return $cond_expr; } } sub try_logical_or_expression { my $self = shift; my $list = $self->try_parse('op_list', 'logical_and_expression', 'punctuator', '||'); return undef unless $list; return new CParse::Op $list, 'CParse::Op::BoolOr'; } sub try_logical_and_expression { my $self = shift; my $list = $self->try_parse('op_list', 'inclusive_or_expression', 'punctuator', '&&'); return undef unless $list; return new CParse::Op $list, 'CParse::Op::BoolAnd'; } sub try_inclusive_or_expression { my $self = shift; my $list = $self->try_parse('op_list', 'exclusive_or_expression', 'punctuator', '|'); return undef unless $list; return new CParse::Op $list, 'CParse::Op::BitOr'; } sub try_exclusive_or_expression { my $self = shift; my $list = $self->try_parse('op_list', 'and_expression', 'punctuator', '^'); return undef unless $list; return new CParse::Op $list, 'CParse::Op::BitXor'; } sub try_and_expression { my $self = shift; my $list = $self->try_parse('op_list', 'equality_expression', 'punctuator', '&'); return undef unless $list; return new CParse::Op $list, 'CParse::Op::BitAnd'; } sub try_equality_expression { my $self = shift; my $list = $self->try_parse('op_list', 'relational_expression', 'equality_operator'); return undef unless $list; return new CParse::Op $list, 'CParse::Op::Equal'; } sub try_relational_expression { my $self = shift; my $list = $self->try_parse('op_list', 'shift_expression', 'relational_operator'); return undef unless $list; return new CParse::Op $list, 'CParse::Op::Relation'; } sub try_shift_expression { my $self = shift; my $list = $self->try_parse('op_list', 'additive_expression', 'shift_operator'); return undef unless $list; return new CParse::Op $list, 'CParse::Op::Shift'; } sub try_additive_expression { my $self = shift; my $list = $self->try_parse('op_list', 'multiplicative_expression', 'additive_operator'); return undef unless $list; return new CParse::Op $list, 'CParse::Op::Add'; } sub try_multiplicative_expression { my $self = shift; my $list = $self->try_parse('op_list', 'cast_expression', 'multiplicative_operator'); return undef unless $list; return new CParse::Op $list, 'CParse::Op::Multiply'; } sub try_cast_expression { my $self = shift; return $self->try_parse('explicit_cast') || $self->try_parse('unary_expression'); } sub try_explicit_cast { my $self = shift; return undef unless $self->try_parse('punctuator', '('); my $type = $self->try_parse('type_name'); return undef unless $type; return undef unless $self->try_parse('punctuator', ')'); my $expr = $self->try_parse('cast_expression'); return undef unless $expr; return new CParse::Op::Cast $expr, $type; } sub try_unary_expression { my $self = shift; if ($self->try_parse('keyword', 'sizeof')) { $self->commit; if ($self->try_parse('punctuator', '(')) { my $type = $self->try_parse('type_name'); return undef unless $type; return undef unless $self->try_parse('punctuator', ')'); return new CParse::Op::Sizeof $type; } my $expr = $self->try_parse('unary_expression'); return undef unless $expr; return new CParse::Op::SizeofExpr $expr; } if ($self->try_parse('keyword', '__alignof__')) { $self->commit; return unless $self->try_parse('punctuator', '('); my $arg = $self->try_parse('type_name'); if (not $arg) { $arg = $self->try_parse('unary_expression'); } return undef unless $arg; return undef unless $self->try_parse('punctuator', ')'); return new CParse::Op::Alignof $arg; } if ($self->try_parse('punctuator', '++')) { my $expr = $self->try_parse('unary_expression'); return undef unless $expr; return new CParse::Op::Preinc $expr; } if ($self->try_parse('punctuator', '--')) { my $expr = $self->try_parse('unary_expression'); return undef unless $expr; return new CParse::Op::Predec $expr; } if ($self->try_parse('keyword', '__extension__')) { $self->commit; return $self->try_parse('cast_expression'); } my $op = $self->try_parse('unary_operator'); if ($op) { my $expr = $self->try_parse('cast_expression'); return new CParse::Op::Unary $expr, $op; } return $self->try_parse('postfix_expression'); } sub try_postfix_expression { my $self = shift; my $prefix = $self->try_parse('postfix_expression_prefix'); return undef unless $prefix; my @suffixes; SUFFIX: while (1) { foreach my $thing (qw/array call member member_indirect post_increment post_decrement/) { my $suffix = $self->try_parse('postfix_expression_' . $thing . '_suffix'); if ($suffix) { push @suffixes, $suffix; next SUFFIX; } } last; } return new CParse::Op::Postfix $prefix, \@suffixes; } sub try_postfix_expression_prefix { my $self = shift; my $compound = $self->try_parse('compound_literal'); return $compound if $compound; my $primary = $self->try_parse('primary_expression'); return $primary if $primary; return undef; } sub try_compound_literal { my $self = shift; return undef unless $self->try_parse('punctuator', '('); my $type = $self->try_parse('type_name'); return undef unless $type; return undef unless $self->try_parse('punctuator', ')'); return undef unless $self->try_parse('punctuator', '{'); my @initialisers; my $first = 1; while (1) { last if $self->try_parse('punctuator', '}'); # If this isn't the first parameter, we need a ',' return undef if not $first and not $self->try_parse('punctuator', ','); $first = 0; last if $self->try_parse('punctuator', '}'); my $initialiser = $self->try_parse('designated_initialiser'); return undef unless $initialiser; push @initialisers, $initialiser; } return new CParse::Op::CompoundLiteral $type, \@initialisers; } sub try_type_name { my $self = shift; my @specifiers; my $declarator; while (1) { $declarator = $self->try_parse('abstract_declarator'); last if $declarator; my $specifier = $self->try_parse('specifier_qualifier'); if ($specifier) { push @specifiers, $specifier; next; } last; } return undef unless scalar @specifiers; $declarator ||= new CParse::Declarator; return new CParse::TypeName \@specifiers, $declarator; } sub try_primary_expression { my $self = shift; if ($self->try_parse('punctuator', '(')) { my $expression = $self->try_parse('expression'); return undef unless $expression; return undef unless $self->try_parse('punctuator', ')'); return $expression; } my $string = $self->try_parse('string_literal'); return $string->process if $string; my $identifier = $self->try_parse('identifier'); return $identifier->process if $identifier; return $self->try_parse('constant'); } sub try_constant { my $self = shift; my $constant; $constant = $self->try_parse('integer_constant'); return $constant->process if $constant; $constant = $self->try_parse('floating_constant'); return $constant->process if $constant; $constant = $self->try_parse('character_constant'); return $constant->process if $constant; return undef; } sub try_postfix_expression_array_suffix { my $self = shift; return undef unless $self->try_parse('punctuator', '['); my $expr = $self->try_parse('expression'); return undef unless $expr; return undef unless $self->try_parse('punctuator', ']'); return new CParse::Op::ArraySubscript $expr; } sub try_postfix_expression_call_suffix { my $self = shift; return undef unless $self->try_parse('punctuator', '('); my $args = $self->try_parse('op_list', 'assignment_expression', 'punctuator', ','); $args ||= []; return undef unless $self->try_parse('punctuator', ')'); return new CParse::Op::Call $args; } sub try_postfix_expression_member_suffix { my $self = shift; return undef unless $self->try_parse('punctuator', '.'); my $member = $self->try_parse('identifier'); return undef unless $member; return new CParse::Op::Member $member->string; } sub try_postfix_expression_member_indirect_suffix { my $self = shift; return undef unless $self->try_parse('punctuator', '->'); my $member = $self->try_parse('identifier'); return undef unless $member; return new CParse::Op::MemberIndirect $member->string; } sub try_postfix_expression_post_increment_suffix { my $self = shift; return undef unless $self->try_parse('punctuator', '++'); return new CParse::Op::Postinc; } sub try_postfix_expression_post_decrement_suffix { my $self = shift; return undef unless $self->try_parse('punctuator', '--'); return new CParse::Op::Postdec; } sub try_compound_statement { my $self = shift; return undef unless $self->try_parse('punctuator', '{'); $self->commit; my @items; ITEM: while (1) { last if $self->try_parse('punctuator', '}'); foreach my $thing (qw/statement declaration/) { my $item = $self->try_parse($thing); if ($item) { push @items, $item; next ITEM; } } return undef; } return \@items; } sub try_statement { my $self = shift; return $self->try_parse('null_statement') || $self->try_parse('labelled_statement') || $self->try_parse('compound_statement') || $self->try_parse('expression_statement') || $self->try_parse('selection_statement') || $self->try_parse('iteration_statement') || $self->try_parse('jump_statement') || $self->try_parse('asm_statement'); } sub try_null_statement { my $self = shift; return undef unless $self->try_parse('punctuator', ';'); return {}; } sub try_labelled_statement { my $self = shift; if ($self->try_parse('keyword', 'case')) { $self->commit; my $case = $self->try_parse('constant_expression'); return undef unless $case; return undef unless $self->try_parse('punctuator', ':'); my $statement = $self->try_parse('statement'); return undef unless $statement; return $statement; } if ($self->try_parse('keyword', 'default')) { $self->commit; return undef unless $self->try_parse('punctuator', ':'); my $statement = $self->try_parse('statement'); return undef unless $statement; return $statement; } my $identifier = $self->try_parse('identifier'); return undef unless $identifier; return undef unless $self->try_parse('punctuator', ':'); my $attributes = $self->try_parse('attribute_specifier_list'); my $statement = $self->try_parse('statement'); return undef unless $statement; return $statement; } sub try_expression_statement { my $self = shift; my $expr = $self->try_parse('expression'); return undef unless $self->try_parse('punctuator', ';'); return $expr; } sub try_selection_statement { my $self = shift; if ($self->try_parse('keyword', 'if')) { $self->commit; return undef unless $self->try_parse('punctuator', '('); my $expr = $self->try_parse('expression'); return undef unless defined $expr; return undef unless $self->try_parse('punctuator', ')'); my $true_statement = $self->try_parse('statement'); return undef unless defined $true_statement; my $false_statement; if ($self->try_parse('keyword', 'else')) { $false_statement = $self->try_parse('statement'); return undef unless defined $false_statement; } return $expr; } if ($self->try_parse('keyword', 'switch')) { $self->commit; return undef unless $self->try_parse('punctuator', '('); my $expr = $self->try_parse('expression'); return undef unless defined $expr; return undef unless $self->try_parse('punctuator', ')'); my $statement = $self->try_parse('statement'); return undef unless defined $statement; return $expr; } return undef; } sub try_iteration_statement { my $self = shift; if ($self->try_parse('keyword', 'while')) { $self->commit; return undef unless $self->try_parse('punctuator', '('); my $expr = $self->try_parse('expression'); return undef unless defined $expr; return undef unless $self->try_parse('punctuator', ')'); my $statement = $self->try_parse('statement'); return undef unless defined $statement; return $expr; } if ($self->try_parse('keyword', 'do')) { $self->commit; my $statement = $self->try_parse('statement'); return undef unless defined $statement; return undef unless $self->try_parse('keyword', 'while'); return undef unless $self->try_parse('punctuator', '('); my $expr = $self->try_parse('expression'); return undef unless defined $expr; return undef unless $self->try_parse('punctuator', ')'); return undef unless $self->try_parse('punctuator', ';'); return $expr; } if ($self->try_parse('keyword', 'for')) { $self->commit; return undef unless $self->try_parse('punctuator', '('); my $expr1 = $self->try_parse('declaration'); unless ($expr1) { $expr1 = $self->try_parse('expression'); return undef unless $self->try_parse('punctuator', ';'); } my $expr2 = $self->try_parse('expression'); return undef unless $self->try_parse('punctuator', ';'); my $expr3 = $self->try_parse('expression'); return undef unless $self->try_parse('punctuator', ')'); my $statement = $self->try_parse('statement'); return undef unless defined $statement; return $statement; } return undef; } sub try_jump_statement { my $self = shift; if ($self->try_parse('keyword', 'goto')) { $self->commit; my $label = $self->try_parse('identifier'); return undef unless $label; return undef unless $self->try_parse('punctuator', ';'); return $label; } if ($self->try_parse('keyword', 'continue')) { $self->commit; return undef unless $self->try_parse('punctuator', ';'); return []; } if ($self->try_parse('keyword', 'break')) { $self->commit; return undef unless $self->try_parse('punctuator', ';'); return []; } if ($self->try_parse('keyword', 'return')) { $self->commit; my $expr = $self->try_parse('expression'); return undef unless $self->try_parse('punctuator', ';'); return []; } return undef; } sub try_asm_statement { my $self = shift; return undef unless $self->try_parse('keyword', '__asm__'); $self->commit; my $volatile = $self->try_parse('keyword', 'volatile'); return undef unless $self->try_parse('punctuator', '('); my $expr = $self->try_parse('expression'); return undef unless $expr; if ($self->try_parse('punctuator', ':')) { return undef unless $self->try_parse('asm_operands'); if ($self->try_parse('punctuator', ':')) { return undef unless $self->try_parse('asm_operands'); if ($self->try_parse('punctuator', ':')) { return undef unless $self->try_parse('asm_clobbers'); } } } return undef unless $self->try_parse('punctuator', ')'); return undef unless $self->try_parse('punctuator', ';'); return $expr; } sub try_asm_operands { my $self = shift; return $self->try_parse('op_list', 'asm_operand', 'punctuator', ','); } sub try_asm_operand { my $self = shift; if ($self->try_parse('punctuator', '[')) { $self->commit; return undef unless $self->try_parse('identifier'); return undef unless $self->try_parse('punctuator', ']'); } my $op = $self->try_parse('string_literal'); return undef unless $op; $self->commit; return undef unless $self->try_parse('punctuator', '('); return undef unless $self->try_parse('expression'); return undef unless $self->try_parse('punctuator', ')'); return $op; } sub try_asm_clobbers { my $self = shift; return $self->try_parse('op_list', 'string_literal', 'punctuator', ','); } sub try_attribute_specifier_list { my $self = shift; my @specifiers; while (1) { my $specifier = $self->try_parse('attribute_specifier'); last unless $specifier; push @specifiers, $specifier; } return undef unless scalar @specifiers; # We'll flatten these into one list return new CParse::AttributeList [map {$_->attributes} @specifiers]; } sub try_attribute_specifier { my $self = shift; if ($self->try_parse('keyword', '__asm__')) { # We'll just treat this as another attribute here $self->commit; return undef unless $self->try_parse('punctuator', '('); my $name = $self->try_parse('string_literal'); return undef unless $self->try_parse('punctuator', ')'); return new CParse::AttributeList [new CParse::Attribute 'asm_name', $name]; } return undef unless $self->try_parse('keyword', '__attribute__'); $self->commit; return undef unless $self->try_parse('punctuator', '('); return undef unless $self->try_parse('punctuator', '('); my $list = $self->try_parse('op_list', 'attribute', 'punctuator', ',', ')'); return undef unless $list; return undef unless $self->try_parse('punctuator', ')'); # Discard the operators, keep the rest return new CParse::AttributeList [grep {not $_->isa('CParse::Parser::Token::Punctuator')} @$list]; } sub try_attribute { my $self = shift; my $name = $self->try_parse('attribute_name'); return undef unless $name; my @args; if ($self->try_parse('punctuator', '(')) { if (!$self->try_parse('punctuator', ')')) { my $identifier = $self->try_parse('identifier'); if ($identifier) { push @args, $identifier->process if $identifier; my $p = $self->try_parse('punctuator'); return undef unless $p->string eq ')' or $p->string eq ','; if ($p->string eq ',') { my $list = $self->try_parse('op_list', 'assignment_expression', 'punctuator', ',', ')'); return undef unless $list; push @args, @$list; } } else { my $list = $self->try_parse('op_list', 'assignment_expression', 'punctuator', ',', ')'); return undef unless $list; push @args, @$list; } } } return new CParse::Attribute $name, \@args; } sub try_attribute_name { my $self = shift; my $keyword = $self->try_parse('keyword'); return $keyword->string if $keyword; my $identifier = $self->try_parse('identifier'); return $identifier->string if $identifier; return undef; } 1; icheck-0.9.7/CParse/EnumRef.pm0000644000175000017500000000073010273204213016511 0ustar asuffieldasuffieldpackage CParse::EnumRef; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $class = ref($this) || $this; my $tag = shift; my $self = {tag => $tag, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $tag = $self->{tag}; return "enum $tag"; } sub get_type { my $self = shift; my $namespace = shift; return new CType::Ref 'enum', $self->{tag}; } 1; icheck-0.9.7/CParse/Struct.pm0000644000175000017500000000464410273206717016457 0ustar asuffieldasuffieldpackage CParse::Struct; use 5.6.0; use strict; use warnings; use File::Spec; use CType::Struct; use CType::Ref; sub new { my $this = shift; my $class = ref($this) || $this; my $tag = shift; my $declarations = shift; my $attributes1 = shift; my $attributes2 = shift; my $self = {tag => $tag, declarations => $declarations, attributes1 => $attributes1, attributes2 => $attributes2, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $str = ''; $str .= "struct"; if ($self->{attributes1}) { $str .= " " . $self->{attributes1}->dump_c; } if ($self->{tag}) { $str .= " $self->{tag}"; } $str .= "\n{\n"; foreach my $declaration (@{$self->{declarations}}) { my @dump = split /\n/, $declaration->dump_c; $str .= join('', map {" $_\n"} @dump); } $str .= "}"; if ($self->{attributes2}) { $str .= " " . $self->{attributes2}->dump_c; } return $str; } sub construct_type { my $self = shift; my $namespace = shift; my @attributes; push @attributes, $self->{attributes1}->attributes if $self->{attributes1}; push @attributes, $self->{attributes2}->attributes if $self->{attributes2}; my @members = map {$_->get_members($namespace)} @{$self->{declarations}}; return new CType::Struct \@members, \@attributes, $CParse::current_location; } sub process { my $self = shift; my $namespace = shift; if ($self->{tag}) { # Heuristic: we'll ignore redefinitions that occur at the same file:line my $old = $namespace->get('struct', $self->{tag}); if ($old and (File::Spec->canonpath($old->{file}) ne File::Spec->canonpath($CParse::current_location->{file}) or $old->{line} ne $CParse::current_location->{line})) { die "Redefinition of struct $self->{tag}\n (old definition at $old->{file}:$old->{line})\n"; } my $type = $self->construct_type($namespace); $namespace->set('struct', $self->{tag}, $type); } } sub get_type { my $self = shift; my $namespace = shift; if ($self->{tag}) { return new CType::Ref 'struct', $self->{tag}, $namespace; } else { return $self->construct_type($namespace); } } 1; icheck-0.9.7/CParse/Extension.pm0000644000175000017500000000043010273204213017121 0ustar asuffieldasuffieldpackage CParse::Extension; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $class = ref($this) || $this; my $self = { }; bless $self, $class; return $self; } sub dump_c { my $self = shift; return ""; } 1; icheck-0.9.7/CParse/Op/0000755000175000017500000000000010273204213015170 5ustar asuffieldasuffieldicheck-0.9.7/CParse/Op/MemberIndirect.pm0000644000175000017500000000145610273204213020425 0ustar asuffieldasuffieldpackage CParse::Op::MemberIndirect; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::MemberIndirect; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $member = shift; my $self = {member => $member, }; bless $self, $class; return $self; } sub set_prefix { my $self = shift; $self->{arg} = shift; } sub args { my $self = shift; return ($self->{arg}); } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; my $member = $self->{member}; return "($arg->$member)"; } sub get_expr { my $self = shift; my $namespace = shift; my $arg = $self->{arg}->get_expr($namespace); return new CExpr::MemberIndirect $arg, $self->{member}; } 1; icheck-0.9.7/CParse/Op/Conditional.pm0000644000175000017500000000200610273204213017767 0ustar asuffieldasuffieldpackage CParse::Op::Conditional; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::Conditional; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $cond = shift; my $true = shift; my $false = shift; my $self = {cond => $cond, true => $true, false => $false, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{cond}, $self->{true}, $self->{false}); } sub dump_c { my $self = shift; my $cond = $self->{cond}->dump_c; my $true = $self->{true}->dump_c; my $false = $self->{false}->dump_c; return "($cond ? $true : $false)"; } sub get_expr { my $self = shift; my $namespace = shift; my $cond = $self->{cond}->get_expr($namespace); my $true = $self->{true}->get_expr($namespace); my $false = $self->{false}->get_expr($namespace); return new CExpr::Conditional $cond, $true, $false; } 1; icheck-0.9.7/CParse/Op/Multiply.pm0000644000175000017500000000206410273204213017347 0ustar asuffieldasuffieldpackage CParse::Op::Multiply; use 5.6.0; use strict; use warnings; use CParse::Op; use CParse::Op::Divide; use CParse::Op::Modulus; use CExpr::Multiply; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $op = shift; return CParse::Op::Divide->new($left, $right) if $op eq '/'; return CParse::Op::Modulus->new($left, $right) if $op eq '%'; die unless $op eq '*'; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left * $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::Multiply $left, $right; } 1; icheck-0.9.7/CParse/Op/BoolAnd.pm0000644000175000017500000000151610273204213017047 0ustar asuffieldasuffieldpackage CParse::Op::BoolAnd; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::BoolAnd; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left && $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::BoolAnd $left, $right; } 1; icheck-0.9.7/CParse/Op/Add.pm0000644000175000017500000000171610273204213016223 0ustar asuffieldasuffieldpackage CParse::Op::Add; use 5.6.0; use strict; use warnings; use CParse::Op; use CParse::Op::Subtract; use CExpr::Add; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $op = shift; return CParse::Op::Subtract->new($left, $right) if $op eq '-'; die unless $op eq '+'; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left + $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::Add $left, $right; } 1; icheck-0.9.7/CParse/Op/Shift.pm0000644000175000017500000000072410273204213016606 0ustar asuffieldasuffieldpackage CParse::Op::Shift; use 5.6.0; use strict; use warnings; use CParse::Op; use CParse::Op::Shift::Left; use CParse::Op::Shift::Right; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $op = shift; return CParse::Op::Shift::Left->new($left, $right) if $op eq '<<'; return CParse::Op::Shift::Right->new($left, $right) if $op eq '>>'; die; } 1; icheck-0.9.7/CParse/Op/Expression.pm0000644000175000017500000000153310273204213017667 0ustar asuffieldasuffieldpackage CParse::Op::Expression; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::SeqExpression; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left, $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::SeqExpression $left, $right; } 1; icheck-0.9.7/CParse/Op/NotEqual.pm0000644000175000017500000000152110273204213017255 0ustar asuffieldasuffieldpackage CParse::Op::NotEqual; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::NotEqual; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left != $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::NotEqual $left, $right; } 1; icheck-0.9.7/CParse/Op/Assign/0000755000175000017500000000000010273204213016414 5ustar asuffieldasuffieldicheck-0.9.7/CParse/Op/Assign/Multiply.pm0000644000175000017500000000157110273204213020575 0ustar asuffieldasuffieldpackage CParse::Op::Assign::Multiply; use 5.6.0; use strict; use warnings; use CParse::Op::Assign; use CExpr::Assign::Multiply; our @ISA = qw/CParse::Op::Assign/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left *= $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::Assign::Multiply $left, $right; } 1; icheck-0.9.7/CParse/Op/Assign/Add.pm0000644000175000017500000000155210273204213017445 0ustar asuffieldasuffieldpackage CParse::Op::Assign::Add; use 5.6.0; use strict; use warnings; use CParse::Op::Assign; use CExpr::Assign::Add; our @ISA = qw/CParse::Op::Assign/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left += $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::Assign::Add $left, $right; } 1; icheck-0.9.7/CParse/Op/Assign/.arch-ids/0000755000175000017500000000000010273204213020164 5ustar asuffieldasuffieldicheck-0.9.7/CParse/Op/Assign/.arch-ids/BitAnd.pm.id0000644000175000017500000000011010273204213022246 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.1 icheck-0.9.7/CParse/Op/Assign/.arch-ids/Add.pm.id0000644000175000017500000000011010273204213021575 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.0 icheck-0.9.7/CParse/Op/Assign/.arch-ids/Multiply.pm.id0000644000175000017500000000011010273204213022724 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.6 icheck-0.9.7/CParse/Op/Assign/.arch-ids/Modulus.pm.id0000644000175000017500000000011010273204213022535 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.5 icheck-0.9.7/CParse/Op/Assign/.arch-ids/BitOr.pm.id0000644000175000017500000000011010273204213022124 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.2 icheck-0.9.7/CParse/Op/Assign/.arch-ids/Subtract.pm.id0000644000175000017500000000011010273204213022674 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.9 icheck-0.9.7/CParse/Op/Assign/.arch-ids/ShiftLeft.pm.id0000644000175000017500000000011010273204213022775 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.7 icheck-0.9.7/CParse/Op/Assign/.arch-ids/ShiftRight.pm.id0000644000175000017500000000011010273204213023160 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.8 icheck-0.9.7/CParse/Op/Assign/.arch-ids/BitXor.pm.id0000644000175000017500000000011010273204213022314 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.3 icheck-0.9.7/CParse/Op/Assign/.arch-ids/=id0000644000175000017500000000011010273204213020570 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.5 icheck-0.9.7/CParse/Op/Assign/.arch-ids/Divide.pm.id0000644000175000017500000000011010273204213022311 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.4 icheck-0.9.7/CParse/Op/Assign/ShiftLeft.pm0000644000175000017500000000157510273204213020652 0ustar asuffieldasuffieldpackage CParse::Op::Assign::ShiftLeft; use 5.6.0; use strict; use warnings; use CParse::Op::Assign; use CExpr::Assign::ShiftLeft; our @ISA = qw/CParse::Op::Assign/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left <<= $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::Assign::ShiftLeft $left, $right; } 1; icheck-0.9.7/CParse/Op/Assign/ShiftRight.pm0000644000175000017500000000160010273204213021022 0ustar asuffieldasuffieldpackage CParse::Op::Assign::ShiftRight; use 5.6.0; use strict; use warnings; use CParse::Op::Assign; use CExpr::Assign::ShiftRight; our @ISA = qw/CParse::Op::Assign/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left >>= $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::Assign::ShiftRight $left, $right; } 1; icheck-0.9.7/CParse/Op/Assign/Modulus.pm0000644000175000017500000000156610273204213020412 0ustar asuffieldasuffieldpackage CParse::Op::Assign::Modulus; use 5.6.0; use strict; use warnings; use CParse::Op::Assign; use CExpr::Assign::Modulus; our @ISA = qw/CParse::Op::Assign/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left %= $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::Assign::Modulus $left, $right; } 1; icheck-0.9.7/CParse/Op/Assign/BitAnd.pm0000644000175000017500000000156310273204213020120 0ustar asuffieldasuffieldpackage CParse::Op::Assign::BitAnd; use 5.6.0; use strict; use warnings; use CParse::Op::Assign; use CExpr::Assign::BitAnd; our @ISA = qw/CParse::Op::Assign/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left &= $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::Assign::BitAnd $left, $right; } 1; icheck-0.9.7/CParse/Op/Assign/BitXor.pm0000644000175000017500000000156310273204213020166 0ustar asuffieldasuffieldpackage CParse::Op::Assign::BitXor; use 5.6.0; use strict; use warnings; use CParse::Op::Assign; use CExpr::Assign::BitXor; our @ISA = qw/CParse::Op::Assign/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left ^= $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::Assign::BitXor $left, $right; } 1; icheck-0.9.7/CParse/Op/Assign/BitOr.pm0000644000175000017500000000156010273204213017773 0ustar asuffieldasuffieldpackage CParse::Op::Assign::BitOr; use 5.6.0; use strict; use warnings; use CParse::Op::Assign; use CExpr::Assign::BitOr; our @ISA = qw/CParse::Op::Assign/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left |= $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::Assign::BitOr $left, $right; } 1; icheck-0.9.7/CParse/Op/Assign/Divide.pm0000644000175000017500000000156310273204213020163 0ustar asuffieldasuffieldpackage CParse::Op::Assign::Divide; use 5.6.0; use strict; use warnings; use CParse::Op::Assign; use CExpr::Assign::Divide; our @ISA = qw/CParse::Op::Assign/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left /= $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::Assign::Divide $left, $right; } 1; icheck-0.9.7/CParse/Op/Assign/Subtract.pm0000644000175000017500000000157110273204213020545 0ustar asuffieldasuffieldpackage CParse::Op::Assign::Subtract; use 5.6.0; use strict; use warnings; use CParse::Op::Assign; use CExpr::Assign::Subtract; our @ISA = qw/CParse::Op::Assign/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left -= $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::Assign::Subtract $left, $right; } 1; icheck-0.9.7/CParse/Op/Sizeof.pm0000644000175000017500000000122110273204213016761 0ustar asuffieldasuffieldpackage CParse::Op::Sizeof; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::Sizeof; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{arg}); } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "sizeof($arg)"; } sub get_expr { my $self = shift; my $namespace = shift; my $type = $self->{arg}->get_type($namespace); return new CExpr::Sizeof $type; } 1; icheck-0.9.7/CParse/Op/.arch-ids/0000755000175000017500000000000010273204213016740 5ustar asuffieldasuffieldicheck-0.9.7/CParse/Op/.arch-ids/Expression.pm.id0000644000175000017500000000011110273204213022021 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.17 icheck-0.9.7/CParse/Op/.arch-ids/BitAnd.pm.id0000644000175000017500000000011010273204213021022 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.7 icheck-0.9.7/CParse/Op/.arch-ids/Add.pm.id0000644000175000017500000000011010273204213020351 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.3 icheck-0.9.7/CParse/Op/.arch-ids/Multiply.pm.id0000644000175000017500000000011110273204213021501 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.21 icheck-0.9.7/CParse/Op/.arch-ids/Modulus.pm.id0000644000175000017500000000011110273204213021312 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.20 icheck-0.9.7/CParse/Op/.arch-ids/BitOr.pm.id0000644000175000017500000000011010273204213020700 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.8 icheck-0.9.7/CParse/Op/.arch-ids/Predec.pm.id0000644000175000017500000000011110273204213021064 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:24 2005 28706.26 icheck-0.9.7/CParse/Op/.arch-ids/BoolOr.pm.id0000644000175000017500000000011110273204213021056 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.11 icheck-0.9.7/CParse/Op/.arch-ids/Conditional.pm.id0000644000175000017500000000011110273204213022125 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.14 icheck-0.9.7/CParse/Op/.arch-ids/Subtract.pm.id0000644000175000017500000000011110273204213021451 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:24 2005 28706.34 icheck-0.9.7/CParse/Op/.arch-ids/Preinc.pm.id0000644000175000017500000000011110273204213021102 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:24 2005 28706.27 icheck-0.9.7/CParse/Op/.arch-ids/MemberIndirect.pm.id0000644000175000017500000000011110273204213022553 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.19 icheck-0.9.7/CParse/Op/.arch-ids/Relation.pm.id0000644000175000017500000000011110273204213021437 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:24 2005 28706.29 icheck-0.9.7/CParse/Op/.arch-ids/BitXor.pm.id0000644000175000017500000000011010273204213021070 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.9 icheck-0.9.7/CParse/Op/.arch-ids/ArraySubscript.pm.id0000644000175000017500000000011010273204213022636 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.4 icheck-0.9.7/CParse/Op/.arch-ids/SizeofExpr.pm.id0000644000175000017500000000011110273204213021760 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:24 2005 28706.33 icheck-0.9.7/CParse/Op/.arch-ids/Assign.pm.id0000644000175000017500000000011010273204213021105 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.6 icheck-0.9.7/CParse/Op/.arch-ids/Member.pm.id0000644000175000017500000000011110273204213021071 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.18 icheck-0.9.7/CParse/Op/.arch-ids/Equal.pm.id0000644000175000017500000000011110273204213020731 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.16 icheck-0.9.7/CParse/Op/.arch-ids/Alignof.pm.id0000644000175000017500000000011010273204213021240 0ustar asuffieldasuffieldAndrew Suffield Sun Mar 13 06:46:07 2005 10244.1 icheck-0.9.7/CParse/Op/.arch-ids/NotEqual.pm.id0000644000175000017500000000011110273204213021412 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.22 icheck-0.9.7/CParse/Op/.arch-ids/Postinc.pm.id0000644000175000017500000000011110273204213021301 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:24 2005 28706.25 icheck-0.9.7/CParse/Op/.arch-ids/Cast.pm.id0000644000175000017500000000011110273204213020554 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.13 icheck-0.9.7/CParse/Op/.arch-ids/Postdec.pm.id0000644000175000017500000000011110273204213021263 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:24 2005 28706.23 icheck-0.9.7/CParse/Op/.arch-ids/=id0000644000175000017500000000011110273204213017345 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.23 icheck-0.9.7/CParse/Op/.arch-ids/Divide.pm.id0000644000175000017500000000011110273204213021066 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.15 icheck-0.9.7/CParse/Op/.arch-ids/Postfix.pm.id0000644000175000017500000000011110273204213021316 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:24 2005 28706.24 icheck-0.9.7/CParse/Op/.arch-ids/BoolAnd.pm.id0000644000175000017500000000011110273204213021200 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.10 icheck-0.9.7/CParse/Op/.arch-ids/Shift.pm.id0000644000175000017500000000011110273204213020737 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:24 2005 28706.31 icheck-0.9.7/CParse/Op/.arch-ids/Call.pm.id0000644000175000017500000000011110273204213020535 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:23 2005 28706.12 icheck-0.9.7/CParse/Op/.arch-ids/Sizeof.pm.id0000644000175000017500000000011110273204213021121 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:24 2005 28706.32 icheck-0.9.7/CParse/Op/.arch-ids/Unary.pm.id0000644000175000017500000000011110273204213020760 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:24 2005 28706.36 icheck-0.9.7/CParse/Op/BoolOr.pm0000644000175000017500000000151310273204213016722 0ustar asuffieldasuffieldpackage CParse::Op::BoolOr; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::BoolOr; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left || $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::BoolOr $left, $right; } 1; icheck-0.9.7/CParse/Op/SizeofExpr.pm0000644000175000017500000000123410273204213017624 0ustar asuffieldasuffieldpackage CParse::Op::SizeofExpr; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::SizeofExpr; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{arg}); } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "(sizeof $arg)"; } sub get_expr { my $self = shift; my $namespace = shift; my $arg = $self->{arg}->get_expr($namespace); return new CExpr::SizeofExpr $arg; } 1; icheck-0.9.7/CParse/Op/ArraySubscript.pm0000644000175000017500000000156710273204213020514 0ustar asuffieldasuffieldpackage CParse::Op::ArraySubscript; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::ArraySubscript; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $right = shift; my $self = {right => $right, }; bless $self, $class; return $self; } sub set_prefix { my $self = shift; $self->{left} = shift; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left\[$right\])"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::ArraySubscript $left, $right; } 1; icheck-0.9.7/CParse/Op/Preinc.pm0000644000175000017500000000121310273204213016743 0ustar asuffieldasuffieldpackage CParse::Op::Preinc; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::Preinc; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{arg}); } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "(++$arg)"; } sub get_expr { my $self = shift; my $namespace = shift; my $arg = $self->{arg}->get_expr($namespace); return new CExpr::Preinc $arg; } 1; icheck-0.9.7/CParse/Op/Postinc.pm0000644000175000017500000000126410273204213017150 0ustar asuffieldasuffieldpackage CParse::Op::Postinc; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::Postinc; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $self = { }; bless $self, $class; return $self; } sub set_prefix { my $self = shift; $self->{arg} = shift; } sub args { my $self = shift; return ($self->{arg}); } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "($arg++)"; } sub get_expr { my $self = shift; my $namespace = shift; my $arg = $self->{arg}->get_expr($namespace); return new CExpr::Postinc $arg; } 1; icheck-0.9.7/CParse/Op/Modulus.pm0000644000175000017500000000151510273204213017160 0ustar asuffieldasuffieldpackage CParse::Op::Modulus; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::Modulus; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left % $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::Modulus $left, $right; } 1; icheck-0.9.7/CParse/Op/Unary/0000755000175000017500000000000010273204214016267 5ustar asuffieldasuffieldicheck-0.9.7/CParse/Op/Unary/Positive.pm0000644000175000017500000000126310273204214020431 0ustar asuffieldasuffieldpackage CParse::Op::Unary::Positive; use 5.6.0; use strict; use warnings; use CParse::Op::Unary; use CExpr::Unary::Positive; our @ISA = qw/CParse::Op::Unary/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{arg}); } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "(+$arg)"; } sub get_expr { my $self = shift; my $namespace = shift; my $arg = $self->{arg}->get_expr($namespace); return new CExpr::Unary::Positive $arg; } 1; icheck-0.9.7/CParse/Op/Unary/Negative.pm0000644000175000017500000000126310273204214020371 0ustar asuffieldasuffieldpackage CParse::Op::Unary::Negative; use 5.6.0; use strict; use warnings; use CParse::Op::Unary; use CExpr::Unary::Negative; our @ISA = qw/CParse::Op::Unary/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{arg}); } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "(-$arg)"; } sub get_expr { my $self = shift; my $namespace = shift; my $arg = $self->{arg}->get_expr($namespace); return new CExpr::Unary::Negative $arg; } 1; icheck-0.9.7/CParse/Op/Unary/.arch-ids/0000755000175000017500000000000010273204214020037 5ustar asuffieldasuffieldicheck-0.9.7/CParse/Op/Unary/.arch-ids/BitNot.pm.id0000644000175000017500000000011110273204214022160 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.17 icheck-0.9.7/CParse/Op/Unary/.arch-ids/BoolNot.pm.id0000644000175000017500000000011110273204214022335 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.18 icheck-0.9.7/CParse/Op/Unary/.arch-ids/AddressOf.pm.id0000644000175000017500000000011110273204214022633 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.16 icheck-0.9.7/CParse/Op/Unary/.arch-ids/Positive.pm.id0000644000175000017500000000011110273204214022563 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.21 icheck-0.9.7/CParse/Op/Unary/.arch-ids/=id0000644000175000017500000000011110273204214020444 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:24 2005 28706.35 icheck-0.9.7/CParse/Op/Unary/.arch-ids/Negative.pm.id0000644000175000017500000000011110273204214022523 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.20 icheck-0.9.7/CParse/Op/Unary/.arch-ids/Deref.pm.id0000644000175000017500000000011110273204214022006 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.19 icheck-0.9.7/CParse/Op/Unary/AddressOf.pm0000644000175000017500000000126710273204214020505 0ustar asuffieldasuffieldpackage CParse::Op::Unary::AddressOf; use 5.6.0; use strict; use warnings; use CParse::Op::Unary; use CExpr::Unary::AddressOf; our @ISA = qw/CParse::Op::Unary/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{arg}); } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "(\&$arg)"; } sub get_expr { my $self = shift; my $namespace = shift; my $arg = $self->{arg}->get_expr($namespace); return new CExpr::Unary::AddressOf $arg; } 1; icheck-0.9.7/CParse/Op/Unary/BitNot.pm0000644000175000017500000000125510273204214020027 0ustar asuffieldasuffieldpackage CParse::Op::Unary::BitNot; use 5.6.0; use strict; use warnings; use CParse::Op::Unary; use CExpr::Unary::BitNot; our @ISA = qw/CParse::Op::Unary/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{arg}); } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "(~$arg)"; } sub get_expr { my $self = shift; my $namespace = shift; my $arg = $self->{arg}->get_expr($namespace); return new CExpr::Unary::BitNot $arg; } 1; icheck-0.9.7/CParse/Op/Unary/BoolNot.pm0000644000175000017500000000126010273204214020200 0ustar asuffieldasuffieldpackage CParse::Op::Unary::BoolNot; use 5.6.0; use strict; use warnings; use CParse::Op::Unary; use CExpr::Unary::BoolNot; our @ISA = qw/CParse::Op::Unary/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{arg}); } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "(!$arg)"; } sub get_expr { my $self = shift; my $namespace = shift; my $arg = $self->{arg}->get_expr($namespace); return new CExpr::Unary::BoolNot $arg; } 1; icheck-0.9.7/CParse/Op/Unary/Deref.pm0000644000175000017500000000125310273204214017653 0ustar asuffieldasuffieldpackage CParse::Op::Unary::Deref; use 5.6.0; use strict; use warnings; use CParse::Op::Unary; use CExpr::Unary::Deref; our @ISA = qw/CParse::Op::Unary/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{arg}); } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "(\*$arg)"; } sub get_expr { my $self = shift; my $namespace = shift; my $arg = $self->{arg}->get_expr($namespace); return new CExpr::Unary::Deref $arg; } 1; icheck-0.9.7/CParse/Op/Member.pm0000644000175000017500000000142510273204213016737 0ustar asuffieldasuffieldpackage CParse::Op::Member; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::Member; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $member = shift; my $self = {member => $member, }; bless $self, $class; return $self; } sub set_prefix { my $self = shift; $self->{arg} = shift; } sub args { my $self = shift; return ($self->{arg}); } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; my $member = $self->{member}; return "($arg.$member)"; } sub get_expr { my $self = shift; my $namespace = shift; my $arg = $self->{arg}->get_expr($namespace); return new CExpr::Member $arg, $self->{member}; } 1; icheck-0.9.7/CParse/Op/Postfix.pm0000644000175000017500000000052110273204213017160 0ustar asuffieldasuffieldpackage CParse::Op::Postfix; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $class = ref($this) || $this; my $prefix = shift; my $suffixes = shift; foreach my $suffix (@$suffixes) { $suffix->set_prefix($prefix); $prefix = $suffix; } return $prefix; } 1; icheck-0.9.7/CParse/Op/BitAnd.pm0000644000175000017500000000151210273204213016666 0ustar asuffieldasuffieldpackage CParse::Op::BitAnd; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::BitAnd; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left & $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::BitAnd $left, $right; } 1; icheck-0.9.7/CParse/Op/Relation/0000755000175000017500000000000010273204213016745 5ustar asuffieldasuffieldicheck-0.9.7/CParse/Op/Relation/.arch-ids/0000755000175000017500000000000010273204213020515 5ustar asuffieldasuffieldicheck-0.9.7/CParse/Op/Relation/.arch-ids/GreaterEqual.pm.id0000644000175000017500000000011110273204213024020 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.11 icheck-0.9.7/CParse/Op/Relation/.arch-ids/Greater.pm.id0000644000175000017500000000011110273204213023030 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.10 icheck-0.9.7/CParse/Op/Relation/.arch-ids/=id0000644000175000017500000000011110273204213021122 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:24 2005 28706.28 icheck-0.9.7/CParse/Op/Relation/.arch-ids/LessEqual.pm.id0000644000175000017500000000011110273204213023335 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.13 icheck-0.9.7/CParse/Op/Relation/.arch-ids/Less.pm.id0000644000175000017500000000011110273204213022345 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.12 icheck-0.9.7/CParse/Op/Relation/Less.pm0000644000175000017500000000154210273204213020213 0ustar asuffieldasuffieldpackage CParse::Op::Relation::Less; use 5.6.0; use strict; use warnings; use CParse::Op::Relation; use CExpr::Less; our @ISA = qw/CParse::Op::Relation/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left < $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::Less $left, $right; } 1; icheck-0.9.7/CParse/Op/Relation/LessEqual.pm0000644000175000017500000000156210273204213021205 0ustar asuffieldasuffieldpackage CParse::Op::Relation::LessEqual; use 5.6.0; use strict; use warnings; use CParse::Op::Relation; use CExpr::LessEqual; our @ISA = qw/CParse::Op::Relation/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left <= $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::LessEqual $left, $right; } 1; icheck-0.9.7/CParse/Op/Relation/Greater.pm0000644000175000017500000000155310273204213020700 0ustar asuffieldasuffieldpackage CParse::Op::Relation::Greater; use 5.6.0; use strict; use warnings; use CParse::Op::Relation; use CExpr::Greater; our @ISA = qw/CParse::Op::Relation/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left > $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::Greater $left, $right; } 1; icheck-0.9.7/CParse/Op/Relation/GreaterEqual.pm0000644000175000017500000000157310273204213021672 0ustar asuffieldasuffieldpackage CParse::Op::Relation::GreaterEqual; use 5.6.0; use strict; use warnings; use CParse::Op::Relation; use CExpr::GreaterEqual; our @ISA = qw/CParse::Op::Relation/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left >= $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::GreaterEqual $left, $right; } 1; icheck-0.9.7/CParse/Op/Cast.pm0000644000175000017500000000144110273204213016420 0ustar asuffieldasuffieldpackage CParse::Op::Cast; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::Cast; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $type = shift; my $self = {arg => $arg, type => $type, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{arg}); } sub dump_c { my $self = shift; my $type = $self->{type}->dump_c; my $arg = $self->{arg}->dump_c; return "(($type) $arg)"; } sub get_expr { my $self = shift; my $namespace = shift; my $type = $self->{type}->get_type($namespace); my $arg = $self->{arg}->get_expr($namespace); return new CExpr::Cast $type, $arg; } 1; icheck-0.9.7/CParse/Op/BitXor.pm0000644000175000017500000000151310273204213016735 0ustar asuffieldasuffieldpackage CParse::Op::BoolXor; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::BitXor; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left ^ $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::BitXor $left, $right; } 1; icheck-0.9.7/CParse/Op/Alignof.pm0000644000175000017500000000123110273204213017102 0ustar asuffieldasuffieldpackage CParse::Op::Alignof; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::Alignof; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{arg}); } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "__alignof__($arg)"; } sub get_expr { my $self = shift; my $namespace = shift; my $type = $self->{arg}->get_type($namespace); return new CExpr::Alignof $type; } 1; icheck-0.9.7/CParse/Op/Relation.pm0000644000175000017500000000132310273204213017302 0ustar asuffieldasuffieldpackage CParse::Op::Relation; use 5.6.0; use strict; use warnings; use CParse::Op; use CParse::Op::Relation::Greater; use CParse::Op::Relation::GreaterEqual; use CParse::Op::Relation::Less; use CParse::Op::Relation::LessEqual; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $op = shift; return CParse::Op::Relation::Greater->new($left, $right) if $op eq '>'; return CParse::Op::Relation::GreaterEqual->new($left, $right) if $op eq '>='; return CParse::Op::Relation::Less->new($left, $right) if $op eq '<'; return CParse::Op::Relation::LessEqual->new($left, $right) if $op eq '<='; die; } 1; icheck-0.9.7/CParse/Op/Assign.pm0000644000175000017500000000327510273204213016761 0ustar asuffieldasuffieldpackage CParse::Op::Assign; use 5.6.0; use strict; use warnings; use CParse::Op; use CParse::Op::Assign::Multiply; use CParse::Op::Assign::Divide; use CParse::Op::Assign::Modulus; use CParse::Op::Assign::Add; use CParse::Op::Assign::Subtract; use CParse::Op::Assign::ShiftLeft; use CParse::Op::Assign::ShiftRight; use CParse::Op::Assign::BitAnd; use CParse::Op::Assign::BitXor; use CParse::Op::Assign::BitOr; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $op = shift; return CParse::Op::Assign::Multiply->new($left, $right) if $op eq '*='; return CParse::Op::Assign::Divide->new($left, $right) if $op eq '/='; return CParse::Op::Assign::Modulus->new($left, $right) if $op eq '%='; return CParse::Op::Assign::Add->new($left, $right) if $op eq '+='; return CParse::Op::Assign::Subtract->new($left, $right) if $op eq '-='; return CParse::Op::Assign::ShiftLeft->new($left, $right) if $op eq '<<='; return CParse::Op::Assign::ShiftRight->new($left, $right) if $op eq '>>='; return CParse::Op::Assign::BitAnd->new($left, $right) if $op eq '&='; return CParse::Op::Assign::BitXor->new($left, $right) if $op eq '^='; return CParse::Op::Assign::BitOr->new($left, $right) if $op eq '|='; die unless $op eq '='; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left = $right)"; } 1; icheck-0.9.7/CParse/Op/Shift/0000755000175000017500000000000010273204213016245 5ustar asuffieldasuffieldicheck-0.9.7/CParse/Op/Shift/Right.pm0000644000175000017500000000154710273204213017667 0ustar asuffieldasuffieldpackage CParse::Op::Shift::Right; use 5.6.0; use strict; use warnings; use CParse::Op::Shift; use CExpr::ShiftRight; our @ISA = qw/CParse::Op::Shift/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left >> $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::ShiftRight $left, $right; } 1; icheck-0.9.7/CParse/Op/Shift/.arch-ids/0000755000175000017500000000000010273204213020015 5ustar asuffieldasuffieldicheck-0.9.7/CParse/Op/Shift/.arch-ids/Left.pm.id0000644000175000017500000000011110273204213021631 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.14 icheck-0.9.7/CParse/Op/Shift/.arch-ids/Right.pm.id0000644000175000017500000000011110273204213022014 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:25 2005 28710.15 icheck-0.9.7/CParse/Op/Shift/.arch-ids/=id0000644000175000017500000000011110273204213020422 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:24 2005 28706.30 icheck-0.9.7/CParse/Op/Shift/Left.pm0000644000175000017500000000154410273204213017501 0ustar asuffieldasuffieldpackage CParse::Op::Shift::Left; use 5.6.0; use strict; use warnings; use CParse::Op::Shift; use CExpr::ShiftLeft; our @ISA = qw/CParse::Op::Shift/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left << $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::ShiftLeft $left, $right; } 1; icheck-0.9.7/CParse/Op/BitOr.pm0000644000175000017500000000150710273204213016550 0ustar asuffieldasuffieldpackage CParse::Op::BitOr; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::BitOr; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left | $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::BitOr $left, $right; } 1; icheck-0.9.7/CParse/Op/Postdec.pm0000644000175000017500000000126410273204213017132 0ustar asuffieldasuffieldpackage CParse::Op::Postdec; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::Postdec; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $self = { }; bless $self, $class; return $self; } sub set_prefix { my $self = shift; $self->{arg} = shift; } sub args { my $self = shift; return ($self->{arg}); } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "($arg--)"; } sub get_expr { my $self = shift; my $namespace = shift; my $arg = $self->{arg}->get_expr($namespace); return new CExpr::Postdec $arg; } 1; icheck-0.9.7/CParse/Op/Predec.pm0000644000175000017500000000121310273204213016725 0ustar asuffieldasuffieldpackage CParse::Op::Predec; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::Predec; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{arg}); } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "(--$arg)"; } sub get_expr { my $self = shift; my $namespace = shift; my $arg = $self->{arg}->get_expr($namespace); return new CExpr::Predec $arg; } 1; icheck-0.9.7/CParse/Op/Divide.pm0000644000175000017500000000151210273204213016731 0ustar asuffieldasuffieldpackage CParse::Op::Divide; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::Divide; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left / $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::Divide $left, $right; } 1; icheck-0.9.7/CParse/Op/Unary.pm0000644000175000017500000000146410273204213016631 0ustar asuffieldasuffieldpackage CParse::Op::Unary; use 5.6.0; use strict; use warnings; use CParse::Op; use CParse::Op::Unary::AddressOf; use CParse::Op::Unary::Deref; use CParse::Op::Unary::Positive; use CParse::Op::Unary::Negative; use CParse::Op::Unary::BitNot; use CParse::Op::Unary::BoolNot; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $op = shift; return CParse::Op::Unary::AddressOf->new($arg) if $op eq '&'; return CParse::Op::Unary::Deref->new($arg) if $op eq '*'; return CParse::Op::Unary::Positive->new($arg) if $op eq '+'; return CParse::Op::Unary::Negative->new($arg) if $op eq '-'; return CParse::Op::Unary::BitNot->new($arg) if $op eq '~'; return CParse::Op::Unary::BoolNot->new($arg) if $op eq '!'; die; } 1; icheck-0.9.7/CParse/Op/Subtract.pm0000644000175000017500000000152010273204213017313 0ustar asuffieldasuffieldpackage CParse::Op::Subtract; use 5.6.0; use strict; use warnings; use CParse::Op; use CExpr::Subtract; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left - $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::Subtract $left, $right; } 1; icheck-0.9.7/CParse/Op/Equal.pm0000644000175000017500000000172710273204213016604 0ustar asuffieldasuffieldpackage CParse::Op::Equal; use 5.6.0; use strict; use warnings; use CParse::Op; use CParse::Op::NotEqual; use CExpr::Equal; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $op = shift; return CParse::Op::NotEqual->new($left, $right) if $op eq '!='; die unless $op eq '=='; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub args { my $self = shift; return ($self->{left}, $self->{right}); } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left == $right)"; } sub get_expr { my $self = shift; my $namespace = shift; my $left = $self->{left}->get_expr($namespace); my $right = $self->{right}->get_expr($namespace); return new CExpr::Equal $left, $right; } 1; icheck-0.9.7/CParse/Op/Call.pm0000644000175000017500000000117110273204213016401 0ustar asuffieldasuffieldpackage CParse::Op::Call; use 5.6.0; use strict; use warnings; use CParse::Op; our @ISA = qw/CParse::Op/; sub new { my $this = shift; my $class = ref($this) || $this; my $args = shift; my $self = {args => $args, }; bless $self, $class; return $self; } sub set_prefix { my $self = shift; $self->{func} = shift; } sub args { my $self = shift; return ($self->{func}, $self->{args}); } sub dump_c { my $self = shift; my $func = $self->{func}->dump_c; my $args = join(', ', map {$_->dump_c} @{$self->{args}}); return "($func($args))"; } 1; icheck-0.9.7/CParse/AttributeList.pm0000644000175000017500000000076010273204213017752 0ustar asuffieldasuffieldpackage CParse::AttributeList; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $class = ref($this) || $this; my $attributes = shift; my $self = {attributes => $attributes, }; bless $self, $class; return $self; } sub attributes { my $self = shift; return @{$self->{attributes}}; } sub dump_c { my $self = shift; return "__attribute__((" . join(', ', map {$_->dump_c} @{$self->{attributes}}) . "))"; } 1; icheck-0.9.7/CParse/Declaration.pm0000644000175000017500000000567110273204213017406 0ustar asuffieldasuffieldpackage CParse::Declaration; use 5.6.0; use strict; use warnings; sub new { my $this = shift; my $class = ref($this) || $this; my $specifiers = shift; my $declarators = shift; my $self = {specifiers => $specifiers, declarators => $declarators, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $specifiers = join(' ', grep {$_} map {$_->dump_c} @{$self->{specifiers}}); my $declarators = join(', ', map {$_->dump_c} @{$self->{declarators}}); return join(' ', grep {$_} ($specifiers, $declarators)) . ";\n"; } sub set_location { my $self = shift; $self->{file} = shift; $self->{line} = shift; $self->{pos} = shift; } sub process { my $self = shift; my $namespace = shift; my $storage_class; my $inline; my @attributes; my @specifiers; my @process_specifiers; $CParse::current_location = $self; foreach my $specifier (@{$self->{specifiers}}) { if ($specifier->isa('CParse::StorageClass')) { if ($storage_class) { print STDERR "$self->{file}:$self->{line}:$self->{pos}: multiple storage class specifiers\n"; print STDERR "$self->{file}:$self->{line}:$self->{pos}: in " . $self->dump_c; exit 1; } $storage_class = $specifier; } elsif ($specifier->isa('CParse::FunctionSpecifier')) { if ($specifier->name ne 'inline') { die "Internal error: unrecognised storage class specifier " . $specifier->name; } $inline = 1; } elsif ($specifier->isa('CParse::AttributeList')) { push @attributes, $specifier->attributes; } elsif ($specifier->isa('CParse::Struct') or $specifier->isa('CParse::Union') or $specifier->isa('CParse::Enum')) { push @specifiers, $specifier; push @process_specifiers, $specifier; } else { push @specifiers, $specifier; } } eval { $_->process($namespace) foreach @process_specifiers; $_->process_decl($namespace, $storage_class, \@specifiers, $inline, \@attributes) foreach @{$self->{declarators}}; }; if ($@) { my $err = $@; $err =~ s/\n*$//; my @err = split /\n/, $err; print STDERR "$self->{file}:$self->{line}:$self->{pos}: $_\n" foreach @err; my $dump = eval {$self->dump_c}; if ($dump) { my @dump = split /\n/, $dump; my $first = 1; foreach (@dump) { print STDERR "$self->{file}:$self->{line}:$self->{pos}: " . ($first ? "in" : " ") . " $_\n"; $first = 0; } } exit 1; } $CParse::current_location = undef; } 1; icheck-0.9.7/COPYING0000644000175000017500000004311010273204213014467 0ustar asuffieldasuffield GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. icheck-0.9.7/icheck0000755000175000017500000001323010273204252014613 0ustar asuffieldasuffield#!/usr/bin/perl use 5.6.0; use strict; use warnings; use FindBin; use lib "/usr/share/icheck/perl5"; use lib "/usr/lib/icheck/perl5"; use lib $FindBin::Bin; use lib $FindBin::Bin . "/ext/CParse-Parser-PerlXS/blib/lib"; use lib $FindBin::Bin . "/ext/CParse-Parser-PerlXS/blib/arch"; use IO::File; use Getopt::Long qw/:config pass_through/; use CParse; use CParse::Namespace; use CType::Builtin; use CType::Native; use CType::Ref; use CExpr::Ref; unless (defined $ENV{ICHECK_DEBUG} and $ENV{ICHECK_DEBUG} =~ /^\d+$/) { $ENV{ICHECK_DEBUG} = 0; } sub usage { print < \$ENV{ICHECK_DEBUG}, 'baseline=s' => \@baseline, 'describe' => \$describe, 'canonify' => \$canonify, 'compare' => \$compare, 'only=s' => \$only, 'output|o=s' => \$output, 'verbose|v' => \$verbose, 'skip-from=s' => \@skip_from, 'skip-from-re=s' => \@skip_from_re, 'only-from=s' => \@only_from, 'only-from-re=s' => \@only_from_re, 'help|h' => \&usage, ); usage if $compare and ($describe or $canonify or scalar @baseline); usage unless $compare or $describe or $canonify; my $output_file; if ($output) { $output_file = new IO::File $output, "w"; select $output_file; } my @gcc_args; my @sources; while (scalar @ARGV) { my $arg = shift @ARGV; if ($arg eq '--') { push @sources, @ARGV; @ARGV = (); last; } if ($arg eq '-') { push @sources, '-'; next; } if ($arg =~ /^-/) { push @gcc_args, $arg; next; } push @sources, $arg; } my ($kind, $name); if ($only) { if ($only =~ /^(struct|union|enum)\s+(.*)\s*$/) { $kind = $1; $name = $2; } else { $kind = 'ordinary'; $name = $only; $name =~ s/^\s*//; $name =~ s/\s*$//; } } sub do_compile { print STDERR "Compiling...\n" if $verbose; my $global = new CParse::Namespace; CType::Builtin::register_builtins($global); foreach my $file (@_) { print STDERR "Parsing $file...\n" if $verbose; my $unit = parse_file($file, @gcc_args); $_->process($global) foreach @$unit; } print STDERR "Completing references\n" if $verbose; CType::Ref::complete_refs($global); print STDERR "Laying out decls\n" if $verbose; $_->layout(0, $global) foreach $global->get_decls; print STDERR "Laying out types\n" if $verbose; $_->layout(1, $global) foreach $global->get_types; print STDERR "Done compiling\n" if $verbose; return $global; } if ($compare) { usage unless scalar @sources == 2; my $old_file = $sources[0]; my $new_file = $sources[1]; my $old_global = do_compile($old_file); my $new_global = do_compile($new_file); $new_global->skip_from(@skip_from); $new_global->skip_from_re(@skip_from_re); $new_global->only_from(@only_from); $new_global->only_from_re(@only_from_re); my $result; print STDERR "Comparing...\n" if $verbose; if ($only) { $result = $new_global->compare_thing($old_global, $kind, $name); } else { $result = $new_global->compare($old_global); } if ($result->{abi_forward} and $result->{abi_backward}) { print "ABI is not compatible\n"; } elsif ($result->{abi_forward}) { print "ABI is not forward-compatible\n"; } elsif ($result->{abi_backward}) { print "ABI is not backward-compatible\n"; } if ($result->{api_forward} and $result->{api_backward}) { print "API is not compatible\n"; } elsif ($result->{api_forward}) { print "API is not forward-compatible\n"; } elsif ($result->{api_backward}) { print "API is not backward-compatible\n"; } if (grep {$result->{$_}} keys %$result) { exit 1; } else { exit 0; } } my $global = do_compile(@sources); $global->skip_from(@skip_from); $global->skip_from_re(@skip_from_re); $global->only_from(@only_from); $global->only_from_re(@only_from_re); if (scalar @baseline) { my $baseline = do_compile(@baseline); $global->baseline($baseline); } if ($describe) { print STDERR "Describing...\n" if $verbose; if ($only) { $global->describe_thing($kind, $name); } else { $global->describe; } } if ($canonify) { print STDERR "Canonifying...\n" if $verbose; if ($only) { $global->dump_thing($kind, $name); } else { $global->dump; } } exit 0; icheck-0.9.7/t/0000755000175000017500000000000010273204251013702 5ustar asuffieldasuffieldicheck-0.9.7/t/.arch-ids/0000755000175000017500000000000010273204214015451 5ustar asuffieldasuffieldicheck-0.9.7/t/.arch-ids/=id0000644000175000017500000000011010273204214016055 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:15:21 2005 13069.3 icheck-0.9.7/t/02_struct/0000755000175000017500000000000010273271261015534 5ustar asuffieldasuffieldicheck-0.9.7/t/02_struct/.arch-ids/0000755000175000017500000000000010273204214017276 5ustar asuffieldasuffieldicheck-0.9.7/t/02_struct/.arch-ids/=id0000644000175000017500000000011110273204214017703 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:15:21 2005 13069.13 icheck-0.9.7/t/02_struct/.arch-ids/canonical.id0000644000175000017500000000011110273204214021534 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:15:21 2005 13069.14 icheck-0.9.7/t/02_struct/source/0000755000175000017500000000000010273204214017026 5ustar asuffieldasuffieldicheck-0.9.7/t/02_struct/source/.arch-ids/0000755000175000017500000000000010273204214020576 5ustar asuffieldasuffieldicheck-0.9.7/t/02_struct/source/.arch-ids/bar.c.id0000644000175000017500000000011110273204214022072 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:15:21 2005 13069.16 icheck-0.9.7/t/02_struct/source/.arch-ids/=id0000644000175000017500000000011110273204214021203 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:15:21 2005 13069.15 icheck-0.9.7/t/02_struct/source/bar.c0000644000175000017500000000010710273204214017734 0ustar asuffieldasuffieldstruct foo { int foo; int bar; long baz; void (*zug)(void); }; icheck-0.9.7/t/02_struct/canonical0000644000175000017500000000032110273271261017402 0ustar asuffieldasuffieldstruct foo; # 1 "t/02_struct/source/bar.c" struct __attribute__((aligned(__alignof__(long int)), aligned(__alignof__(void *)))) foo { int foo; int bar; long int baz; void (* zug)(void); }; icheck-0.9.7/t/00_empty/0000755000175000017500000000000010273204214015336 5ustar asuffieldasuffieldicheck-0.9.7/t/00_empty/original0000644000175000017500000000000010273204214017053 0ustar asuffieldasuffieldicheck-0.9.7/t/00_empty/diff0000644000175000017500000000000010273204214016157 0ustar asuffieldasuffieldicheck-0.9.7/t/00_empty/.arch-ids/0000755000175000017500000000000010273204214017106 5ustar asuffieldasuffieldicheck-0.9.7/t/00_empty/.arch-ids/diff.id0000644000175000017500000000011010273204214020324 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:15:21 2005 13069.6 icheck-0.9.7/t/00_empty/.arch-ids/=id0000644000175000017500000000011010273204214017512 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:15:21 2005 13069.4 icheck-0.9.7/t/00_empty/.arch-ids/original.id0000644000175000017500000000011010273204214021220 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:15:21 2005 13069.7 icheck-0.9.7/t/00_empty/.arch-ids/canonical.id0000644000175000017500000000011010273204214021343 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:15:21 2005 13069.5 icheck-0.9.7/t/00_empty/source/0000755000175000017500000000000010273204214016636 5ustar asuffieldasuffieldicheck-0.9.7/t/00_empty/source/.arch-ids/0000755000175000017500000000000010273204214020406 5ustar asuffieldasuffieldicheck-0.9.7/t/00_empty/source/.arch-ids/=id0000644000175000017500000000011010273204214021012 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:15:21 2005 13069.8 icheck-0.9.7/t/00_empty/canonical0000644000175000017500000000000010273204214017176 0ustar asuffieldasuffieldicheck-0.9.7/t/03_baseline/0000755000175000017500000000000010273204252015767 5ustar asuffieldasuffieldicheck-0.9.7/t/03_baseline/.arch-ids/0000755000175000017500000000000010273204214017535 5ustar asuffieldasuffieldicheck-0.9.7/t/03_baseline/.arch-ids/=id0000644000175000017500000000011010273204214020141 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 21:13:53 2005 24992.0 icheck-0.9.7/t/03_baseline/.arch-ids/canonical.id0000644000175000017500000000011010273204214021772 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 21:13:53 2005 24992.2 icheck-0.9.7/t/03_baseline/.arch-ids/baseline.id0000644000175000017500000000011010273204214021625 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 21:13:53 2005 24992.1 icheck-0.9.7/t/03_baseline/baseline0000644000175000017500000000014110273204214017466 0ustar asuffieldasuffield# 3 "t/03_baseline/source/foo.c" typedef int a; # 1 "t/03_baseline/source/foo.c" extern int foo; icheck-0.9.7/t/03_baseline/source/0000755000175000017500000000000010273204214017265 5ustar asuffieldasuffieldicheck-0.9.7/t/03_baseline/source/.arch-ids/0000755000175000017500000000000010273204214021035 5ustar asuffieldasuffieldicheck-0.9.7/t/03_baseline/source/.arch-ids/foo.c.id0000644000175000017500000000011010273204214022347 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 21:13:53 2005 24992.4 icheck-0.9.7/t/03_baseline/source/.arch-ids/=id0000644000175000017500000000011010273204214021441 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 21:13:53 2005 24992.3 icheck-0.9.7/t/03_baseline/source/foo.c0000644000175000017500000000012510273204214020212 0ustar asuffieldasuffieldint foo; int bar; typedef int a; typedef int b; struct c { a x; b y; int z; }; icheck-0.9.7/t/03_baseline/canonical0000644000175000017500000000034610273204252017644 0ustar asuffieldasuffieldstruct c; # 4 "t/03_baseline/source/foo.c" typedef int b; # 5 "t/03_baseline/source/foo.c" struct __attribute__((aligned(__alignof__(int)))) c { a x; b y; int z; }; # 2 "t/03_baseline/source/foo.c" extern int bar; icheck-0.9.7/t/04_align/0000755000175000017500000000000010273455727015317 5ustar asuffieldasuffieldicheck-0.9.7/t/04_align/original0000644000175000017500000000343710273455727017055 0ustar asuffieldasuffieldstruct foo1; struct foo10; struct foo2; struct foo3; struct foo4; struct foo5; struct foo6; struct foo7; struct foo8; struct foo9; union foo11; enum foo12; enum foo13; # 1 "t/04_align/source/foo.c" struct __attribute__((aligned(17))) foo1 { int a; char b; }; # 58 "t/04_align/source/foo.c" struct __attribute__((aligned(449), aligned(__alignof__(char)))) foo10 { char a; char b; }; # 7 "t/04_align/source/foo.c" struct __attribute__((aligned(__alignof__(int)))) foo2 { char a; int b; }; # 13 "t/04_align/source/foo.c" struct __attribute__((aligned(__alignof__(long long int)))) foo3 { long long int a; char b; int c; }; # 20 "t/04_align/source/foo.c" struct __attribute__((aligned(__alignof__(short int)))) foo4 { short int a; char b; }; # 26 "t/04_align/source/foo.c" struct __attribute__((aligned(__alignof__(int)))) foo5 { int a : 4; char b : 5; }; # 32 "t/04_align/source/foo.c" struct __attribute__((aligned(__alignof__(char)))) foo6 { char a : 4; char b : 5; }; # 38 "t/04_align/source/foo.c" struct __attribute__((aligned(__alignof__(int)))) foo7 { char a : 4; char : 4; char b : 4; }; # 45 "t/04_align/source/foo.c" struct __attribute__((aligned(__alignof__(char)))) foo8 { char a; char b; }; # 52 "t/04_align/source/foo.c" struct __attribute__((aligned(__alignof__(int)), aligned(__alignof__(void *)))) foo9 { int a; char * b; }; # 64 "t/04_align/source/foo.c" union __attribute__((aligned(__alignof__(int)), aligned(__alignof__(void *)))) foo11 { int a; char * b; }; # 70 "t/04_align/source/foo.c" enum foo12 { foo12_a = 0, foo12_b = 1, }; # 75 "t/04_align/source/foo.c" enum __attribute__((aligned(1), packed)) foo13 { foo13_a = 0, foo13_b = 1, }; icheck-0.9.7/t/04_align/diff0000644000175000017500000000060110273455727016147 0ustar asuffieldasuffieldABI mismatch: size of 64 versus 136 ABI mismatch: alignment of 32 versus 136 in type defined at t/04_align/source/foo.c:1: struct __attribute__((aligned(__alignof__(int)))) foo1 { int a; char b; }; versus type defined at t/04_align/source/foo.c:1: struct __attribute__((aligned(17), aligned(__alignof__(int)))) foo1 { int a; char b; }; ABI is not compatible icheck-0.9.7/t/04_align/.arch-ids/0000755000175000017500000000000010273204251017047 5ustar asuffieldasuffieldicheck-0.9.7/t/04_align/.arch-ids/result.compare.id0000644000175000017500000000010710273204251022326 0ustar asuffieldasuffieldAndrew Suffield Sat Jul 23 17:11:36 2005 5644.4 icheck-0.9.7/t/04_align/.arch-ids/diff.id0000644000175000017500000000010710273204251020273 0ustar asuffieldasuffieldAndrew Suffield Sat Jul 23 17:11:36 2005 5644.2 icheck-0.9.7/t/04_align/.arch-ids/=id0000644000175000017500000000010710273204251017461 0ustar asuffieldasuffieldAndrew Suffield Sat Jul 23 17:11:36 2005 5644.0 icheck-0.9.7/t/04_align/.arch-ids/original.id0000644000175000017500000000010710273204251021167 0ustar asuffieldasuffieldAndrew Suffield Sat Jul 23 17:11:36 2005 5644.3 icheck-0.9.7/t/04_align/.arch-ids/canonical.id0000644000175000017500000000010710273204251021312 0ustar asuffieldasuffieldAndrew Suffield Sat Jul 23 17:11:36 2005 5644.1 icheck-0.9.7/t/04_align/source/0000755000175000017500000000000010273455727016617 5ustar asuffieldasuffieldicheck-0.9.7/t/04_align/source/.arch-ids/0000755000175000017500000000000010273204251020347 5ustar asuffieldasuffieldicheck-0.9.7/t/04_align/source/.arch-ids/foo.c.id0000644000175000017500000000010710273204251021667 0ustar asuffieldasuffieldAndrew Suffield Sat Jul 23 17:11:36 2005 5644.6 icheck-0.9.7/t/04_align/source/.arch-ids/=id0000644000175000017500000000010710273204251020761 0ustar asuffieldasuffieldAndrew Suffield Sat Jul 23 17:11:36 2005 5644.5 icheck-0.9.7/t/04_align/source/foo.c0000644000175000017500000000113010273455727017541 0ustar asuffieldasuffieldstruct foo1 { int a; char b; }; struct foo2 { char a; int b; }; struct foo3 { long long a; char b; int c; }; struct foo4 { short a; char b; }; struct foo5 { int a:4; char b:5; }; struct foo6 { char a:4; char b:5; }; struct foo7 { char a:4; int:0; char b:4; }; struct foo8 { char a; int:0; char b; }; struct foo9 { int a; char *b; }; struct __attribute__((aligned(227), aligned(449))) foo10 { char a; char b; }; union foo11 { int a; char *b; }; enum foo12 { foo12_a, foo12_b }; enum __attribute__((packed)) foo13 { foo13_a, foo13_b }; icheck-0.9.7/t/04_align/canonical0000644000175000017500000000345510273455727017200 0ustar asuffieldasuffieldstruct foo1; struct foo10; struct foo2; struct foo3; struct foo4; struct foo5; struct foo6; struct foo7; struct foo8; struct foo9; union foo11; enum foo12; enum foo13; # 1 "t/04_align/source/foo.c" struct __attribute__((aligned(__alignof__(int)))) foo1 { int a; char b; }; # 58 "t/04_align/source/foo.c" struct __attribute__((aligned(449), aligned(__alignof__(char)))) foo10 { char a; char b; }; # 7 "t/04_align/source/foo.c" struct __attribute__((aligned(__alignof__(int)))) foo2 { char a; int b; }; # 13 "t/04_align/source/foo.c" struct __attribute__((aligned(__alignof__(long long int)))) foo3 { long long int a; char b; int c; }; # 20 "t/04_align/source/foo.c" struct __attribute__((aligned(__alignof__(short int)))) foo4 { short int a; char b; }; # 26 "t/04_align/source/foo.c" struct __attribute__((aligned(__alignof__(int)))) foo5 { int a : 4; char b : 5; }; # 32 "t/04_align/source/foo.c" struct __attribute__((aligned(__alignof__(char)))) foo6 { char a : 4; char b : 5; }; # 38 "t/04_align/source/foo.c" struct __attribute__((aligned(__alignof__(int)))) foo7 { char a : 4; char : 4; char b : 4; }; # 45 "t/04_align/source/foo.c" struct __attribute__((aligned(__alignof__(char)))) foo8 { char a; char b; }; # 52 "t/04_align/source/foo.c" struct __attribute__((aligned(__alignof__(int)), aligned(__alignof__(void *)))) foo9 { int a; char * b; }; # 64 "t/04_align/source/foo.c" union __attribute__((aligned(__alignof__(int)), aligned(__alignof__(void *)))) foo11 { int a; char * b; }; # 70 "t/04_align/source/foo.c" enum foo12 { foo12_a = 0, foo12_b = 1, }; # 75 "t/04_align/source/foo.c" enum __attribute__((aligned(1), packed)) foo13 { foo13_a = 0, foo13_b = 1, }; icheck-0.9.7/t/04_align/result.compare0000644000175000017500000000000210273204251020155 0ustar asuffieldasuffield1 icheck-0.9.7/t/01_fundamental/0000755000175000017500000000000010273204214016477 5ustar asuffieldasuffieldicheck-0.9.7/t/01_fundamental/original0000644000175000017500000000000010273204214020214 0ustar asuffieldasuffieldicheck-0.9.7/t/01_fundamental/diff0000644000175000017500000000402610273204214017334 0ustar asuffieldasuffieldAPI and ABI addition: identifier a is new is now defined at t/01_fundamental/source/foo.c:1: extern char a; API and ABI addition: identifier as is new is now defined at t/01_fundamental/source/foo.c:2: extern signed char as; API and ABI addition: identifier au is new is now defined at t/01_fundamental/source/foo.c:3: extern unsigned char au; API and ABI addition: identifier b is new is now defined at t/01_fundamental/source/foo.c:4: extern short int b; API and ABI addition: identifier bu is new is now defined at t/01_fundamental/source/foo.c:5: extern unsigned short int bu; API and ABI addition: identifier c is new is now defined at t/01_fundamental/source/foo.c:6: extern int c; API and ABI addition: identifier cu is new is now defined at t/01_fundamental/source/foo.c:7: extern unsigned int cu; API and ABI addition: identifier d is new is now defined at t/01_fundamental/source/foo.c:8: extern long int d; API and ABI addition: identifier du is new is now defined at t/01_fundamental/source/foo.c:9: extern unsigned long int du; API and ABI addition: identifier e is new is now defined at t/01_fundamental/source/foo.c:10: extern long long int e; API and ABI addition: identifier eu is new is now defined at t/01_fundamental/source/foo.c:11: extern unsigned long long int eu; API and ABI addition: identifier f is new is now defined at t/01_fundamental/source/foo.c:12: extern void * f; API and ABI addition: identifier g is new is now defined at t/01_fundamental/source/foo.c:13: extern _Bool g; API and ABI addition: identifier h is new is now defined at t/01_fundamental/source/foo.c:14: extern float h; API and ABI addition: identifier i is new is now defined at t/01_fundamental/source/foo.c:15: extern double i; API and ABI addition: identifier j is new is now defined at t/01_fundamental/source/foo.c:16: extern long double j; API and ABI addition: identifier l is new is now defined at t/01_fundamental/source/foo.c:17: extern enum { k = 0, } l; ABI is not backward-compatible API is not backward-compatible icheck-0.9.7/t/01_fundamental/.arch-ids/0000755000175000017500000000000010273204214020247 5ustar asuffieldasuffieldicheck-0.9.7/t/01_fundamental/.arch-ids/result.compare.id0000644000175000017500000000011010273204214023520 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:43:24 2005 14080.2 icheck-0.9.7/t/01_fundamental/.arch-ids/diff.id0000644000175000017500000000011010273204214021465 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:43:24 2005 14080.0 icheck-0.9.7/t/01_fundamental/.arch-ids/=id0000644000175000017500000000011010273204214020653 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:15:21 2005 13069.9 icheck-0.9.7/t/01_fundamental/.arch-ids/original.id0000644000175000017500000000011010273204214022361 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:43:24 2005 14080.1 icheck-0.9.7/t/01_fundamental/.arch-ids/canonical.id0000644000175000017500000000011110273204214022505 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:15:21 2005 13069.10 icheck-0.9.7/t/01_fundamental/source/0000755000175000017500000000000010273204214017777 5ustar asuffieldasuffieldicheck-0.9.7/t/01_fundamental/source/.arch-ids/0000755000175000017500000000000010273204214021547 5ustar asuffieldasuffieldicheck-0.9.7/t/01_fundamental/source/.arch-ids/foo.c.id0000644000175000017500000000011110273204214023062 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:15:21 2005 13069.12 icheck-0.9.7/t/01_fundamental/source/.arch-ids/=id0000644000175000017500000000011110273204214022154 0ustar asuffieldasuffieldAndrew Suffield Sun Jul 3 18:15:21 2005 13069.11 icheck-0.9.7/t/01_fundamental/source/foo.c0000644000175000017500000000033410273204214020726 0ustar asuffieldasuffieldchar a; signed char as; unsigned char au; short b; unsigned short bu; int c; unsigned int cu; long d; unsigned long du; long long e; unsigned long long eu; void *f; _Bool g; float h; double i; long double j; enum {k} l; icheck-0.9.7/t/01_fundamental/canonical0000644000175000017500000000174710273204214020362 0ustar asuffieldasuffield# 1 "t/01_fundamental/source/foo.c" extern char a; # 2 "t/01_fundamental/source/foo.c" extern signed char as; # 3 "t/01_fundamental/source/foo.c" extern unsigned char au; # 4 "t/01_fundamental/source/foo.c" extern short int b; # 5 "t/01_fundamental/source/foo.c" extern unsigned short int bu; # 6 "t/01_fundamental/source/foo.c" extern int c; # 7 "t/01_fundamental/source/foo.c" extern unsigned int cu; # 8 "t/01_fundamental/source/foo.c" extern long int d; # 9 "t/01_fundamental/source/foo.c" extern unsigned long int du; # 10 "t/01_fundamental/source/foo.c" extern long long int e; # 11 "t/01_fundamental/source/foo.c" extern unsigned long long int eu; # 12 "t/01_fundamental/source/foo.c" extern void * f; # 13 "t/01_fundamental/source/foo.c" extern _Bool g; # 14 "t/01_fundamental/source/foo.c" extern float h; # 15 "t/01_fundamental/source/foo.c" extern double i; # 16 "t/01_fundamental/source/foo.c" extern long double j; # 17 "t/01_fundamental/source/foo.c" extern enum { k = 0, } l; icheck-0.9.7/t/01_fundamental/result.compare0000644000175000017500000000000210273204214021355 0ustar asuffieldasuffield1 icheck-0.9.7/CExpr/0000755000175000017500000000000010273271261014465 5ustar asuffieldasuffieldicheck-0.9.7/CExpr/SeqExpression.pm0000644000175000017500000000165710273204213017635 0ustar asuffieldasuffieldpackage CExpr::SeqExpression; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left, $right)"; } sub compute { my $self = shift; my $right = $self->{right}->compute; return $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/MemberIndirect.pm0000644000175000017500000000134710273204213017712 0ustar asuffieldasuffieldpackage CExpr::MemberIndirect; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $member = shift; my $self = {arg => $arg, member => $member, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; my $member = $self->{member}; return "($arg)->$member"; } sub get_refs { my $self = shift; return ($self->{arg}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{arg}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Conditional.pm0000644000175000017500000000222510273204213017260 0ustar asuffieldasuffieldpackage CExpr::Conditional; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $cond = shift; my $true = shift; my $false = shift; my $self = {cond => $cond, true => $true, false => $false, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $cond = $self->{cond}->dump_c; my $true = $self->{true}->dump_c; my $false = $self->{false}->dump_c; return "($cond) ? $true : $false"; } sub compute { my $self = shift; my $cond = $self->{cond}->compute; return $cond ? $self->{true}->compute : $self->{false}->compute; } sub get_refs { my $self = shift; return ($self->{cond}->get_refs, $self->{true}->get_refs, $self->{false}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{cond}->layout($accept_incomplete, $namespace); $self->{true}->layout($accept_incomplete, $namespace); $self->{false}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Multiply.pm0000644000175000017500000000173210273204213016636 0ustar asuffieldasuffieldpackage CExpr::Multiply; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left * $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left * $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/BoolAnd.pm0000644000175000017500000000173310273204213016336 0ustar asuffieldasuffieldpackage CExpr::BoolAnd; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left && $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left && $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Add.pm0000644000175000017500000000172510273204213015511 0ustar asuffieldasuffieldpackage CExpr::Add; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left + $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left + $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Integer.pm0000644000175000017500000000100310273204213016403 0ustar asuffieldasuffieldpackage CExpr::Integer; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $value = shift; my $self = {value => $value, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; return $self->{value}; } sub compute { my $self = shift; return $self->{value}; } sub get_refs { my $self = shift; return (); } sub layout { } 1; icheck-0.9.7/CExpr/NotEqual.pm0000644000175000017500000000173410273204213016551 0ustar asuffieldasuffieldpackage CExpr::NotEqual; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left != $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left != $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Assign/0000755000175000017500000000000010273204213015702 5ustar asuffieldasuffieldicheck-0.9.7/CExpr/Assign/Multiply.pm0000644000175000017500000000174310273204213020064 0ustar asuffieldasuffieldpackage CExpr::Assign::Multiply; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left *= $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left * $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Assign/Add.pm0000644000175000017500000000173610273204213016737 0ustar asuffieldasuffieldpackage CExpr::Assign::Add; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left += $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left + $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Assign/.arch-ids/0000755000175000017500000000000010273204213017452 5ustar asuffieldasuffieldicheck-0.9.7/CExpr/Assign/.arch-ids/BitAnd.pm.id0000644000175000017500000000011010273204213021534 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.3 icheck-0.9.7/CExpr/Assign/.arch-ids/Add.pm.id0000644000175000017500000000011010273204213021063 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.2 icheck-0.9.7/CExpr/Assign/.arch-ids/Multiply.pm.id0000644000175000017500000000011010273204213022212 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.8 icheck-0.9.7/CExpr/Assign/.arch-ids/Modulus.pm.id0000644000175000017500000000011010273204213022023 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.7 icheck-0.9.7/CExpr/Assign/.arch-ids/BitOr.pm.id0000644000175000017500000000011010273204213021412 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.4 icheck-0.9.7/CExpr/Assign/.arch-ids/Subtract.pm.id0000644000175000017500000000011110273204213022163 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.11 icheck-0.9.7/CExpr/Assign/.arch-ids/ShiftLeft.pm.id0000644000175000017500000000011010273204213022263 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.9 icheck-0.9.7/CExpr/Assign/.arch-ids/ShiftRight.pm.id0000644000175000017500000000011110273204213022447 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.10 icheck-0.9.7/CExpr/Assign/.arch-ids/BitXor.pm.id0000644000175000017500000000011010273204213021602 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.5 icheck-0.9.7/CExpr/Assign/.arch-ids/=id0000644000175000017500000000011010273204213020056 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.1 icheck-0.9.7/CExpr/Assign/.arch-ids/Divide.pm.id0000644000175000017500000000011010273204213021577 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.6 icheck-0.9.7/CExpr/Assign/ShiftLeft.pm0000644000175000017500000000174510273204213020137 0ustar asuffieldasuffieldpackage CExpr::Assign::ShiftLeft; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left <<= $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left + $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Assign/ShiftRight.pm0000644000175000017500000000174610273204213020323 0ustar asuffieldasuffieldpackage CExpr::Assign::ShiftRight; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left >>= $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left + $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Assign/Modulus.pm0000644000175000017500000000174210273204213017674 0ustar asuffieldasuffieldpackage CExpr::Assign::Modulus; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left %= $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left % $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Assign/BitAnd.pm0000644000175000017500000000174110273204213017404 0ustar asuffieldasuffieldpackage CExpr::Assign::BitAnd; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left &= $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left & $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Assign/BitXor.pm0000644000175000017500000000174110273204213017452 0ustar asuffieldasuffieldpackage CExpr::Assign::BitXor; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left ^= $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left ^ $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Assign/BitOr.pm0000644000175000017500000000174010273204213017261 0ustar asuffieldasuffieldpackage CExpr::Assign::BitOr; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left |= $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left | $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Assign/Divide.pm0000644000175000017500000000174110273204213017447 0ustar asuffieldasuffieldpackage CExpr::Assign::Divide; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left /= $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left / $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Assign/Subtract.pm0000644000175000017500000000174310273204213020034 0ustar asuffieldasuffieldpackage CExpr::Assign::Subtract; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left -= $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left + $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Sizeof.pm0000644000175000017500000000154310273204213016256 0ustar asuffieldasuffieldpackage CExpr::Sizeof; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $type = shift; my $self = {type => $type, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $type = $self->{type}->dump_c; return "sizeof($type)"; } sub compute { my $self = shift; my $bits = $self->{type}->width; # Round up if ($bits % 8 == 0) { return $bits / 8; } else { return ($bits / 8) + 1; } } sub get_refs { my $self = shift; return ($self->{type}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{type}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/.arch-ids/0000755000175000017500000000000010273204213016226 5ustar asuffieldasuffieldicheck-0.9.7/CExpr/.arch-ids/BitAnd.pm.id0000644000175000017500000000011110273204213020311 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.12 icheck-0.9.7/CExpr/.arch-ids/Add.pm.id0000644000175000017500000000011010273204213017637 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:21 2005 28703.0 icheck-0.9.7/CExpr/.arch-ids/Multiply.pm.id0000644000175000017500000000011010273204213020766 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:21 2005 28703.4 icheck-0.9.7/CExpr/.arch-ids/Integer.pm.id0000644000175000017500000000011010273204213020544 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:21 2005 28703.2 icheck-0.9.7/CExpr/.arch-ids/Modulus.pm.id0000644000175000017500000000011010273204213020577 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:21 2005 28703.3 icheck-0.9.7/CExpr/.arch-ids/Ref.pm.id0000644000175000017500000000010710273204213017671 0ustar asuffieldasuffieldAndrew Suffield Sun Mar 13 05:29:19 2005 7691.2 icheck-0.9.7/CExpr/.arch-ids/BitOr.pm.id0000644000175000017500000000011110273204213020167 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.13 icheck-0.9.7/CExpr/.arch-ids/Predec.pm.id0000644000175000017500000000011110273204213020352 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.29 icheck-0.9.7/CExpr/.arch-ids/BoolOr.pm.id0000644000175000017500000000011110273204213020344 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.16 icheck-0.9.7/CExpr/.arch-ids/Conditional.pm.id0000644000175000017500000000011110273204213021413 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.18 icheck-0.9.7/CExpr/.arch-ids/Subtract.pm.id0000644000175000017500000000011010273204213020736 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:22 2005 28703.6 icheck-0.9.7/CExpr/.arch-ids/Preinc.pm.id0000644000175000017500000000011110273204213020370 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.30 icheck-0.9.7/CExpr/.arch-ids/MemberIndirect.pm.id0000644000175000017500000000011110273204213022041 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.25 icheck-0.9.7/CExpr/.arch-ids/ShiftLeft.pm.id0000644000175000017500000000011110273204213021040 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.32 icheck-0.9.7/CExpr/.arch-ids/ShiftRight.pm.id0000644000175000017500000000011110273204213021223 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.33 icheck-0.9.7/CExpr/.arch-ids/BitXor.pm.id0000644000175000017500000000011110273204213020357 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.14 icheck-0.9.7/CExpr/.arch-ids/ArraySubscript.pm.id0000644000175000017500000000011010273204213022124 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.0 icheck-0.9.7/CExpr/.arch-ids/SizeofExpr.pm.id0000644000175000017500000000011110273204213021246 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.34 icheck-0.9.7/CExpr/.arch-ids/Member.pm.id0000644000175000017500000000011110273204213020357 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.24 icheck-0.9.7/CExpr/.arch-ids/Equal.pm.id0000644000175000017500000000011110273204213020217 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.19 icheck-0.9.7/CExpr/.arch-ids/Alignof.pm.id0000644000175000017500000000011010273204213020526 0ustar asuffieldasuffieldAndrew Suffield Sun Mar 13 06:46:07 2005 10244.0 icheck-0.9.7/CExpr/.arch-ids/GreaterEqual.pm.id0000644000175000017500000000011110273204213021531 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.21 icheck-0.9.7/CExpr/.arch-ids/NotEqual.pm.id0000644000175000017500000000011110273204213020700 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.26 icheck-0.9.7/CExpr/.arch-ids/Postinc.pm.id0000644000175000017500000000011110273204213020567 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.28 icheck-0.9.7/CExpr/.arch-ids/Greater.pm.id0000644000175000017500000000011110273204213020541 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.20 icheck-0.9.7/CExpr/.arch-ids/Cast.pm.id0000644000175000017500000000011110273204213020042 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.17 icheck-0.9.7/CExpr/.arch-ids/Postdec.pm.id0000644000175000017500000000011110273204213020551 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.27 icheck-0.9.7/CExpr/.arch-ids/=id0000644000175000017500000000011010273204213016632 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:20 2005 28700.1 icheck-0.9.7/CExpr/.arch-ids/Divide.pm.id0000644000175000017500000000011010273204213020353 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:21 2005 28703.1 icheck-0.9.7/CExpr/.arch-ids/BoolAnd.pm.id0000644000175000017500000000011110273204213020466 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.15 icheck-0.9.7/CExpr/.arch-ids/LessEqual.pm.id0000644000175000017500000000011110273204213021046 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.23 icheck-0.9.7/CExpr/.arch-ids/SeqExpression.pm.id0000644000175000017500000000011110273204213021760 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.31 icheck-0.9.7/CExpr/.arch-ids/Less.pm.id0000644000175000017500000000011110273204213020056 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.22 icheck-0.9.7/CExpr/.arch-ids/Sizeof.pm.id0000644000175000017500000000011010273204213020406 0ustar asuffieldasuffieldAndrew Suffield Tue Mar 8 17:46:21 2005 28703.5 icheck-0.9.7/CExpr/Less.pm0000644000175000017500000000172610273204213015730 0ustar asuffieldasuffieldpackage CExpr::Less; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left < $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left < $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/ShiftLeft.pm0000644000175000017500000000173510273204213016712 0ustar asuffieldasuffieldpackage CExpr::ShiftLeft; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left << $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left << $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/BoolOr.pm0000644000175000017500000000173210273204213016213 0ustar asuffieldasuffieldpackage CExpr::BoolOr; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left || $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left || $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/LessEqual.pm0000644000175000017500000000173510273204213016720 0ustar asuffieldasuffieldpackage CExpr::LessEqual; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left <= $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left <= $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/SizeofExpr.pm0000644000175000017500000000120410273204213017107 0ustar asuffieldasuffieldpackage CExpr::SizeofExpr; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "(sizeof $arg)"; } sub get_refs { my $self = shift; return ($self->{arg}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{arg}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/ArraySubscript.pm0000644000175000017500000000150710273204213017774 0ustar asuffieldasuffieldpackage CExpr::ArraySubscript; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left)[$right]"; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Greater.pm0000644000175000017500000000173110273204213016407 0ustar asuffieldasuffieldpackage CExpr::Greater; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left > $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left > $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Preinc.pm0000644000175000017500000000134210273204213016234 0ustar asuffieldasuffieldpackage CExpr::Preinc; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "++($arg)"; } sub compute { my $self = shift; my $arg = $self->{arg}->compute; return $arg + 1; } sub get_refs { my $self = shift; return ($self->{arg}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{arg}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Postinc.pm0000644000175000017500000000134310273204213016434 0ustar asuffieldasuffieldpackage CExpr::Postinc; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "($arg)++"; } sub compute { my $self = shift; my $arg = $self->{arg}->compute; return $arg + 1; } sub get_refs { my $self = shift; return ($self->{arg}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{arg}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/ShiftRight.pm0000644000175000017500000000173610273204213017076 0ustar asuffieldasuffieldpackage CExpr::ShiftRight; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left >> $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left >> $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Modulus.pm0000644000175000017500000000173110273204213016446 0ustar asuffieldasuffieldpackage CExpr::Modulus; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left % $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left % $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Unary/0000755000175000017500000000000010273204213015554 5ustar asuffieldasuffieldicheck-0.9.7/CExpr/Unary/Positive.pm0000644000175000017500000000134710273204213017721 0ustar asuffieldasuffieldpackage CExpr::Unary::Positive; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "+($arg)"; } sub compute { my $self = shift; my $arg = $self->{arg}->compute; return +$arg; } sub get_refs { my $self = shift; return ($self->{arg}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{arg}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Unary/Negative.pm0000644000175000017500000000134710273204213017661 0ustar asuffieldasuffieldpackage CExpr::Unary::Negative; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "-($arg)"; } sub compute { my $self = shift; my $arg = $self->{arg}->compute; return -$arg; } sub get_refs { my $self = shift; return ($self->{arg}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{arg}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Unary/.arch-ids/0000755000175000017500000000000010273204213017324 5ustar asuffieldasuffieldicheck-0.9.7/CExpr/Unary/.arch-ids/BitNot.pm.id0000644000175000017500000000011110273204213021445 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.37 icheck-0.9.7/CExpr/Unary/.arch-ids/BoolNot.pm.id0000644000175000017500000000011110273204213021622 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.38 icheck-0.9.7/CExpr/Unary/.arch-ids/AddressOf.pm.id0000644000175000017500000000011110273204213022120 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.36 icheck-0.9.7/CExpr/Unary/.arch-ids/Positive.pm.id0000644000175000017500000000011110273204213022050 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.41 icheck-0.9.7/CExpr/Unary/.arch-ids/=id0000644000175000017500000000011110273204213017731 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.35 icheck-0.9.7/CExpr/Unary/.arch-ids/Negative.pm.id0000644000175000017500000000011110273204213022010 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.40 icheck-0.9.7/CExpr/Unary/.arch-ids/Deref.pm.id0000644000175000017500000000011110273204213021273 0ustar asuffieldasuffieldAndrew Suffield Sat Mar 12 15:14:21 2005 19321.39 icheck-0.9.7/CExpr/Unary/AddressOf.pm0000644000175000017500000000120410273204213017761 0ustar asuffieldasuffieldpackage CExpr::Unary::AddressOf; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "&($arg)"; } sub get_refs { my $self = shift; return ($self->{arg}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{arg}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Unary/BitNot.pm0000644000175000017500000000134510273204213017314 0ustar asuffieldasuffieldpackage CExpr::Unary::BitNot; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "~($arg)"; } sub compute { my $self = shift; my $arg = $self->{arg}->compute; return ~$arg; } sub get_refs { my $self = shift; return ($self->{arg}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{arg}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Unary/BoolNot.pm0000644000175000017500000000134610273204213017472 0ustar asuffieldasuffieldpackage CExpr::Unary::BoolNot; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "!($arg)"; } sub compute { my $self = shift; my $arg = $self->{arg}->compute; return !$arg; } sub get_refs { my $self = shift; return ($self->{arg}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{arg}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Unary/Deref.pm0000644000175000017500000000120010273204213017130 0ustar asuffieldasuffieldpackage CExpr::Unary::Deref; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "*($arg)"; } sub get_refs { my $self = shift; return ($self->{arg}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{arg}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Member.pm0000644000175000017500000000133610273204213016226 0ustar asuffieldasuffieldpackage CExpr::Member; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $member = shift; my $self = {arg => $arg, member => $member, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; my $member = $self->{member}; return "($arg).$member"; } sub get_refs { my $self = shift; return ($self->{arg}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{arg}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/BitAnd.pm0000644000175000017500000000173010273204213016156 0ustar asuffieldasuffieldpackage CExpr::BitAnd; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left & $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left & $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Cast.pm0000644000175000017500000000405010273204213015705 0ustar asuffieldasuffieldpackage CExpr::Cast; use 5.6.0; use strict; use warnings; use CExpr; use Math::BigInt; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $type = shift; my $arg = shift; my $self = {type => $type, arg => $arg, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $type = $self->{type}->dump_c; my $arg = $self->{arg}->dump_c; return "($type)($arg)"; } sub compute { my $self = shift; my $arg = $self->{arg}->compute; my $type = $self->{type}; if ($type->isa('CType::Fundamental::Bool')) { return $arg ? 1 : 0; } if ($type->can_represent($arg)) { return $arg; } if ($type->nature eq 'int') { unless ($type->signed) { return $arg & $type->max_value; } # Converting to signed. This is gcc-specific, and quite # painful # First, we strip away the excess bits my $mask = Math::BigInt->bone(); $mask <<= $type->width; $mask--; my $v = $arg & $mask; # Now, it's been forced unsigned by the &, so we have to # reinterpret as a two's-complement signed integer # We need to know what the highest bit in the type is my $highest_bit = Math::BigInt->bone(); $highest_bit <<= $type->width - 1; if ($v & $highest_bit) { # This should be negative. First take the two's # complement, to get the positive value $v->bxor($mask); $v->binc; # Then negate it $v->bneg; } return $v; } die; } sub get_refs { my $self = shift; return ($self->{type}->get_refs, $self->{arg}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{type}->layout($accept_incomplete, $namespace); $self->{arg}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/BitXor.pm0000644000175000017500000000173010273204213016224 0ustar asuffieldasuffieldpackage CExpr::BitXor; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left ^ $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left ^ $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Alignof.pm0000644000175000017500000000166010273271261016405 0ustar asuffieldasuffieldpackage CExpr::Alignof; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $type = shift; my $self = {type => $type, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $type = $self->{type}->dump_c; return "__alignof__($type)"; } sub type { my $self = shift; return $self->{type}; } sub compute { my $self = shift; my $bits = $self->{type}->alignment; # Round up if ($bits % 8 == 0) { return $bits / 8; } else { return ($bits / 8) + 1; } } sub get_refs { my $self = shift; return ($self->{type}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{type}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/GreaterEqual.pm0000644000175000017500000000174010273204213017377 0ustar asuffieldasuffieldpackage CExpr::GreaterEqual; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left >= $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left >= $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Ref.pm0000644000175000017500000000304510273204213015532 0ustar asuffieldasuffieldpackage CExpr::Ref; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $name = shift; my $self = {name => $name, }; bless $self, $class; return $self; } sub kind { return 'ordinary'; } sub name { my $self = shift; return $self->{name}; } sub dump_c { my $self = shift; return $self->{name}; } sub compute { my $self = shift; return $self->{value}->compute; } sub get_refs { my $self = shift; return ($self); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $accept_incomplete = 0; my $data = $namespace->get($self->kind, $self->name); die "Identifier $self->{name} is unknown" unless $data; if ($data->isa('CType::Enum')) { # Whoops, this enum hasn't been laid out yet. Try it now. $data->layout(0, $namespace); $data = $namespace->get($self->kind, $self->name); # If we still haven't got it, then this identifier must be # defined later in the enum, so that's an error. if ($data->isa('CType::Enum')) { die "Identifier $self->{name} is not defined yet"; } } if ($data->isa('CDecl')) { # NYI die; } elsif ($data->isa('CDecl::Enumerator')) { $self->{value} = $data->value; } else { die "Unhandled value type " . ref $data; } } 1; icheck-0.9.7/CExpr/BitOr.pm0000644000175000017500000000172710273204213016042 0ustar asuffieldasuffieldpackage CExpr::BitOr; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left | $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left | $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Postdec.pm0000644000175000017500000000134310273204213016416 0ustar asuffieldasuffieldpackage CExpr::Postdec; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "($arg)--"; } sub compute { my $self = shift; my $arg = $self->{arg}->compute; return $arg - 1; } sub get_refs { my $self = shift; return ($self->{arg}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{arg}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Predec.pm0000644000175000017500000000134210273204213016216 0ustar asuffieldasuffieldpackage CExpr::Predec; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $arg = shift; my $self = {arg => $arg, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $arg = $self->{arg}->dump_c; return "--($arg)"; } sub compute { my $self = shift; my $arg = $self->{arg}->compute; return $arg - 1; } sub get_refs { my $self = shift; return ($self->{arg}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{arg}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Divide.pm0000644000175000017500000000173010273204213016221 0ustar asuffieldasuffieldpackage CExpr::Divide; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left / $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left / $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Subtract.pm0000644000175000017500000000173210273204213016606 0ustar asuffieldasuffieldpackage CExpr::Subtract; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left - $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left - $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1; icheck-0.9.7/CExpr/Equal.pm0000644000175000017500000000173110273204213016065 0ustar asuffieldasuffieldpackage CExpr::Equal; use 5.6.0; use strict; use warnings; use CExpr; our @ISA = qw/CExpr/; sub new { my $this = shift; my $class = ref($this) || $this; my $left = shift; my $right = shift; my $self = {left => $left, right => $right, }; bless $self, $class; return $self; } sub dump_c { my $self = shift; my $left = $self->{left}->dump_c; my $right = $self->{right}->dump_c; return "($left == $right)"; } sub compute { my $self = shift; my $left = $self->{left}->compute; my $right = $self->{right}->compute; return $left == $right; } sub get_refs { my $self = shift; return ($self->{left}->get_refs, $self->{right}->get_refs); } sub layout { my $self = shift; my $accept_incomplete = shift; my $namespace = shift; $self->{left}->layout($accept_incomplete, $namespace); $self->{right}->layout($accept_incomplete, $namespace); } 1;