blob: d447c4bd6d49cc0d5ce65fb233e4d2bf7d621d2c [file] [log] [blame]
Martin Rothf7906722016-04-06 16:32:37 -06001#!/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
17LC_ALL=C export LC_ALL
18
19INCLUDED_DIRS='^src/\|^util/\|payloads/libpayload\|payloads/coreinfo'
Elyes HAOUAS8297fa12020-02-22 10:37:49 +010020EXCLUDED_DIRS='^src/vendorcode\|cbfstool/lzma\|cbfstool/lz4'
Martin Rothf7906722016-04-06 16:32:37 -060021INCLUDED_FILES='\.[ch]:'
22
23# Use git grep if the code is in a git repo, otherwise use grep.
Alex Thiessen73f19dc2018-01-16 23:05:48 +000024if [ -n "$(command -v git)" ] && \
25 [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]
26then
Martin Rothf7906722016-04-06 16:32:37 -060027 GREP_FILES="git grep -n"
28else
29 GREP_FILES="grep -rn"
30fi
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:]]*\*'