Manuel Pégourié-Gonnard | 3385cf4 | 2015-04-02 17:59:30 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | set -eu |
| 4 | |
Manuel Pégourié-Gonnard | d1ddd29 | 2015-04-09 10:15:10 +0200 | [diff] [blame] | 5 | if [ -d include/mbedtls ]; then :; else |
| 6 | echo "$0: must be run from root" >&2 |
| 7 | exit 1 |
| 8 | fi |
| 9 | |
Manuel Pégourié-Gonnard | e137ea6 | 2015-04-09 10:47:44 +0200 | [diff] [blame] | 10 | HEADERS=$( ls include/mbedtls/*.h | egrep -v 'compat-1\.3\.h|bn_mul' ) |
Manuel Pégourié-Gonnard | 3385cf4 | 2015-04-02 17:59:30 +0100 | [diff] [blame] | 11 | |
| 12 | rm -f identifiers |
| 13 | |
| 14 | grep '^[^ /#{]' $HEADERS | \ |
| 15 | sed -e 's/^[^:]*://' | \ |
| 16 | egrep -v '^(extern "C"|(typedef )?(struct|enum)( {)?$|};?$)' \ |
| 17 | > _decls |
| 18 | |
| 19 | if true; then |
| 20 | sed -n -e 's/.* \**\([a-zA-Z_][a-zA-Z0-9_]*\)(.*/\1/p' \ |
| 21 | -e 's/.*(\*\(.*\))(.*/\1/p' _decls |
| 22 | grep -v '(' _decls | sed -e 's/\([a-zA-Z0-9_]*\)[;[].*/\1/' -e 's/.* \**//' |
| 23 | fi > _identifiers |
| 24 | |
| 25 | if [ $( wc -l < _identifiers ) -eq $( wc -l < _decls ) ]; then |
| 26 | rm _decls |
| 27 | egrep -v '^(u?int(16|32|64)_t)$' _identifiers | sort > identifiers |
| 28 | rm _identifiers |
| 29 | else |
Manuel Pégourié-Gonnard | d1ddd29 | 2015-04-09 10:15:10 +0200 | [diff] [blame] | 30 | echo "$0: oops, lost some identifiers" 2>&1 |
Manuel Pégourié-Gonnard | 3385cf4 | 2015-04-02 17:59:30 +0100 | [diff] [blame] | 31 | exit 1 |
| 32 | fi |
| 33 | |
| 34 | wc -l identifiers |