unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* etags: function not indexed after macro
@ 2006-05-12  8:53 Roman Pletka
  2006-05-13  8:00 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Roman Pletka @ 2006-05-12  8:53 UTC (permalink / raw)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I tried to index the following code with etags:

#define DECLARE_TEST(name)      \
        static int test_##name;

DECLARE_TEST(var)



void my_func(int i) {
        test_var = i;
}

void my_func2(int j) {
        test_var = j;
}


It looks like etags does not create an entry for the my_func function because
the closing semicolon is in the definition of the macro. I am using etags that
comes with GNU Emacs 21.4 (Debian emacs21 21.4a-3). I tried the same code with
cscope and there it works.

Best regards,
Roman Pletka


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFEZE0Y9GOBmbEdi04RAvUyAKDJ27k3wdlPhN4/zHq9a+fP/KknzgCfYLC1
mSKquH6hzoWMf0LRXzvL/14=
=Tizo
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: etags: function not indexed after macro
  2006-05-12  8:53 etags: function not indexed after macro Roman Pletka
@ 2006-05-13  8:00 ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2006-05-13  8:00 UTC (permalink / raw)
  Cc: bug-gnu-emacs, Francesco Potorti`

> Date: Fri, 12 May 2006 10:53:44 +0200
> From: Roman Pletka <rap@zurich.ibm.com>
> 
> I tried to index the following code with etags:
> 
> #define DECLARE_TEST(name)      \
>         static int test_##name;
> 
> DECLARE_TEST(var)
> 
> 
> 
> void my_func(int i) {
>         test_var = i;
> }
> 
> void my_func2(int j) {
>         test_var = j;
> }
> 
> 
> It looks like etags does not create an entry for the my_func function because
> the closing semicolon is in the definition of the macro.

I think it's not because of the semicolon in the macro definition,
it's because the macro _invocation_ looks like a beginning of a
function (whose name is DECLARE_TEST), and thus etags regards the
definition of my_func as part of that function's body.

You can work around this by moving the semicolon from the macro
definition to its invocation:

    #define DECLARE_TEST(name)      \
	    static int test_##name

    DECLARE_TEST(var);

Which IMO is better C style anyway, and will probably help you
elsewhere, like with Emacs syntax highlighting and indentation.

> I am using etags that comes with GNU Emacs 21.4 (Debian emacs21
> 21.4a-3).

The same problem exists in the current development sources.  I don't
know if this can be easily fixed, but I cc Francesco who is the etags
maintainer.

Thanks for reporting this.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: etags: function not indexed after macro
@ 2006-05-23 11:11 Francesco Potorti`
  0 siblings, 0 replies; 3+ messages in thread
From: Francesco Potorti` @ 2006-05-23 11:11 UTC (permalink / raw)
  Cc: bug-gnu-emacs

Dear Roman,

the etags bug that you signaled:

>#define DECLARE_TEST(name)      \
>        static int test_##name;
>
>DECLARE_TEST(var)
>
>
>
>void my_func(int i) {
>        test_var = i;
>}
>
>void my_func2(int j) {
>        test_var = j;
>}
>
>
>It looks like etags does not create an entry for the my_func function because
>the closing semicolon is in the definition of the macro. I am using etags that
>comes with GNU Emacs 21.4 (Debian emacs21 21.4a-3). I tried the same code with
>cscope and there it works.

as Eli Zaretskii correctly explains, has an easy and recommended
workaround.

I will try nonetheless to correct the bug, but I am not sure if this can
be done, because of the way the etags parser is implemented.  Do you
have any strong reasons why you should use this style

================
   #define DECLARE_TEST(name) static int test_##name;
   
   DECLARE_TEST(var)
================

rather than this style?

================
   #define DECLARE_TEST(name) static int test_##name
   
   DECLARE_TEST(var);
================

Thank for your bug report, and please try to answer my question.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-05-23 11:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-12  8:53 etags: function not indexed after macro Roman Pletka
2006-05-13  8:00 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2006-05-23 11:11 Francesco Potorti`

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).