[lkml]   [2010]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subjecttags: include headers before source files
Currently looking up a structure definition in TAGS / tags takes one to 
one of multiple "static struct X" definitions in arch sources, which makes
it for many structs practically impossible to get to the required header.
This patch changes the order of sources being tagged to first scan
architecture includes, then the top-level include/ directory, and only
then the rest. It also takes into account, that many architectures have
more than one include directory, i.e., not only arch/$ARCH/include, but
also arch/$ARCH/mach-X/include etc.

Signed-off-by: Guennadi Liakhovetski <>

I am no expert in Kbuild, so, please, review, comment, suggest
improvements, but at least, this does make TAGS usable for me.

diff --git a/scripts/ b/scripts/
index 1a0c44d..b84ce1c 100755
--- a/scripts/
+++ b/scripts/
@@ -32,13 +32,18 @@ fi
# find sources in arch/$ARCH
- find ${tree}arch/$1 $ignore -name "$2" -print;
+ for i in $archincludedir; do
+ prune+="-wholename $i -prune -o "
+ done
+ find ${tree}arch/$1 $ignore $prune -name "$2" -print;

# find sources in arch/$1/include
- find ${tree}arch/$1/include $ignore -name "$2" -print;
+ include=$(find ${tree}arch/$1/ -name include -type d);
+ archincludedir+=$include
+ find $include $ignore -name "$2" -print;

# find sources in include/
@@ -63,14 +68,15 @@ find_sources()

- for arch in $ALLSOURCE_ARCHS
- do
- find_sources $arch '*.[chS]'
- done
+ find_arch_include_sources $ARCH '*.[chS]'
if [ ! -z "$archinclude" ]; then
find_arch_include_sources $archinclude '*.[chS]'
find_include_sources '*.[chS]'
+ for arch in $ALLSOURCE_ARCHS
+ do
+ find_sources $arch '*.[chS]'
+ done
find_other_sources '*.[chS]'

 \ /
  Last update: 2010-02-03 17:27    [W:0.047 / U:1.744 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site