blob: e51e8ddf085cbf37141f682ceb3ca87d07115936 [file] [log] [blame]
Patrick Georgie85e0c7c2010-11-12 09:46:30 +00001#!/bin/sh
Patrick Georgie8826302010-11-19 10:16:43 +00002# This file is part of the coreboot project.
3#
4# Copyright (C) 2010 coresystems GmbH
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#
Patrick Georgie8826302010-11-19 10:16:43 +000015# DESCR: Check that no symbol #defined in any romstage.c is used elsewhere
16
Patrick Georgie85e0c7c2010-11-12 09:46:30 +000017DEFINES=`grep "#define" src/mainboard/*/*/romstage.c |sed 's,.*#define[\t ]\([^\t ]*\)[\t ].*,\1,' | grep -v "(" | sort -u`
Zheng Bao533bca82012-09-28 19:38:37 +080018SCANBUCKET=`mktemp .tmpconfig.lint001XXXXX`
Patrick Georgi558362f2010-11-18 14:33:02 +000019LC_ALL=C export LC_ALL
20find src -name .svn -type d -prune -o -name mainboard -type d -prune -o -name examples -type d -prune -o -type f -exec sed -nf `dirname $0`/remccoms3.sed {} + > $SCANBUCKET
Patrick Georgi472efa62012-02-16 20:44:20 +010021
Patrick Georgie85e0c7c2010-11-12 09:46:30 +000022for define in $DEFINES; do
23 if [ `egrep -c "([^_A-Za-z0-9]$define[^_A-Za-z0-9]|^$define[^_A-Za-z0-9]|[^_A-Za-z0-9]$define\$)" $SCANBUCKET` -gt 0 ]; then
24 echo "$define is defined in mainboard(s) and used elsewhere"
25 fi
26done
27
28rm -f $SCANBUCKET