On Apr 24, 2011, at 9:28 AM, Shigio YAMAGUCHI wrote:
Jean-Marc Saffroy said:
Unfortunately there is still a lot of old K&R code lying around. To
me, it
would be a pity if global dropped support for K&R.
Ezolt, Phillip said:
Ouch. Yeah... we don't want to do that. I think we need k&r support.
OK. I won't stop the support of K&R.
Ok.. Ok. How about THIS rule.. (if this even possible?)
If we see a semicolon, AND then we see an open paren BEFORE we see
an open b=
race, we know the token before the paren is a function and the
previous func=
tion is complete?
That would catch this:
A() bob;
int foo() <=3D=3D=3D=3D this paren means the previous symbol is
complete
{
}
...
But not k and r:
A(bar)
int bar;
{
}
It seems not to be able to handle the following K&R example:
int sort(v, n, cmp)
char *v[];
int n;
int (*cmp)();
{
...
}
Function pointers. Drat.
How about this:
...
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)
Original example: ('foo' matches)
----------------
A() bob;
int foo()
{ <== ') {' means that we're dealing with a new symbol.
}
K & R: ('cmp' DOESN'T since there is a ';' in between)
------
A(cmp)
int (*cmp)();
{
}
......
NOTE: This rule would also properly catch ANOTHER bug that we have but
haven't reported yet...
(A is a macro, and 'foo' isn't being reported.)
...
"
A()
int foo() { ... }
"
--
Shigio YAMAGUCHI <[email protected]>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663 C4B6 3CA5 BBB3 57BE DDA3
Cheers,
--Phil
_______________________________________________
Bug-global mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-global