Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jan 2007 09:41:57 +0100
From:      Stefan Farfeleder <stefanf@FreeBSD.org>
To:        Craig Rodrigues <rodrigc@crodrigues.org>
Cc:        cvs-src@FreeBSD.org, src-committers@FreeBSD.org, Alexander Kabaev <kabaev@gmail.com>, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/amd64/include md_var.h
Message-ID:  <20070118084157.GA920@lizard.fafoe.narf.at>
In-Reply-To: <20070118052816.GA3582@crodrigues.org>
References:  <200701180200.l0I2049r024678@repoman.freebsd.org> <20070117214345.27d1db56@kan.dnsalias.net> <20070118052816.GA3582@crodrigues.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jan 18, 2007 at 12:28:16AM -0500, Craig Rodrigues wrote:
> On Wed, Jan 17, 2007 at 09:43:45PM -0500, Alexander Kabaev wrote:
> > Back this out please. I do not see how this change can possibly be
> > correct.
> 
> For this testcase:
> void main(void)
> {
>         extern struct foo array_foo[];
>         return 0;
> }
> 
> GCC3 will compile this testcase without error, but GCC4
> will complain with: error: "array type has incomplete element type".
> 
> Two ways to eliminate this GCC4 compilation error:
> (1)  Change testcase to:
> int main(void)
> {
> 	extern struct foo *array_foo;
> 	return 0;
> }

This is wrong, arrays and pointers are different beasts.

> (2)  Make struct definition visible earlier on:
> 
> #include "foo.h"  /*  where foo.h contains:   struct foo { int a; }; */
> 
> int main(void)
> {
> 	extern struct foo array_foo[];
> 	return 0;
> }
> 
> 
> For md_var.h, I chose approach (1).  Do recommend approach (2),
> or some other fix?

Either make the struct complete or remove the declaration entirely (I
guess that's not possible here).

Stefan



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