diff options
-rw-r--r-- | show-parse.c | 18 | ||||
-rw-r--r-- | symbol.h | 1 |
2 files changed, 18 insertions, 1 deletions
diff --git a/show-parse.c b/show-parse.c index 51a15191..17a4de8b 100644 --- a/show-parse.c +++ b/show-parse.c @@ -107,7 +107,7 @@ void debug_symbol(struct symbol *sym) * Symbol type printout. The type system is by far the most * complicated part of C - everything else is trivial. */ -const char *modifier_string(unsigned long mod) +static const char *show_modifiers(unsigned long mod, int term) { static char buffer[100]; int len = 0; @@ -155,10 +155,26 @@ const char *modifier_string(unsigned long mod) buffer[len++] = ' '; } } + if (len && !term) // strip the trailing space + --len; buffer[len] = 0; return buffer; } +/// +// show the modifiers, terminated by a space if not empty +const char *modifier_string(unsigned long mod) +{ + return show_modifiers(mod, 1); +} + +/// +// show the modifiers, without an ending space +const char *modifier_name(unsigned long mod) +{ + return show_modifiers(mod, 0); +} + static void show_struct_member(struct symbol *sym) { printf("\t%s:%d:%ld at offset %ld.%d", show_ident(sym->ident), sym->bit_size, sym->ctype.alignment, sym->offset, sym->bit_offset); @@ -327,6 +327,7 @@ extern void init_linearized_builtins(int stream); extern void init_ctype(void); extern struct symbol *alloc_symbol(struct position, int type); extern void show_type(struct symbol *); +extern const char *modifier_name(unsigned long mod); extern const char *modifier_string(unsigned long mod); extern void show_symbol(struct symbol *); extern int show_symbol_expr_init(struct symbol *sym); |