* tags: include headers before source files
@ 2010-02-03 16:25 Guennadi Liakhovetski
2010-02-05 21:59 ` Michal Marek
2010-02-07 16:13 ` Américo Wang
0 siblings, 2 replies; 5+ messages in thread
From: Guennadi Liakhovetski @ 2010-02-03 16:25 UTC (permalink / raw)
To: linux-kernel; +Cc: Michal Marek, linux-kbuild
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 <g.liakhovetski@gmx.de>
---
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]'
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: tags: include headers before source files
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-07 16:13 ` Américo Wang
1 sibling, 1 reply; 5+ messages in thread
From: Michal Marek @ 2010-02-05 21:59 UTC (permalink / raw)
To: Guennadi Liakhovetski; +Cc: linux-kernel, linux-kbuild
On 3.2.2010 17:25, 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.
Hi Guennadi
This is a cool idea, but there is one issue:
> # 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;
You need to check if $include isn't empty, which it is on i386 or x86_64
(and on other archs where $ARCH != $SRCARCH). If I do a 'make cscope'
after your change, the second find statement crawls the whole filesystem.
Michal
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: tags: include headers before source files
2010-02-03 16:25 tags: include headers before source files Guennadi Liakhovetski
2010-02-05 21:59 ` Michal Marek
@ 2010-02-07 16:13 ` Américo Wang
1 sibling, 0 replies; 5+ messages in thread
From: Américo Wang @ 2010-02-07 16:13 UTC (permalink / raw)
To: Guennadi Liakhovetski; +Cc: linux-kernel, Michal Marek, linux-kbuild
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] tags: include headers before source files
2010-02-05 21:59 ` Michal Marek
@ 2010-02-07 23:25 ` Guennadi Liakhovetski
2010-02-17 13:05 ` Michal Marek
0 siblings, 1 reply; 5+ messages in thread
From: Guennadi Liakhovetski @ 2010-02-07 23:25 UTC (permalink / raw)
To: Michal Marek; +Cc: linux-kernel, linux-kbuild
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 <g.liakhovetski@gmx.de>
Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
---
v1 -> v2:
1. check if $include variable is not empty - thanks, Michal, for testing
diff --git a/scripts/tags.sh b/scripts/tags.sh
index 1a0c44d..6f0985d 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -32,13 +32,20 @@ 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);
+ if [ -n "$include" ]; then
+ archincludedir+="$include "
+ find $include $ignore -name "$2" -print;
+ fi
}
# find sources in include/
@@ -63,14 +70,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]'
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] tags: include headers before source files
2010-02-07 23:25 ` [PATCH v2] " Guennadi Liakhovetski
@ 2010-02-17 13:05 ` Michal Marek
0 siblings, 0 replies; 5+ messages in thread
From: Michal Marek @ 2010-02-17 13:05 UTC (permalink / raw)
To: Guennadi Liakhovetski; +Cc: linux-kernel, linux-kbuild
On 8.2.2010 00:25, 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.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
> ---
>
> v1 -> v2:
>
> 1. check if $include variable is not empty - thanks, Michal, for testing
Thanks, applied with the following change added (+= is a bash extension):
diff --git a/scripts/tags.sh b/scripts/tags.sh
index 6f0985d..c122041 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -33,7 +33,7 @@ fi
find_arch_sources()
{
for i in $archincludedir; do
- prune+="-wholename $i -prune -o "
+ prune="$prune -wholename $i -prune -o"
done
find ${tree}arch/$1 $ignore $prune -name "$2" -print;
}
@@ -43,7 +43,7 @@ find_arch_include_sources()
{
include=$(find ${tree}arch/$1/ -name include -type d);
if [ -n "$include" ]; then
- archincludedir+="$include "
+ archincludedir="$archincludedir $include"
find $include $ignore -name "$2" -print;
fi
}
Michal
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-02-17 13:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).