blob: 36422ab54725544df6c24b9def08d756b6af6b6c [file] [log] [blame]
Manuel Pégourié-Gonnard3385cf42015-04-02 17:59:30 +01001#!/bin/sh
2
3set -eu
4
5tmp/list-macros.sh
6tmp/list-enum-consts.pl
7tmp/list-identifiers.sh
8tmp/list-symbols.sh
9
10UNDECLARED=$( diff exported-symbols identifiers | sed -n -e 's/^< //p' )
11if [ "x$UNDECLARED" == "x" ]; then
12 echo "All exported symbols are declared in headers: good"
13else
14 echo "The following symbols are probably missing a 'static': $UNDECLARED"
15fi
16
17for 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
27done
28
29echo ''; echo "=== all public names ==="
30sort -u macros identifiers enum-consts > public-names
31wc -l public-names
32
33
34NL='
35'
36sed -n 's/POLARSSL_[A-Z0-9_]*/\'"$NL"'&\'"$NL"/gp \
Manuel Pégourié-Gonnardf7d945f2015-04-03 15:21:50 +020037 include/mbedtls/*.h tests/scripts/* scripts/* library/*.c configs/*.h \
Manuel Pégourié-Gonnard3385cf42015-04-02 17:59:30 +010038 | grep POLARSSL | sort -u > _POLARSSL_XXX
39diff public-names _POLARSSL_XXX | sed -n 's/^> //p' > extra-names
40rm _POLARSSL_XXX
41
42echo 'polarssl_zeroize' >> extra-names
43
44wc -l extra-names
45
46for 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
51done