GNU bug report logs -
#28403
25.2; find-tag works, but xref-find-definitions doesn't; bug?
Previous Next
Reported by: Winston <wbe <at> psr.com>
Date: Sat, 9 Sep 2017 22:41:02 UTC
Severity: normal
Found in version 25.2
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> Date: Sun, 10 Sep 2017 14:27 EDT
> From: Winston <wbe <at> psr.com>
> Cc: dgutov <at> yandex.ru, 28403 <at> debbugs.gnu.org
>
> Eli kindly replied:
> > Could you please post a complete example of the code in question,
> > including the definition of the _ARGS1 macro, and any other macros and
> > typedefs that would make the example stand-alone? I think I
> > understand what has happened, but I'd like to be sure before we decide
> > what to do about it.
>
> Sure (well, it's a semi-complete example). [...]
Thanks, this confirms my suspicion: as Dmitry says, etags produces
TAGS for the _ARG# macros, and doesn't see the function names. So the
fact that find-tag finds the functions is just sheer luck: it falls
back to more or less simple text search, so it can find anything you
have in the TAGS tables.
To have xref-find-definitions work in this case, you need to help
etags a bit, see below.
> > [The new xref function] is already better in several areas:
>
> I noticed that, and I liked seeing the list of matches when there's >1,
> rather than having to do {arg} find-tag, possibly repeatedly, when the
> one find-tag finds first isn't the one I wanted. However, if the basic
> find wasn't going to work, or was going to have a lot of false positives,
> then I'd stick with find-tag, which has generally worked well (almost no
> wrong matches, but it helps that my code tries to have all function
> names in all files be unique, even when they're static, so there's
> rarely >1 match).
Again, it seems to work well in your case because you take special
precautions to avoid producing symbols that would generate false
positives. But that is a fragile solution, IMO.
> > It is even possible that, given the details I requested above, I will
> > be able to help you get your use case working with xref, so please
> > don't give up on xref, not just yet.
>
> I haven't. :)
Good, because here's how I suggest you invoke etags to solve the
problems with the _ARGS# macros:
etags --regex="/[ \t]*\([^ \t]+\)[ \t]+_ARGS/\1/" ...
(replace "..." with all the other arguments you normally give when you
invoke etags). This will tell etags to tag the symbols immediately
preceding the _ARGS# macro invocations _in_addition_ to what it
already does. Then you can use xref-find-definitions in its default
configuration, and it will find your functions.
(The --regexp switch to etags is described in the Emacs manual.)
This bug report was last modified 7 years and 253 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.