Martin Roth | 0ad5fbd | 2020-12-24 12:06:38 -0700 | [diff] [blame] | 1 | #!/usr/bin/env sh |
Martin Roth | f790672 | 2016-04-06 16:32:37 -0600 | [diff] [blame] | 2 | # |
Patrick Georgi | 7333a11 | 2020-05-08 20:48:04 +0200 | [diff] [blame] | 3 | # SPDX-License-Identifier: GPL-2.0-only |
| 4 | |
Martin Roth | f790672 | 2016-04-06 16:32:37 -0600 | [diff] [blame] | 5 | # DESCR: Check that variables have fully qualified types |
| 6 | |
| 7 | LC_ALL=C export LC_ALL |
| 8 | |
| 9 | INCLUDED_DIRS='^src/\|^util/\|payloads/libpayload\|payloads/coreinfo' |
Elyes HAOUAS | 8297fa1 | 2020-02-22 10:37:49 +0100 | [diff] [blame] | 10 | EXCLUDED_DIRS='^src/vendorcode\|cbfstool/lzma\|cbfstool/lz4' |
Martin Roth | f790672 | 2016-04-06 16:32:37 -0600 | [diff] [blame] | 11 | INCLUDED_FILES='\.[ch]:' |
| 12 | |
| 13 | # Use git grep if the code is in a git repo, otherwise use grep. |
Alex Thiessen | 73f19dc | 2018-01-16 23:05:48 +0000 | [diff] [blame] | 14 | if [ -n "$(command -v git)" ] && \ |
| 15 | [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ] |
| 16 | then |
Martin Roth | f790672 | 2016-04-06 16:32:37 -0600 | [diff] [blame] | 17 | GREP_FILES="git grep -n" |
| 18 | else |
| 19 | GREP_FILES="grep -rn" |
| 20 | fi |
| 21 | |
| 22 | ${GREP_FILES} 'unsigned[[:space:]]' | \ |
| 23 | grep "$INCLUDED_DIRS" | \ |
| 24 | grep -v "$EXCLUDED_DIRS" | \ |
| 25 | grep "$INCLUDED_FILES" | \ |
| 26 | grep -v 'unsigned[[:space:]]*int\|unsigned[[:space:]]*long\|unsigned[[:space:]]*char\|unsigned[[:space:]]*short' | \ |
| 27 | grep -v ':[[:space:]]*/\*\|:[[:space:]]*\*' |