X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=util%2Ffind-unused-errs;h=cd1026d5947c6c92a9ce033f171512fbac857a56;hp=d36789ef6f776a2aa1af085f62eda8875e5d6316;hb=4e049e2c3658ee2bc6e63e696a3779d2f9eed377;hpb=0cd0a820abc6124cf8e176fa92d620a2abf9e419;ds=sidebyside diff --git a/util/find-unused-errs b/util/find-unused-errs index d36789ef6f..cd1026d594 100755 --- a/util/find-unused-errs +++ b/util/find-unused-errs @@ -13,14 +13,37 @@ export X1=/tmp/f.1.$$ export X2=/tmp/f.2.$$ +case "$1" in + -f) + PAT='_F_' + echo Functions only + ;; + -[er]) + PAT='_R_' + echo Reason codes only + ;; + "") + PAT='_[FR]_' + echo Function and reasons + ;; + *) + echo "Usage error; one of -[efr] required." + exit 1; + ;; +esac + cd include/openssl || exit 1 -grep '_[RF]_' * | awk '{print $3;}' | sort -u >$X1 +grep "$PAT" * | grep -v ERR_FATAL_ERROR | awk '{print $3;}' | sort -u >$X1 cd ../.. for F in `cat $X1` ; do git grep -l --full-name -F $F >$X2 NUM=`wc -l <$X2` test $NUM -gt 2 && continue + if grep -q $F crypto/err/openssl.ec ; then + echo Possibly unused $F found in openssl.ec + continue + fi echo $F for FILE in `cat $X2` ; do grep -v -w $F <$FILE >$FILE.new