Martin Roth | f790672 | 2016-04-06 16:32:37 -0600 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # This file is part of the coreboot project. |
| 3 | # |
| 4 | # Copyright (C) 2016 Google Inc. |
| 5 | # |
| 6 | # This program is free software; you can redistribute it and/or modify |
| 7 | # it under the terms of the GNU General Public License as published by |
| 8 | # the Free Software Foundation; version 2 of the License. |
| 9 | # |
| 10 | # This program is distributed in the hope that it will be useful, |
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | # GNU General Public License for more details. |
| 14 | # |
| 15 | # DESCR: Check that variables have fully qualified types |
| 16 | |
| 17 | LC_ALL=C export LC_ALL |
| 18 | |
| 19 | INCLUDED_DIRS='^src/\|^util/\|payloads/libpayload\|payloads/coreinfo' |
| 20 | EXCLUDED_DIRS='^src/vendorcode\|^util/romcc\|cbfstool/lzma\|cbfstool/lz4' |
| 21 | INCLUDED_FILES='\.[ch]:' |
| 22 | |
| 23 | # Use git grep if the code is in a git repo, otherwise use grep. |
| 24 | if [ -n "$(command -v git)" ] && [ -d .git ]; then |
| 25 | GREP_FILES="git grep -n" |
| 26 | else |
| 27 | GREP_FILES="grep -rn" |
| 28 | fi |
| 29 | |
| 30 | ${GREP_FILES} 'unsigned[[:space:]]' | \ |
| 31 | grep "$INCLUDED_DIRS" | \ |
| 32 | grep -v "$EXCLUDED_DIRS" | \ |
| 33 | grep "$INCLUDED_FILES" | \ |
| 34 | grep -v 'unsigned[[:space:]]*int\|unsigned[[:space:]]*long\|unsigned[[:space:]]*char\|unsigned[[:space:]]*short' | \ |
| 35 | grep -v ':[[:space:]]*/\*\|:[[:space:]]*\*' |