EGCS-19990502 and ANSI C

Martin v. Loewis martin@mira.isdn.cs.tu-berlin.de
Mon May 31 21:06:00 GMT 1999


> Isn't this a bug?

There is a number of problems here. First, the Linux header files (in
particular posix_types.h) should really attempt to include the
compiler's stddef.h, at least if __KERNEL__ is not defined (see
ip_masq for an example which is correct). This would define NULL as
__null, which g++ would recognize as a valid return value.

Ideally, the statement in __cmsg_nxthdr should read

	if ((unsigned long)((char*)(__ptr+1) - (char *) __ctl) > __size)
		return 0;

which is a valid null-pointer return both in ISO C and ISO C++.

g++ treats this error as a pedantic warning. However, pedantic
warnings are errors unless -fpermissive is given. So you can
work-around this problem by compiling with -fpermissive.

The right fix is to include <stddef.h> before including the kernel
header.

I agree that g++ also has a problem, it should not be that strict on
system headers.

Regards,
Martin



More information about the Gcc-bugs mailing list