X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=parser.c;h=2e18543ca869e7a8fab4abcee728ef05fe211623;hb=c58c01e7c180f68d3d3a721997693abcc6e26352;hp=0b84140e270e8f58bfa30a837a6af22f8b4a96e0;hpb=7a8ce958566e224c6b029acffd781fc2d9ff7a8e;p=cparser diff --git a/parser.c b/parser.c index 0b84140..2e18543 100644 --- a/parser.c +++ b/parser.c @@ -6471,17 +6471,15 @@ static expression_t *parse_va_start(void) expression_t *const expr = parse_assignment_expression(); if (expr->kind == EXPR_REFERENCE) { declaration_t *const decl = expr->reference.declaration; - if (decl == NULL) - return create_invalid_expression(); - if (decl->parent_scope == ¤t_function->scope && - decl->next == NULL) { - expression->va_starte.parameter = decl; - expect(')'); - return expression; + if (decl->parent_scope != ¤t_function->scope || decl->next != NULL) { + errorf(&expr->base.source_position, + "second argument of 'va_start' must be last parameter of the current function"); } + expression->va_starte.parameter = decl; + expect(')'); + return expression; } - errorf(&expr->base.source_position, - "second argument of 'va_start' must be last parameter of the current function"); + expect(')'); end_error: return create_invalid_expression(); } @@ -9821,7 +9819,7 @@ static void parse_translation_unit(void) } } if (anchor_leak) - exit(1); + abort(); #endif switch (token.type) {