Warn about unnecessary static forward declarations.
authorChristoph Mallon <christoph.mallon@gmx.de>
Thu, 21 Aug 2008 05:54:49 +0000 (05:54 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Thu, 21 Aug 2008 05:54:49 +0000 (05:54 +0000)
[r21299]

parser.c

index 9293447..1697204 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -4108,6 +4108,16 @@ static declaration_t *internal_record_declaration(
                                return previous_declaration;
                        }
 
+                       if (warning.redundant_decls                                     &&
+                           is_definition                                               &&
+                           previous_declaration->storage_class == STORAGE_CLASS_STATIC &&
+                           !(previous_declaration->modifiers & DM_USED)                &&
+                           !previous_declaration->used) {
+                               warningf(&previous_declaration->source_position,
+                                        "unnecessary static forward declaration for '%#T'",
+                                        previous_declaration->type, symbol);
+                       }
+
                        unsigned new_storage_class = declaration->storage_class;
 
                        if (is_type_incomplete(prev_type)) {