X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ast.c;h=93ba57f7a7266c27a962892534918e5e9fa4ab8f;hb=4b6bbffc7e1d9a9ee5a75da79ced92f5bc92a913;hp=d8b34d849ef381bae75c03e2f142f3f19d88f6b7;hpb=087130404a59dcdd95aa0d7ac7feec2793e9ce87;p=cparser diff --git a/ast.c b/ast.c index d8b34d8..93ba57f 100644 --- a/ast.c +++ b/ast.c @@ -374,8 +374,8 @@ static void print_declaration_statement( { int first = 1; declaration_t *declaration = statement->declarations_begin; - for( ; declaration != statement->declarations_end->context_next; - declaration = declaration->context_next) { + for( ; declaration != statement->declarations_end->next; + declaration = declaration->next) { if(!first) { print_indent(); } else { @@ -410,13 +410,14 @@ static void print_for_statement(const for_statement_t *statement) if(statement->context.declarations != NULL) { assert(statement->initialisation == NULL); print_declaration(statement->context.declarations); - if(statement->context.declarations->context_next != NULL) { + if(statement->context.declarations->next != NULL) { panic("multiple declarations in for statement not supported yet"); } + fputc(' ', out); } else if(statement->initialisation) { print_expression(statement->initialisation); + fputs("; ", out); } - fputs("; ", out); if(statement->condition != NULL) { print_expression(statement->condition); } @@ -570,7 +571,7 @@ void print_ast(const translation_unit_t *unit) set_print_compound_entries(true); declaration_t *declaration = unit->context.declarations; - for( ; declaration != NULL; declaration = declaration->context_next) { + for( ; declaration != NULL; declaration = declaration->next) { if(declaration->storage_class == STORAGE_CLASS_ENUM_ENTRY) continue; if(declaration->namespace != NAMESPACE_NORMAL &&