From 3e006796cf7da42ec06432e495f5dc00ef216695 Mon Sep 17 00:00:00 2001 From: christos Date: Sun, 15 Oct 2006 15:08:20 +0000 Subject: [PATCH] previous fix broke array initializers. --- usr.bin/xlint/lint1/init.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/usr.bin/xlint/lint1/init.c b/usr.bin/xlint/lint1/init.c index 97d6a8baaca3..db14bb643397 100644 --- a/usr.bin/xlint/lint1/init.c +++ b/usr.bin/xlint/lint1/init.c @@ -1,4 +1,4 @@ -/* $NetBSD: init.c,v 1.19 2006/10/14 21:08:50 christos Exp $ */ +/* $NetBSD: init.c,v 1.20 2006/10/15 15:08:20 christos Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: init.c,v 1.19 2006/10/14 21:08:50 christos Exp $"); +__RCSID("$NetBSD: init.c,v 1.20 2006/10/15 15:08:20 christos Exp $"); #endif #include @@ -164,9 +164,10 @@ popi2(void) istk_t *istk; sym_t *m; - DPRINTF(("popi2(%s): brace=%d count=%d\n", tyname(buf, sizeof(buf), + DPRINTF(("popi2(%s): brace=%d count=%d namedmem %d\n", + tyname(buf, sizeof(buf), initstk->i_type ? initstk->i_type : initstk->i_subt), - initstk->i_brace, initstk->i_cnt)); + initstk->i_brace, initstk->i_cnt, initstk->i_namedmem)); initstk = (istk = initstk)->i_nxt; if (initstk == NULL) LERROR("popi2()"); @@ -288,10 +289,15 @@ again: switch (istk->i_type->t_tspec) { case ARRAY: if (namedmem) { - DPRINTF(("pushinit ARRAY %s\n", namedmem->n_name)); + DPRINTF(("pushinit ARRAY %s brace=%d\n", + namedmem->n_name, istk->i_brace)); goto pop; - } else - initstk->i_brace = 1; + } else if (istk->i_nxt->i_namedmem) { + DPRINTF(("pushinit ARRAY brace=%d, namedmem=%d\n", + istk->i_brace, istk->i_nxt->i_namedmem)); + istk->i_brace = 1; + } + if (incompl(istk->i_type) && istk->i_nxt->i_nxt != NULL) { /* initialisation of an incomplete type */ error(175);