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