Manuel Pégourié-Gonnard | 3385cf4 | 2015-04-02 17:59:30 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | set -eu |
| 4 | |
| 5 | tmp/list-macros.sh |
| 6 | tmp/list-enum-consts.pl |
| 7 | tmp/list-identifiers.sh |
| 8 | tmp/list-symbols.sh |
| 9 | |
| 10 | UNDECLARED=$( diff exported-symbols identifiers | sed -n -e 's/^< //p' ) |
| 11 | if [ "x$UNDECLARED" == "x" ]; then |
| 12 | echo "All exported symbols are declared in headers: good" |
| 13 | else |
| 14 | echo "The following symbols are probably missing a 'static': $UNDECLARED" |
| 15 | fi |
| 16 | |
| 17 | for THING in macros identifiers enum-consts; do |
| 18 | echo '' |
| 19 | echo "=== $THING ===" |
| 20 | |
| 21 | NO_=$( grep -v _ $THING | tr '\n' ' ' ) |
| 22 | echo "Without underscore: $NO_" |
| 23 | |
| 24 | cut -f1 -d_ $THING | uniq -c | sort -nr > prefix-$THING |
| 25 | echo "By prefix: (10 most frequent, see prefix-$THING for full list)" |
| 26 | head -n 10 < prefix-$THING |
| 27 | done |
| 28 | |
| 29 | echo ''; echo "=== all public names ===" |
| 30 | sort -u macros identifiers enum-consts > public-names |
| 31 | wc -l public-names |
| 32 | |
| 33 | |
| 34 | NL=' |
| 35 | ' |
| 36 | sed -n 's/POLARSSL_[A-Z0-9_]*/\'"$NL"'&\'"$NL"/gp \ |
Manuel Pégourié-Gonnard | f7d945f | 2015-04-03 15:21:50 +0200 | [diff] [blame^] | 37 | include/mbedtls/*.h tests/scripts/* scripts/* library/*.c configs/*.h \ |
Manuel Pégourié-Gonnard | 3385cf4 | 2015-04-02 17:59:30 +0100 | [diff] [blame] | 38 | | grep POLARSSL | sort -u > _POLARSSL_XXX |
| 39 | diff public-names _POLARSSL_XXX | sed -n 's/^> //p' > extra-names |
| 40 | rm _POLARSSL_XXX |
| 41 | |
| 42 | echo 'polarssl_zeroize' >> extra-names |
| 43 | |
| 44 | wc -l extra-names |
| 45 | |
| 46 | for THING in public-names extra-names; do |
| 47 | if grep '[^A-Za-z0-9_]' $THING; then |
| 48 | echo "invalid character in $THING" >&2 |
| 49 | exit 1; |
| 50 | fi |
| 51 | done |