aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-03-21 20:55:33 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:01:29 -0700
commitabae88c8e3ae1a4493805bd8b471bb77f472fd37 (patch)
tree4d5de714bf87dcd2b4ed273b6d8247d1a37a99dc /expression.h
parentMake it possible to look up multiple namespaces at once (diff)
downloadsparse-abae88c8e3ae1a4493805bd8b471bb77f472fd37.tar.gz
sparse-abae88c8e3ae1a4493805bd8b471bb77f472fd37.tar.bz2
sparse-abae88c8e3ae1a4493805bd8b471bb77f472fd37.zip
Use the "look up multiple namespaces" facility
to look up types. This makes up get the proper nesting characteristics in case you mix typedefs and regular symbols with the same name.
Diffstat (limited to 'expression.h')
-rw-r--r--expression.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/expression.h b/expression.h
index 935d23a..8516ff8 100644
--- a/expression.h
+++ b/expression.h
@@ -151,8 +151,10 @@ struct token *typename(struct token *, struct symbol **);
static inline int lookup_type(struct token *token)
{
- if (token->pos.type == TOKEN_IDENT)
- return lookup_symbol(token->ident, NS_TYPEDEF) != NULL;
+ if (token->pos.type == TOKEN_IDENT) {
+ struct symbol *sym = lookup_symbol(token->ident, NS_SYMBOL | NS_TYPEDEF);
+ return sym && sym->namespace == NS_TYPEDEF;
+ }
return 0;
}