Warn when a non-static global variable has no prior declaration.
authorChristoph Mallon <christoph.mallon@gmx.de>
Fri, 14 Dec 2007 17:28:16 +0000 (17:28 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Fri, 14 Dec 2007 17:28:16 +0000 (17:28 +0000)
[r18749]

parser.c

index 5ae71c7..3a3fd39 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -2350,6 +2350,10 @@ warn_redundant_declaration:
                } else if (warning.missing_declarations && !is_sym_main(symbol)) {
                        warningf(declaration->source_position, "no previous declaration for '%#T'", type, symbol);
                }
+       } else if (warning.missing_declarations &&
+           declaration->storage_class != STORAGE_CLASS_STATIC &&
+           declaration->storage_class != STORAGE_CLASS_TYPEDEF) {
+               warningf(declaration->source_position, "no previous declaration for '%#T'", type, symbol);
        }
 
        assert(declaration->parent_context == NULL);