Remove if (type != NULL), which due to prior program logic cannot be false.
authorChristoph Mallon <christoph.mallon@gmx.de>
Thu, 16 Jun 2011 13:47:33 +0000 (15:47 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Fri, 17 Jun 2011 04:42:11 +0000 (06:42 +0200)
parser.c

index 4fc3804..801b2ec 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -2202,10 +2202,18 @@ finish_designator:
                                        goto error_parse_next;
                                type_t *const outer_type_skip = skip_typeref(outer_type);
                                if (is_type_compound(outer_type_skip) &&
-                                   !outer_type_skip->compound.compound->complete) {
+                                               !outer_type_skip->compound.compound->complete) {
                                        goto error_parse_next;
                                }
-                               goto error_excess;
+
+                               if (warning.other) {
+                                       if (env->entity != NULL) {
+                                               warningf(HERE, "excess elements in initializer for '%Y'", env->entity->base.symbol);
+                                       } else {
+                                               warningf(HERE, "excess elements in initializer");
+                                       }
+                               }
+                               goto error_parse_next;
                        }
 
                        /* handle { "string" } special case */
@@ -2257,20 +2265,8 @@ finish_designator:
                                path->max_index = index;
                }
 
-               if (type != NULL) {
-                       /* append to initializers list */
-                       ARR_APP1(initializer_t*, initializers, sub);
-               } else {
-error_excess:
-                       if (warning.other) {
-                               if (env->entity != NULL) {
-                                       warningf(HERE, "excess elements in initializer for '%Y'",
-                                                env->entity->base.symbol);
-                               } else {
-                                       warningf(HERE, "excess elements in initializer");
-                               }
-                       }
-               }
+               /* append to initializers list */
+               ARR_APP1(initializer_t*, initializers, sub);
 
 error_parse_next:
                if (token.type == '}') {