do not warn for missing declarations if type is invalid
authorMatthias Braun <matze@braunis.de>
Tue, 11 Dec 2012 10:02:57 +0000 (11:02 +0100)
committerMatthias Braun <matze@braunis.de>
Tue, 11 Dec 2012 10:17:17 +0000 (11:17 +0100)
parser.c

index 0886212..470e36c 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -4130,10 +4130,11 @@ error_redeclaration:
                }
        } else if (entity->kind == ENTITY_VARIABLE) {
                if (current_scope                     == file_scope &&
-                               entity->declaration.storage_class == STORAGE_CLASS_NONE &&
-                               !entity->declaration.implicit) {
+                   entity->declaration.storage_class == STORAGE_CLASS_NONE &&
+                   !entity->declaration.implicit) {
 warn_missing_declaration:
-                       warningf(WARN_MISSING_DECLARATIONS, pos, "no previous declaration for '%#N'", entity);
+                       if (is_type_valid(skip_typeref(entity->declaration.type)))
+                               warningf(WARN_MISSING_DECLARATIONS, pos, "no previous declaration for '%#N'", entity);
                }
        }