From: Christoph Mallon Date: Tue, 11 Dec 2007 08:53:49 +0000 (+0000) Subject: Generate a more sensible warning for a stray ; in global context than "no type specif... X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=a3b59620bf02c87d9951a0f1e8b9cf7e87e6c321;p=cparser Generate a more sensible warning for a stray ; in global context than "no type specifiers in declaration" followed by "empty declaration". [r18669] --- diff --git a/parser.c b/parser.c index 387681d..71f125b 100644 --- a/parser.c +++ b/parser.c @@ -5337,7 +5337,13 @@ static translation_unit_t *parse_translation_unit(void) initialize_builtin_types(); while(token.type != T_EOF) { - parse_external_declaration(); + if (token.type == ';') { + /* TODO error in strict mode */ + warningf(HERE, "stray ';' outside of function"); + next_token(); + } else { + parse_external_declaration(); + } } assert(context == &unit->context);