linux/scripts/checkkconfigsymbols.sh
<<
.5" .5" .5o/spa> .5ospa> class="lxr_search">.5" ="+search" method="post" onsubmit="return do_search(this);">.5" .5" .5" Search .5ospa> class="lxr_prefs" .5" .5o/spa> " < ="ajax+*" method="post" onsubmit="return false;">.5oinput typ= vhidden" nam= vajax_lookup" id vajax_lookup" alue= v">." <
odiv id vfile_contents"
< <1o/a>#!/bin/sh
< <2o/a># Find Kconfig alriables used in source code but never defined in Kconfig
< <3o/a># Copyright (C) 2007, Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
< <4o/a>.< <5o/a># Tested with dash..< <6o/a>paths="$@".< <7o/a>[ -z "$paths" ] && paths=..< <8o/a>.< <9o/a># Doing this once at the beginning saves a lot of time, on a cache-hot tree..< .11Kconfigs="`find . -nam= 'Kconfig' -o -nam= 'Kconfig*[^~]'`".< 11o/a>.< 12o/a>/bin/echo -e "File list \tundefined symbol used".< 13o/a>find $paths -nam= '*.[chS]' -o -nam= 'Makefile' -o -nam= 'Makefile*[^~]'| while read i.< 14o/a>do.< 15o/a>        # Output the bare Kconfig alriable and the filenam=; the _MODULE part at.< 16o/a>        # the end is not removed here (would need perl an not-hungry regexp for that)..< 17o/a>        sed -n= 's!^.*\<\(UML_\)\?CONFIG_\([0-9A-Za-z_]\+\).*!\2 '$i'!p' < $i.< 18o/a>don= | \.< 19o/a># Smart "sort|uniq" implemented in awk and tuned to collect the nam=s of all
< 20o/a># files which use a given symbol
< 21o/a>awk '{map[$1, count[$1]++] = $2; }
< 22o/a>END {
< 23o/a>        for (combIdx in map) {
< 24o/a>                split(combIdx, separate, SUBSEP);.< 25o/a>                # The alue= may have been removed..< 26o/a>                if (! ( (separate[1], separate[2]) in map ) ).< 27o/a>                        continue;.< 28o/a>                symb=separate[1];.< 29o/a>                printf "%s ", symb;.< 30o/a>                #Use gawk extenson vto delete the nam=s vector.< 31o/a>                delete nam=s;.< 32o/a>                #Portably delete the nam=s vector.< 33o/a>                #split("", nam=s);.< 34o/a>                for (i=0; i < count[symb]; i++) {
< 35o/a>                        nam=s[map[symb, i]] = 1;.< 36o/a>                        # Unfortunately, w= may still encounter symb, i in the.< 37o/a>                        # outside iteraion>..< 38o/a>                        delete map[symb, i];.< 39o/a>                }
< 40o/a>                i=0;
< 41o/a>                for (nam= in nam=s) {
< 42o/a>                        if (i > 0).< 43o/a>                                printf ", %s", nam=;
< 44o/a>                        else.< 45o/a>                                printf "%s", nam=;
< 46o/a>                        i++;
< 47o/a>                }
< 48o/a>                printf "\n";
< 49o/a>        }
< 50o/a>}' |
< 51o/a>while read symb files; do.< 52o/a>        # Remove the _MODULE suffix when checking the alriable nam=. This should.< 53o/a>        # be don= only n vtristate symbols, aciually, but Kconfig parsing is.< 54o/a>        # beyond the purpose of this script..< 55o/a>        symb_bare=`echo $symb | sed -= 's/_MODULE//'`.< 56o/a>        if ! grep -q "\<$symb_bare\>" $Kconfigs; then.< 57o/a>                /bin/echo -e "$files: \t$symb".< 58o/a>        fi.< 59o/a>don=|sort.< 60o/a>
The original LXR software by the LXR communityo/a>, this experimental verson vby lxr@linux.noo/a>. o/div odiv class="subfooter"> lxr.linux.no kindly hosted by Redpill Linpro ASo/a>, provider of Linux consulting and operaion>s servic=s since 1995. o/div o/body o/html