From owner-freebsd-net Thu May 30 5:44:12 2002 Delivered-To: freebsd-net@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 17BF637B401; Thu, 30 May 2002 05:44:06 -0700 (PDT) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id WAA15587; Thu, 30 May 2002 22:43:59 +1000 Date: Thu, 30 May 2002 22:47:25 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Alfred Perlstein Cc: net@FreeBSD.ORG, Subject: Re: netgraph warnings In-Reply-To: <20020529150129.GQ17045@elvis.mu.org> Message-ID: <20020530223238.G28714-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Wed, 29 May 2002, Alfred Perlstein wrote: > Something bizzaro with the 'struct ng_parse_struct_info' declarations, > please suggest or make a fix: > ... > cc -c -O -pipe -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wno-format -ansi -g -nostdinc -I- -I. -I../../.. -I../../../dev -I../../../contrib/dev/acpica -I../../../contrib/ipfilter -I../../../../include -D_KERNEL -ffreestanding -include opt_global.h -fno-common -mpreferred-stack-boundary=2 -ffreestanding -Werror ../../../netgraph/ng_base.c > cc1: warnings being treated as errors > ../../../netgraph/ng_base.c:365: warning: excess elements in array initializer > ../../../netgraph/ng_base.c:365: warning: (near initialization for `ng_mkpeer_type_info.fields') ... This is caused by the zero-sized array in struct ng_parse_struct_info. Zero-sized arrays used to just break compiling with C compilers (C90), but now even gcc objects to initializing them. I had one of these in my own code ( *blush* ), and eventually fixed found a portable fix using an unnamed bitfield. The bitfield hack doesn't seem to apply here though, since netgraph seems to really want to initialize the struct. BTW, does anyone have any good ideas about how to fix HIDENAME()? HIDENAME(mcount) doesn't work in the ELF case, because concatenating `.' and `mcount' doesn't give a preprocessing token. This breaks LINT. I only have bad ideas about it. It is fundamental that HIDENAME() may give non-C identifiers. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message