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


2016-03-13 2:13 GMT+09:00 Jacek Migacz <[email protected]>:

> I've observed undesired behavior with variable named exactly as it's type
> (w/o struct keyword).
>
> For given source:
>
> struct foo
> {
>     int n;
> };
>
> struct foo foo;
> struct foo foobar;
>
> global -s foo
> ^ returns nothing
>
> global -s foobar
> ^ returns correct location
>
> I'm using global-6.5.1(1.fc23).
>
> --
> Jacek Migacz
>
> _______________________________________________
> Bug-global mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/bug-global
>
>


-- 
Shigio YAMAGUCHI <[email protected]>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3
_______________________________________________
Bug-global mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-global

Reply via email to