On Wed, 2007-06-27 at 08:51 +0200, Thomas Schmid wrote:
> > My interpretation of the code is following. Types may have idents,
> > which keep information where and how the type was defined. Base types
> > don't have idents.
>
> But unfortunately they get one.
I understand it better now. Suppose we have:
typedef struct {int a;} foo;
int main(int argc, char **argv)
{
foo bar;
bar.x = 1;
}
The structure is indeed unnamed. If the error message is going to call
the _structure_ by name, it's correct to call it unnamed.
One possible fix would be to have an "inherited ident", which would be
set only by that code in external_declaration(). This would leave basic
types alone.
Then we need to come with a message that would be printed if only the
inherited ident is present. gcc prints:
test.c:5: error: 'foo' has no member named 'x'
No "struct" is mentioned. If we want to be more verbose, we could print
something like:
test.c:5:5: error: no member 'x' in struct type foo
Another solution would be to remove the ident setting code and try to
find the typedef name directly in evaluate_member_dereference().
--
Regards,
Pavel Roskin
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html