diff mbox

scripts: Have make TAGS not include structure members

Message ID 20131115093645.6dc03918@gandalf.local.home (mailing list archive)
State New, archived
Headers show

Commit Message

Steven Rostedt Nov. 15, 2013, 2:36 p.m. UTC
It is really annoying when I use emacs TAGS to search for something
like "dev_name" and have to go through 12 iterations before I find the
function "dev_name". I really do not care about structures that include
"dev_name" as one of its fields, and I'm sure pretty much all other
developers do not care either.

There's a "remove_structs" variable used by the scripts/tags.sh, which
I'm guessing is suppose to remove these structures from the TAGS file,
but it must do a poor job at it, as I'm always hitting structures when
I want the actual declaration.

Luckily, the etags and ctags program comes with an option
"--no-members", which does exactly what I want, and I'm sure all other
kernel developers want too.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Stephen Boyd Nov. 16, 2013, 1:02 a.m. UTC | #1
On 11/15/13 06:36, Steven Rostedt wrote:
> diff --git a/scripts/tags.sh b/scripts/tags.sh
> index 74f02e4..b985371 100755
> --- a/scripts/tags.sh
> +++ b/scripts/tags.sh
> @@ -218,7 +218,7 @@ exuberant()
>  
>  emacs()
>  {
> -	all_target_sources | xargs $1 -a                        \
> +	all_target_sources | xargs $1 -a --no-members           \
>  	--regex='/^\(ENTRY\|_GLOBAL\)(\([^)]*\)).*/\2/'         \
>  	--regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/'   \
>  	--regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/'		\
> @@ -248,13 +248,13 @@ emacs()
>  	--regex='/PCI_OP_READ(\([a-z]*[a-z]\).*[1-4])/pci_bus_read_config_\1/' \
>  	--regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/'
>  
> -	all_kconfigs | xargs $1 -a                              \
> +	all_kconfigs | xargs $1 -a --no-members                 \
>  	--regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'
>  
> -	all_kconfigs | xargs $1 -a                              \
> +	all_kconfigs | xargs $1 -a --no-members                 \
>  	--regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/CONFIG_\3/'
>  
> -	all_defconfigs | xargs -r $1 -a                         \
> +	all_defconfigs | xargs -r $1 -a --no-members            \
>  	--regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'
>  }
>  

Does it actually matter for the kconfigs and defconfigs?
Geert Uytterhoeven Nov. 17, 2013, 9:14 a.m. UTC | #2
On Fri, Nov 15, 2013 at 3:36 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> It is really annoying when I use emacs TAGS to search for something
> like "dev_name" and have to go through 12 iterations before I find the
> function "dev_name". I really do not care about structures that include
> "dev_name" as one of its fields, and I'm sure pretty much all other
> developers do not care either.

While I'm also annoyed by this (although with vim/tags), I regularly do search
for struct members, so losing this ability would hurt, too.

Is there a solution, without throwing out the baby with the bath water?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steven Rostedt Nov. 17, 2013, 2:27 p.m. UTC | #3
On Sun, 17 Nov 2013 10:14:46 +0100
Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> On Fri, Nov 15, 2013 at 3:36 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> > It is really annoying when I use emacs TAGS to search for something
> > like "dev_name" and have to go through 12 iterations before I find the
> > function "dev_name". I really do not care about structures that include
> > "dev_name" as one of its fields, and I'm sure pretty much all other
> > developers do not care either.
> 
> While I'm also annoyed by this (although with vim/tags), I regularly do search
> for struct members, so losing this ability would hurt, too.
> 
> Is there a solution, without throwing out the baby with the bath water?
> 

Or perhaps make it only do it for TAGS. vim gives you a list of
locations that you can go to, and even marks if it is a member of a
structure or a function or whatever. With emacs, you have to iterate
over each location. That is, with my devname example, I had to hit M^.
then Ctrl^U M^. another 12 times before I got to the function name.
It makes it absolutely worthless, that after two or three misses, I
give up and just grep for it.

I don't think there's a single emacs users that would not like this
change.

Thus, I'll make it for emacs only, and I think that will be a good
compromise.

-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Geert Uytterhoeven Nov. 17, 2013, 3:19 p.m. UTC | #4
On Sun, Nov 17, 2013 at 3:27 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
>> On Fri, Nov 15, 2013 at 3:36 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
>> > It is really annoying when I use emacs TAGS to search for something
>> > like "dev_name" and have to go through 12 iterations before I find the
>> > function "dev_name". I really do not care about structures that include
>> > "dev_name" as one of its fields, and I'm sure pretty much all other
>> > developers do not care either.
>>
>> While I'm also annoyed by this (although with vim/tags), I regularly do search
>> for struct members, so losing this ability would hurt, too.
>>
>> Is there a solution, without throwing out the baby with the bath water?
>>
>
> Or perhaps make it only do it for TAGS. vim gives you a list of
> locations that you can go to, and even marks if it is a member of a
> structure or a function or whatever. With emacs, you have to iterate
> over each location. That is, with my devname example, I had to hit M^.
> then Ctrl^U M^. another 12 times before I got to the function name.
> It makes it absolutely worthless, that after two or three misses, I
> give up and just grep for it.

