Generate a more sensible warning for a stray ; in global context than "no type specif...
authorChristoph Mallon <christoph.mallon@gmx.de>
Tue, 11 Dec 2007 08:53:49 +0000 (08:53 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Tue, 11 Dec 2007 08:53:49 +0000 (08:53 +0000)
[r18669]

parser.c

index 387681d..71f125b 100644 (file)
--- 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);