blob: 7b68b4ad6354a0740a968506362e7db81c6ae7c3 [file] [log] [blame]
Patrick Georgi533ec002012-03-07 15:49:07 +01001#!/bin/sh
2# This file is part of the coreboot project.
3#
4# Copyright (C) 2012 Patrick Georgi <patrick@georgi-clan.de>
Martin Rothe0330532016-03-30 13:56:23 -06005# Copyright (C) 2016 Google Inc.
Patrick Georgi533ec002012-03-07 15:49:07 +01006#
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.
10#
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.
15#
Patrick Georgi533ec002012-03-07 15:49:07 +010016# DESCR: Check that C labels begin at start-of-line
17
18LC_ALL=C export LC_ALL
Martin Rothe0330532016-03-30 13:56:23 -060019
20# Use git ls-files if the code is in a git repo, otherwise use find.
21if [ -n "$(command -v git)" ] && [ -d .git ]; then
22 FIND_FILES="git ls-files"
23else
24 FIND_FILES="find src"
25fi
26
27${FIND_FILES} | \
28 grep "^src/.*\.[csS]$" | \
29 xargs grep -Hn '^[[:space:]][[:space:]]*[a-z][a-z]*:[[:space:]]*$' | \
30 grep -v "[^a-z_]default:"