cvs commit: src/sys/amd64/include md_var.h

Stefan Farfeleder stefanf at FreeBSD.org
Thu Jan 18 08:59:58 UTC 2007


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


More information about the cvs-src mailing list