Get rid of repeated unused variable warnings.
authorChristoph Mallon <christoph.mallon@gmx.de>
Thu, 11 Dec 2008 11:56:50 +0000 (11:56 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Thu, 11 Dec 2008 11:56:50 +0000 (11:56 +0000)
[r24519]

parser.c

index 419f83b..995f182 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -5584,9 +5584,10 @@ static void check_labels(void)
        }
 }
 
-static void warn_unused_entity(entity_t *entity, entity_t *end)
+static void warn_unused_entity(entity_t *entity, entity_t *last)
 {
-       for (; entity != NULL; entity = entity->base.next) {
+       entity_t const *const end = last != NULL ? last->base.next : NULL;
+       for (; entity != end; entity = entity->base.next) {
                if (!is_declaration(entity))
                        continue;
 
@@ -5605,9 +5606,6 @@ static void warn_unused_entity(entity_t *entity, entity_t *end)
                        warningf(&entity->base.source_position, "%s '%Y' is never read",
                                 what, entity->base.symbol);
                }
-
-               if (entity == end)
-                       break;
        }
 }