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