X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ast.c;h=da185168b81f850872664f7b3d3ec14ea6423ea2;hb=5252fe4c72cb4fa138c518dca6e1d574da079d7b;hp=8c3c54bd2fb5a5cf600806187389d2a4f5ce610f;hpb=b3e2b201ea549e7e44110b0e0d366a4e34ed1914;p=cparser diff --git a/ast.c b/ast.c index 8c3c54b..da18516 100644 --- a/ast.c +++ b/ast.c @@ -237,6 +237,7 @@ static void print_select(const select_expression_t *expression) void print_expression(const expression_t *expression) { switch(expression->type) { + case EXPR_UNKNOWN: case EXPR_INVALID: fprintf(out, "*invalid expression*"); break; @@ -321,17 +322,18 @@ static void print_expression_statement(const expression_statement_t *statement) static void print_goto_statement(const goto_statement_t *statement) { fprintf(out, "goto "); - if(statement->label != NULL) { - fprintf(out, "%s", statement->label->symbol->string); - } else { - fprintf(out, "?%s", statement->label_symbol->string); - } + fputs(statement->label->symbol->string, out); + fprintf(stderr, "(%p)", (void*) statement->label); fputs(";\n", out); } static void print_label_statement(const label_statement_t *statement) { - fprintf(out, "%s:\n", statement->symbol->string); + fprintf(stderr, "(%p)", (void*) statement->label); + fprintf(out, "%s:\n", statement->label->symbol->string); + if(statement->label_statement != NULL) { + print_statement(statement->label_statement); + } } static void print_if_statement(const if_statement_t *statement) @@ -517,9 +519,13 @@ void print_initializer(const initializer_t *initializer) static void print_normal_declaration(const declaration_t *declaration) { - print_storage_class(declaration->storage_class); + print_storage_class((storage_class_t)declaration->storage_class); print_type_ext(declaration->type, declaration->symbol, &declaration->context); + if(declaration->is_inline) { + fputs("inline ", out); + } + if(declaration->type->type == TYPE_FUNCTION) { if(declaration->init.statement != NULL) { fputs("\n", out);