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' |
Elyes HAOUAS | 8297fa1 | 2020-02-22 10:37:49 +0100 | [diff] [blame] | 20 | EXCLUDED_DIRS='^src/vendorcode\|cbfstool/lzma\|cbfstool/lz4' |
Martin Roth | f790672 | 2016-04-06 16:32:37 -0600 | [diff] [blame] | 21 | INCLUDED_FILES='\.[ch]:' |
| 22 | |
| 23 | # 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] | 24 | if [ -n "$(command -v git)" ] && \ |
| 25 | [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ] |
| 26 | then |
Martin Roth | f790672 | 2016-04-06 16:32:37 -0600 | [diff] [blame] | 27 | GREP_FILES="git grep -n" |
| 28 | else |
| 29 | GREP_FILES="grep -rn" |
| 30 | fi |
| 31 | |
| 32 | ${GREP_FILES} 'unsigned[[:space:]]' | \ |
| 33 | grep "$INCLUDED_DIRS" | \ |
| 34 | grep -v "$EXCLUDED_DIRS" | \ |
| 35 | grep "$INCLUDED_FILES" | \ |
| 36 | grep -v 'unsigned[[:space:]]*int\|unsigned[[:space:]]*long\|unsigned[[:space:]]*char\|unsigned[[:space:]]*short' | \ |
| 37 | grep -v ':[[:space:]]*/\*\|:[[:space:]]*\*' |