2 # Find Kconfig variables used in source code but never defined in Kconfig
3 # Copyright (C) 2007, Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
7 [ -z "$paths" ] && paths
=.
9 # Doing this once at the beginning saves a lot of time, on a cache-hot tree.
10 Kconfigs
="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`"
12 /bin
/echo -e "File list \tundefined symbol used"
13 find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'|
while read i
15 # Output the bare Kconfig variable and the filename; the _MODULE part at
16 # the end is not removed here (would need perl an not-hungry regexp for that).
17 sed -ne 's!^.*\<\(UML_\)\?CONFIG_\([0-9A-Za-z_]\+\).*!\2 '$i'!p' < $i
19 # Smart "sort|uniq" implemented in awk and tuned to collect the names of all
20 # files which use a given symbol
21 awk '{map[$1, count[$1]++] = $2; }
23 for (combIdx in map) {
24 split(combIdx, separate, SUBSEP);
25 # The value may have been removed.
26 if (! ( (separate[1], separate[2]) in map ) )
30 #Use gawk extension to delete the names vector
32 #Portably delete the names vector
34 for (i=0; i < count[symb]; i++) {
35 names[map[symb, i]] = 1;
36 # Unfortunately, we may still encounter symb, i in the
51 while read symb files
; do
52 # Remove the _MODULE suffix when checking the variable name. This should
53 # be done only on tristate symbols, actually, but Kconfig parsing is
54 # beyond the purpose of this script.
55 symb_bare
=`echo $symb | sed -e 's/_MODULE//'`
56 if ! grep -q "\<$symb_bare\>" $Kconfigs; then
57 /bin
/echo -e "$files: \t$symb"
This page took 0.03305 seconds and 5 git commands to generate.