2 # Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the OpenSSL license (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
9 # This is just a quick script to scan for cases where the 'error'
10 # function name in a XXXerr() macro is wrong.
12 # Run in the top level by going
13 # perl util/ck_errf.pl */*.c */*/*.c
22 foreach my $file (@ARGV) {
23 if ( $file eq "-strict" ) {
27 open( IN, "<$file" ) || die "Can't open $file, $!";
30 if ( !/;$/ && /^\**([a-zA-Z_].*[\s*])?([A-Za-z_0-9]+)\(.*([),]|$)/ ) {
31 /^([^()]*(\([^()]*\)[^()]*)*)\(/;
32 $1 =~ /([A-Za-z_0-9]*)$/;
36 if ( /([A-Z0-9]+)err\(([^,]+)/ && !/ckerr_ignore/ ) {
41 print "$file:$.:???:$n\n";
46 if ( $n !~ /([^_]+)_F_(.+)$/ ) {
47 #print "check -$file:$.:$func:$n\n";
53 if ( $lib ne $errlib ) {
54 print "$file:$.:$func:$n [${errlib}err]\n";
60 if ( $n ne $func && $errlib ne "SYS" ) {
61 print "$file:$.:$func:$n\n";
72 if ( $bad && $err_strict ) {
73 print STDERR "FATAL: error discrepancy\n";