[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: etags: function not indexed after macro

From: Eli Zaretskii
Subject: Re: etags: function not indexed after macro
Date: Sat, 13 May 2006 11:00:34 +0300

> Date: Fri, 12 May 2006 10:53:44 +0200
> From: Roman Pletka <address@hidden>
> I tried to index the following code with etags:
> #define DECLARE_TEST(name)      \
>         static int test_##name;
> 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


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

Thanks for reporting this.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]