2 # This file is part of the coreboot project.
4 # Copyright (C) 2012 Patrick Georgi <patrick@georgi-clan.de>
5 # Copyright (C) 2016 Google Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; version 2 of the License.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # DESCR: Check that C labels begin at start-of-line
18 LC_ALL
=C
export LC_ALL
20 # Use git ls-files if the code is in a git repo, otherwise use find.
21 if [ -n "$(command -v git)" ] && \
22 [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]
24 FIND_FILES
="git ls-files"
30 grep "^src/.*\.[csS]$" | \
31 xargs grep -Hn '^[[:space:]][[:space:]]*[a-z][a-z]*:[[:space:]]*$' | \
32 grep -v "[^a-z_]default:"