scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit a1254513235f39ea3816072cf50c0a46f6155e67
parent 671acae249562120edaec2fb6ff24411ef9be84c
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 17 Jan 2016 20:53:55 +0100

Reduce indentation in initlist()

Diffstat:
cc1/init.c | 36++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/cc1/init.c b/cc1/init.c @@ -105,34 +105,34 @@ initlist(Symbol *sym, Type *tp) } switch (tp->op) { case ARY: - if (tp->defined && n >= tp->n.elem) { - if (!toomany) - warn("excess elements in array initializer"); - toomany = 1; - sym = NULL; - } newtp = tp->type; + if (!tp->defined || n < tp->n.elem) + break; + if (!toomany) + warn("excess elements in array initializer"); + toomany = 1; + sym = NULL; break; case STRUCT: - if (n >= tp->n.elem) { - if (!toomany) - warn("excess elements in struct initializer"); - toomany = 1; - sym = NULL; - } else { + if (n < tp->n.elem) { sym = tp->p.fields[n]; newtp = sym->type; + break; } + if (!toomany) + warn("excess elements in struct initializer"); + toomany = 1; + sym = NULL; break; default: newtp = tp; warn("braces around scalar initializer"); - if (n > 0) { - if (!toomany) - warn("excess elements in scalar initializer"); - toomany = 1; - sym = NULL; - } + if (n <= 0) + break; + if (!toomany) + warn("excess elements in scalar initializer"); + toomany = 1; + sym = NULL; break; } if (accept('{'))