linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Américo Wang" <xiyou.wangcong@gmail.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-kernel@vger.kernel.org, Michal Marek <mmarek@suse.cz>,
	linux-kbuild@vger.kernel.org
Subject: Re: tags: include headers before source files
Date: Mon, 8 Feb 2010 00:13:11 +0800	[thread overview]
Message-ID: <20100207161311.GB17447@hack> (raw)
In-Reply-To: <Pine.LNX.4.64.1002031704550.6324@axis700.grange>

On Wed, Feb 03, 2010 at 05:25:27PM +0100, Guennadi Liakhovetski wrote:
>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.

This is a good idea!

>
>Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>


Besides what Michal mentioned, this patch looks fine for me too.

Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>

Thanks.

>---
>
>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/tags.sh b/scripts/tags.sh
>index 1a0c44d..b84ce1c 100755
>--- a/scripts/tags.sh
>+++ b/scripts/tags.sh
>@@ -32,13 +32,18 @@ fi
> # find sources in arch/$ARCH
> find_arch_sources()
> {
>-	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_arch_include_sources()
> {
>-	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()
> 
> all_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]'
> 	fi
> 	find_include_sources '*.[chS]'
>+	for arch in $ALLSOURCE_ARCHS
>+	do
>+		find_sources $arch '*.[chS]'
>+	done
> 	find_other_sources '*.[chS]'
> }
> 
>--
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/

-- 
Live like a child, think like the god.
 

      parent reply	other threads:[~2010-02-07 16:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-03 16:25 tags: include headers before source files Guennadi Liakhovetski
2010-02-05 21:59 ` Michal Marek
2010-02-07 23:25   ` [PATCH v2] " Guennadi Liakhovetski
2010-02-17 13:05     ` Michal Marek
2010-02-07 16:13 ` Américo Wang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100207161311.GB17447@hack \
    --to=xiyou.wangcong@gmail.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).