device: Use pcidev_path_behind()
[coreboot.git] / util / lint / lint-stable-004-style-labels
blob698b22df7897416aa7e1bb6b1143f93ff240074e
1 #!/bin/sh
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" ]
23 then
24 FIND_FILES="git ls-files"
25 else
26 FIND_FILES="find src"
29 ${FIND_FILES} | \
30 grep "^src/.*\.[csS]$" | \
31 xargs grep -Hn '^[[:space:]][[:space:]]*[a-z][a-z]*:[[:space:]]*$' | \
32 grep -v "[^a-z_]default:"