| # This is just a quick script to scan for cases where the 'error' |
| # function name in a XXXerr() macro is wrong. |
| # Run in the top level by going |
| # perl util/ck_errf.pl */*.c */*/*.c |
| open(IN,"<$file") || die "unable to open $file\n"; |
| if (!/;$/ && /^([a-zA-Z].*[\s*])?([A-Za-z_0-9]+)\(.*[),]/) |
| /^([^()]*(\([^()]*\)[^()]*)*)\(/; |
| $1 =~ /([A-Za-z_0-9]*)$/; |
| if (/([A-Z0-9]+)err\(([^,]+)/ && ! /ckerr_ignore/) |
| { print "$file:$.:???:$n\n"; $bad = 1; next; } |
| if ($n !~ /([^_]+)_F_(.+)$/) |
| # print "check -$file:$.:$func:$n\n"; |
| { print "$file:$.:$func:$n [${errlib}err]\n"; $bad = 1; next; } |
| if (($n ne $func) && ($errlib ne "SYS")) |
| { print "$file:$.:$func:$n\n"; $bad = 1; next; } |
| print STDERR "FATAL: error discrepancy\n"; |