bug-global
[Top][All Lists]
Advanced

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

Re: With a wacky macro before it, 'global' appears to miss a function


From: Shigio YAMAGUCHI
Subject: Re: With a wacky macro before it, 'global' appears to miss a function
Date: Tue, 26 Apr 2011 21:44:14 +0900

> If we see a ')' followed by an '{'  (with any number white space in  
> between... but NO ';'), we have
> a new symbol that we're dealing with.  (NOTE: This rule could ONLY be  
> applied if we're NOT currently in a {} block)

For this issue, it seems that complex rules complicate the problem
more and more. Because, using macros, programmers can make many things
which look like function declaration. It is difficult for us to treat
all of them.

Another proposal:
How about using ./.notfunction file? (This facility is undocumented.)

If you invoke gtags command with the following files.

[.notfunction]
+----------------------------
|STRUCT_DEF_MACRO                                                   <==

[test.c]
        +-------------------------------------------------------
     1  |#define STRUCT_DEF_MACRO(name, type)    \
     2  |struct name {                           \
     3  |        struct type *first;             \
     4  |}
     5  |
     6  |STRUCT_DEF_MACRO(my_struct, int) struct_instance_name;     <==
     7  |
     8  |void test_func(long dummy1, long dummy2)
     9  |{
    10  |
    11  |}


1. WITH .notfunction file

$ global -f main.c
STRUCT_DEF_MACRO    1 test.c           #define STRUCT_DEF_MACRO(name, type)    \
name                2 test.c           struct name {                           \
test_func           8 test.c           void test_func(long dummy1, long dummy2)

2. WITHOUT .notfunction file

$ global -f main.c
STRUCT_DEF_MACRO    1 test.c           #define STRUCT_DEF_MACRO(name, type)    \
name                2 test.c           struct name {                           \
STRUCT_DEF_MACRO    6 test.c           STRUCT_DEF_MACRO(my_struct, int) 
struct_instance_name;

It also works well with the following example:

A()
int foo() { ... }       

However, it is necessary to make .function file by hand. :<
--
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3



reply via email to

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