* [PATCH] Improve error message if using a member of an incomplete struct or union
@ 2007-06-05 22:01 Pavel Roskin
2007-06-09 7:26 ` Josh Triplett
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Roskin @ 2007-06-05 22:01 UTC (permalink / raw)
To: linux-sparse
sparse should distinguish two cases. One is when the structure or union
is declared and the member is not found. Another is when the structure
or union is not yet declared. In the later case, the message should
indicate that the type is incomplete, rather than complain that the
particular member is not found.
Mention the incomplete type like gcc does, but provide the member name
too, it may be useful.
Signed-off-by: Pavel Roskin <proski@gnu.org>
---
evaluate.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/evaluate.c b/evaluate.c
index 80ac7d1..f68b55e 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -1723,8 +1723,13 @@ static struct symbol *evaluate_member_dereference(struct expression *expr)
name = ctype->ident->name;
namelen = ctype->ident->len;
}
- expression_error(expr, "no member '%s' in %s %.*s",
- show_ident(ident), type, namelen, name);
+ if (ctype->symbol_list)
+ expression_error(expr, "no member '%s' in %s %.*s",
+ show_ident(ident), type, namelen, name);
+ else
+ expression_error(expr, "using member '%s' in "
+ "incomplete %s %.*s", show_ident(ident),
+ type, namelen, name);
return NULL;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-06-09 7:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-05 22:01 [PATCH] Improve error message if using a member of an incomplete struct or union Pavel Roskin
2007-06-09 7:26 ` Josh Triplett
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.