12 'logical-source-line-length' => 509,
15 'logical-source-line-length' => 4095,
23 GetOptions(\%opt, qw( logical-source-line-length=i std=s ))
24 && @ARGV && exists $limits{$opt{std}}
27 for my $k (keys %{$limits{$opt{std}}}) {
28 $opt{$k} //= $limits{$opt{std}}{$k};
37 my $info = join '', @_;
41 $info =~ s/^/ #|\t/mg;
42 $info = "\n$info\n\n";
45 warn sprintf "[%d] %s(%d): %s\n%s",
46 $num++, $File::Find::name, $., $msg, $info;
51 /\.([ch]|xs)$/ or return;
53 my $fh = IO::File->new($_) or die "$_: $!\n";
56 while (defined(my $line = <$fh>)) {
57 report("trailing whitespace after backslash", $line)
58 if $line =~ /\\[[:blank:]]+$/;
62 unless ($ll =~ /\\$/) {
63 if (length $ll > $opt{'logical-source-line-length'}) {
64 report(sprintf("logical source line too long (%d > %d)",
65 length $ll, $opt{'logical-source-line-length'}), $ll);
76 checkansi.pl - Check source code for ANSI-C violations
80 checkansi.pl [B<--std>=c90|c99]
81 [B<--logical-source-line-length>=I<num>]
86 B<checkansi.pl> searches
92 =item B<--std>=c90|c99
94 Choose the ANSI/ISO standard against which shall be checked.
97 =item B<--logical-source-line-length>=I<number>
99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.