1 1.1 christos #! /bin/bash 2 1.1 christos # Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 1.1 christos # 4 1.1 christos # Licensed under the OpenSSL license (the "License"). You may not use 5 1.1 christos # this file except in compliance with the License. You can obtain a copy 6 1.1 christos # in the file LICENSE in the source distribution or at 7 1.1 christos # https://www.openssl.org/source/license.html 8 1.1 christos 9 1.1 christos # Find unused error function-names and reason-codes, and edit them 10 1.1 christos # out of the source. Doesn't handle line-wrapping, might have to do 11 1.1 christos # some manual cleanups to fix compile errors. 12 1.1 christos 13 1.1 christos export X1=/tmp/f.1.$$ 14 1.1 christos export X2=/tmp/f.2.$$ 15 1.1 christos 16 1.1 christos cd include/openssl || exit 1 17 1.1 christos grep '_[RF]_' * | awk '{print $3;}' | sort -u >$X1 18 1.1 christos cd ../.. 19 1.1 christos 20 1.1 christos for F in `cat $X1` ; do 21 1.1 christos git grep -l --full-name -F $F >$X2 22 1.1 christos NUM=`wc -l <$X2` 23 1.1 christos test $NUM -gt 2 && continue 24 1.1 christos if grep -q $F crypto/err/openssl.ec ; then 25 1.1 christos echo Possibly unused $F found in openssl.ec 26 1.1 christos continue 27 1.1 christos fi 28 1.1 christos echo $F 29 1.1 christos for FILE in `cat $X2` ; do 30 1.1 christos grep -v -w $F <$FILE >$FILE.new 31 1.1 christos mv $FILE.new $FILE 32 1.1 christos done 33 1.1 christos done 34 1.1 christos 35 1.1 christos rm $X1 $X2 36