Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 May 2002 22:47:25 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Alfred Perlstein <bright@mu.org>
Cc:        net@FreeBSD.ORG, <julian@FreeBSD.ORG>
Subject:   Re: netgraph warnings
Message-ID:  <20020530223238.G28714-100000@gamplex.bde.org>
In-Reply-To: <20020529150129.GQ17045@elvis.mu.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020530223238.G28714-100000>