Thanks! Now I have to look into my vim setup, why it doesn't do the
above...

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steven Rostedt Nov. 17, 2013, 5:08 p.m. UTC | #5
On Sun, 17 Nov 2013 16:19:53 +0100
Geert Uytterhoeven <geert@linux-m68k.org> wrote:

 
> Thanks! Now I have to look into my vim setup, why it doesn't do the
> above...
> 

$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Sep 11 2013 12:28:07)

And from the ctags man pages, I did:

:ta dev_name

and it gave me a list of tags.

  # pri kind tag               file
  1 F   m    dev_name          drivers/clk/samsung/clk.h
               struct:samsung_clock_alias
               const char  *dev_name;
  2 F   m    dev_name          drivers/clk/samsung/clk.h
               struct:samsung_div_clock
               const char  *dev_name;
  3 F   m    dev_name          drivers/clk/samsung/clk.h
               struct:samsung_gate_clock
               const char  *dev_name;
  4 F   m    dev_name          drivers/clk/samsung/clk.h
               struct:samsung_mux_clock
               const char  *dev_name;
  5 F   m    dev_name          drivers/clk/samsung/clk.h
               struct:samsung_pll_clock
               const char  *dev_name;
  6 F   m    dev_name          drivers/edac/edac_core.h
               struct:edac_device_ctl_info
               const char *dev_name; /* pci/platform/etc... name */
  7 F   m    dev_name          drivers/edac/edac_core.h
               struct:edac_pci_ctl_info
               const char *dev_name; /* pci/platform/etc... name */
  8 F   m    dev_name          drivers/infiniband/hw/cxgb3/cxio_hal.h
               struct:cxio_rdev
               char dev_name[T3_MAX_DEV_NAME_LEN];
  9 F   m    dev_name          drivers/pinctrl/core.h
               struct:pinctrl_setting
               const char *dev_name;
 10 F   m    dev_name          drivers/scsi/dpt/dpti_i2o.h
               struct:i2o_device
               char dev_name[8];  /* linux /dev name if available */
 11 F   v    dev_name          drivers/target/target_core_stat.c
               DEV_STAT_SCSI_TRANSPORT_ATTR_RO(dev_name);
 12 F   m    dev_name          drivers/video/cyber2000fb.h
               struct:cyberpro_info
               char  dev_name[32];
 13 F   m    dev_name          drivers/video/sticore.h
               struct:sti_conf_outptr
               u8 dev_name[STI_DEV_NAME_LENGTH]; /* null terminated product name */
 14 F   m    dev_name          include/linux/device.h
               struct:bus_type
               const char  *dev_name;
 15 F   f    dev_name          include/linux/device.h
               static inline const char *dev_name(const struct device *dev)
 16 F   m    dev_name          include/linux/edac.h
               struct:mem_ctl_info
               const char *dev_name;
 17 F   m    dev_name          include/linux/mfd/ti_ssp.h
               struct:ti_ssp_dev_data
               const char *dev_name;
 18 F   m    dev_name          include/linux/netpoll.h
               struct:netpoll
               char dev_name[IFNAMSIZ];
 19 F   m    dev_name          include/linux/omap-dma.h
               struct:omap_dma_lch
               const char *dev_name;
 20 F   m    dev_name          include/linux/phy/phy.h
               struct:phy_consumer
               const char *dev_name;
 21 F   m    dev_name          include/linux/pinctrl/machine.h
               struct:pinctrl_map
               const char *dev_name;
 22 F   m    dev_name          include/linux/regulator/machine.h
               struct:regulator_consumer_supply
-- More --



-- Steve

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andrew Morton Nov. 19, 2013, 11:59 p.m. UTC | #6
On Sun, 17 Nov 2013 10:14:46 +0100 Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> On Fri, Nov 15, 2013 at 3:36 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> > It is really annoying when I use emacs TAGS to search for something
> > like "dev_name" and have to go through 12 iterations before I find the
> > function "dev_name". I really do not care about structures that include
> > "dev_name" as one of its fields, and I'm sure pretty much all other
> > developers do not care either.
> 
> While I'm also annoyed by this (although with vim/tags), I regularly do search
> for struct members, so losing this ability would hurt, too.

metoo.

> Is there a solution, without throwing out the baby with the bath water?

Remove the tags for those struct members whose name duplicates some
other symbol?
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steven Rostedt Nov. 20, 2013, 12:04 a.m. UTC | #7
On Tue, 19 Nov 2013 15:59:07 -0800
Andrew Morton <akpm@linux-foundation.org> wrote:

> On Sun, 17 Nov 2013 10:14:46 +0100 Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> 
> > On Fri, Nov 15, 2013 at 3:36 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> > > It is really annoying when I use emacs TAGS to search for something
> > > like "dev_name" and have to go through 12 iterations before I find the
> > > function "dev_name". I really do not care about structures that include
> > > "dev_name" as one of its fields, and I'm sure pretty much all other
> > > developers do not care either.
> > 
> > While I'm also annoyed by this (although with vim/tags), I regularly do search
> > for struct members, so losing this ability would hurt, too.
> 
> metoo.

