Hello,
This is the present specification. The difference between
'foo' and 'foobar' is whether it has definitions or not.
At first, current C parser assumes varables as a reference.
[Source code] [Judgment]
struct foo(1) (1) definition
{
int n(2); (2) reference
};
struct foo(3) foo(4); (3) reference, (4) reference
struct foo(5) foobar(6); (5) reference, (6) reference
If a symbol has definitions and references,
it is treated as definitions and references.
$ global -x foo -d
foo 1 test.h struct foo
$ global -x foo -r
foo 5 test.h struct foo foo;
foo 6 test.h struct foo foobar;
If a symbol has only references, it is treated as 'other symbols'.
$ global -x foobar -s
foobar 6 test.h struct foo foobar;
[Treatment of variable definitions]
n(2), foo(4) and foobar(6) should be treated as a definition
originally. But in the current C parser, a variable definition
is treated as a reference.
Reason 1:
In source code reading, definition of function, macro, typedef,
struct, class, enum are important. On the other hand, variable
definition is not so important, because there isn't information
so much.
Reason 2:
It was difficult for me to recognize a variable definition.
I request someone to write a new parser on a different way of
thinking.
Regards,
Shigio