diff options
| author | Linus Torvalds <torvalds@home.transmeta.com> | 2003-03-22 20:05:36 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 20:59:36 -0700 |
| commit | 82db0b8674c0957bd206bb50756b1d996cd2e2fc (patch) | |
| tree | a1f176726cb49ef88964d19c7df518e312514374 /show-parse.c | |
| parent | b92fd48511f4684d655a53405f4204f9cda32fd4 (diff) | |
| download | sparse-dev-82db0b8674c0957bd206bb50756b1d996cd2e2fc.tar.gz | |
Fix up more stupidities in the type parsing. It might even be getting close
to right now.
Diffstat (limited to 'show-parse.c')
| -rw-r--r-- | show-parse.c | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/show-parse.c b/show-parse.c index 8142262d..f0652925 100644 --- a/show-parse.c +++ b/show-parse.c @@ -51,6 +51,17 @@ const char *modifier_string(unsigned long mod) return buffer+1; } +void show_struct_member(struct symbol *sym, void *data, int flags) +{ + if (flags & ITERATE_FIRST) + printf(" { "); + printf("%s", show_token(sym->token)); + if (flags & ITERATE_LAST) + printf(" } "); + else + printf(", "); +} + void show_type_details(unsigned int modifiers, struct symbol *sym) { if (!sym) { @@ -80,23 +91,33 @@ void show_type_details(unsigned int modifiers, struct symbol *sym) printf(" <badtype>"); return; } - if (sym->type == SYM_STRUCT) - printf(" struct"); - else if (sym->type == SYM_UNION) - printf(" union"); - else if (sym->type == SYM_ENUM) - printf(" enum"); - else if (sym->type == SYM_PTR) + if (sym->type == SYM_STRUCT) { + printf(" struct %s", show_token(sym->token)); + symbol_iterate(sym->symbol_list, show_struct_member, NULL); + return; + } + if (sym->type == SYM_UNION) { + printf(" union %s", show_token(sym->token)); + symbol_iterate(sym->symbol_list, show_struct_member, NULL); + return; + } + if (sym->type == SYM_ENUM) { + printf(" enum %s", show_token(sym->token)); + return; + } + + if (sym->type == SYM_PTR) printf(" *"); else if (sym->type == SYM_FN) printf(" <fn>"); else printf(" strange type %d", sym->type); + if (sym->token) - printf(" %s", show_token(sym->token)); + printf(" '%s'", show_token(sym->token)); - if (sym->ctype.base_type) - show_type(sym->ctype.base_type); + printf("%s", modifier_string(sym->ctype.modifiers)); + show_type_details(sym->ctype.modifiers, sym->ctype.base_type); } static void show_one_symbol(struct symbol *sym, void *sep, int flags) |