You're a vim user too. Do I hear any complaints about removing it just
for emacs users?

> 
> > Is there a solution, without throwing out the baby with the bath water?
> 
> Remove the tags for those struct members whose name duplicates some
> other symbol?

For vim, I could write a perl script that could do that.

-- Steve

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andrew Morton Nov. 20, 2013, 12:08 a.m. UTC | #8
On Tue, 19 Nov 2013 19:04:26 -0500 Steven Rostedt <rostedt@goodmis.org> wrote:

> On Tue, 19 Nov 2013 15:59:07 -0800
> Andrew Morton <akpm@linux-foundation.org> wrote:
> 
> > On Sun, 17 Nov 2013 10:14:46 +0100 Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > 
> > > On Fri, Nov 15, 2013 at 3:36 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> > > > It is really annoying when I use emacs TAGS to search for something
> > > > like "dev_name" and have to go through 12 iterations before I find the
> > > > function "dev_name". I really do not care about structures that include
> > > > "dev_name" as one of its fields, and I'm sure pretty much all other
> > > > developers do not care either.
> > > 
> > > While I'm also annoyed by this (although with vim/tags), I regularly do search
> > > for struct members, so losing this ability would hurt, too.
> > 
> > metoo.
> 
> You're a vim user too.

You really don't wanna know what I use ;)

> Do I hear any complaints about removing it just
> for emacs users?

Probably not, as only 0.0001% of them are reading this thread :(

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steven Rostedt Nov. 20, 2013, 12:14 a.m. UTC | #9
On Tue, 19 Nov 2013 16:08:55 -0800
Andrew Morton <akpm@linux-foundation.org> wrote:


> > Do I hear any complaints about removing it just
> > for emacs users?
> 
> Probably not, as only 0.0001% of them are reading this thread :(

Then I'm guessing that the answer is to just do it for emacs users.
That way, if anyone uses this feature, they will complain then :-)

The worse we can do is to just revert it, as this isn't something like
a user ABI or anything.

-- Steve

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Boyd Nov. 20, 2013, 12:18 a.m. UTC | #10
On 11/19/13 16:14, Steven Rostedt wrote:
> On Tue, 19 Nov 2013 16:08:55 -0800
> Andrew Morton <akpm@linux-foundation.org> wrote:
>
>
>>> Do I hear any complaints about removing it just
>>> for emacs users?
>> Probably not, as only 0.0001% of them are reading this thread :(
> Then I'm guessing that the answer is to just do it for emacs users.
> That way, if anyone uses this feature, they will complain then :-)
>
> The worse we can do is to just revert it, as this isn't something like
> a user ABI or anything.

I didn't have exuberant-ctags installed so 'make tags' was building the
emacs tag file as 'tags' and vim was using it just fine. Please note
that you may be affecting vim users with this change if they haven't
installed exuberant-ctags.
Geert Uytterhoeven Nov. 20, 2013, 8:29 a.m. UTC | #11
On Sun, Nov 17, 2013 at 6:08 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> On Sun, 17 Nov 2013 16:19:53 +0100
> Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
>> Thanks! Now I have to look into my vim setup, why it doesn't do the
>> above...
>
> $ vim --version
> VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Sep 11 2013 12:28:07)

I have 7.3.

> And from the ctags man pages, I did:
>
> :ta dev_name
>
> and it gave me a list of tags.

Not for me.

>   # pri kind tag               file
>   1 F   m    dev_name          drivers/clk/samsung/clk.h
>                struct:samsung_clock_alias
>                const char  *dev_name;

I do remember seeing such a list on a different machine, though.

However,  this encouraged me to dive into some docs.
":ts <tag>" (or just ":ts" after a previous ":ta") does give me the list.
 The same for "g CTRL-]" instead of plain "CTRL-]", so I'm happy now ;-)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/scripts/tags.sh b/scripts/tags.sh
index 74f02e4..b985371 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -218,7 +218,7 @@  exuberant()
 
 emacs()
 {
-	all_target_sources | xargs $1 -a                        \
+	all_target_sources | xargs $1 -a --no-members           \
 	--regex='/^\(ENTRY\|_GLOBAL\)(\([^)]*\)).*/\2/'         \
 	--regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/'   \
 	--regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/'		\
@@ -248,13 +248,13 @@  emacs()
 	--regex='/PCI_OP_READ(\([a-z]*[a-z]\).*[1-4])/pci_bus_read_config_\1/' \
 	--regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/'
 
-	all_kconfigs | xargs $1 -a                              \
+	all_kconfigs | xargs $1 -a --no-members                 \
 	--regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'
 
-	all_kconfigs | xargs $1 -a                              \
+	all_kconfigs | xargs $1 -a --no-members                 \
 	--regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/CONFIG_\3/'
 
-	all_defconfigs | xargs -r $1 -a                         \
+	all_defconfigs | xargs -r $1 -a --no-members            \
 	--regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'
 }