aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/show-parse.c
diff options
authorLinus Torvalds <torvalds@penguin.transmeta.com>2003-03-25 16:32:24 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 20:59:46 -0700
commit8bb77b3c4c9829d2c195eed52889ec9bd022e8ef (patch)
tree251d86f1c34362d4178ab24dd0aa4e2be8538b2b /show-parse.c
parentea3907e1228b5ec9ce7e62b0861b6d4d7fb43266 (diff)
downloadsparse-dev-8bb77b3c4c9829d2c195eed52889ec9bd022e8ef.tar.gz
Fix typename parsing (incorrect ctype usage), and correct
handling of 'long' and 'long long' types. Fix cast parsing and evaluate casts.
Diffstat (limited to 'show-parse.c')
-rw-r--r--show-parse.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/show-parse.c b/show-parse.c
index 4854edef..06eeef78 100644
--- a/show-parse.c
+++ b/show-parse.c
@@ -30,10 +30,10 @@ const char *modifier_string(unsigned long mod)
char *p = buffer;
const char *res,**ptr, *names[] = {
"auto", "register", "static", "extern",
- "const", "volatile", "signed", "unsigned",
- "char", "short", "long", "long",
- "typdef", "structof", "unionof", "enum",
- "typeof", "attribute",
+ "const", "volatile", "[signed]", "[unsigned]",
+ "[char]", "[short]", "[long]", "[long]",
+ "[typdef]", "[structof]", "[unionof]", "[enum]",
+ "[typeof]", "[attribute]",
NULL
};
ptr = names;
@@ -151,38 +151,33 @@ void show_type(struct symbol *sym)
printf("enum %s", show_token(sym->token));
return;
- case SYM_NODE:
- printf("node '%s' of type ", show_token(sym->token));
- break;
+ case SYM_NODE: {
+ struct symbol *type = sym->ctype.base_type;
+ if (!type)
+ printf("notype");
+ else
+ show_type(type);
+ printf(": %s", show_token(sym->token));
+ return;
+ }
default:
printf("strange type %d '%s' of type ", sym->type, show_token(sym->token));
- break;
+ show_type(sym->ctype.base_type);
+ return;
}
- show_type(sym->ctype.base_type);
}
void show_symbol(struct symbol *sym)
{
- if (!sym) {
- printf("<anon symbol>");
- return;
- }
- switch (sym->type) {
- case SYM_FN:
- printf("%s: ", show_token(sym->token));
- show_type(sym);
+
+ show_type(sym);
+ if (sym->type == SYM_FN) {
printf("\n");
show_statement(sym->stmt);
- break;
- default:
- show_type(sym);
- printf(": %s", show_token(sym->token));
- break;
}
}
-
/*
* Print out a statement
*/