[PATCH 17/18] Provide __size_t via <sys/_types.h>

Sebastian Huber sebastian.huber@embedded-brains.de
Thu Apr 14 19:31:00 GMT 2016


----- Corinna Vinschen <vinschen@redhat.com> schrieb:
> On Apr 14 13:54, Sebastian Huber wrote:
> > Various FreeBSD source and header files need a typedef __size_t via
> > <sys/_types.h>.  Unfortunately the GCC provided <stddef.h> uses
> > 
> > 	#if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
> > 	  || defined(__DragonFly__) \
> > 	  || defined(__FreeBSD_kernel__)
> > 	/* __size_t is a typedef on FreeBSD 5, must not trash it. */
> > 	#elif defined (__VMS__)
> > 	/* __size_t is also a typedef on VMS.  */
> > 	#else
> > 	#define __size_t
> > 	#endif
> > 
> > and therefore defines __size_t on Newlib targets which would trash a
> > __size_t typedef.  Include <stddef.h> before <sys/_types.h> in
> > <sys/types.h> and undefine __size_t in <sys/_types.h> as a workaround.
> 
> What about GCC upstream?  Why are they doing that in the first place?
> What sense does it make to set __size_t to nothing, rather than setting
> it to __SIZE_TYPE__?

This FreeBSD workaround in GCC stddef.h is there since 2002 and in 2014 the DragonFly workaround was added. I guess they are very conservative to change the value of existing defines in GCC, since they support so many different platforms.

> 
> Did you ask on the gcc list?

No, but I can ask. Even if the GCC stddef.h is changed, it will need months or years before this is available. This patch is not perfect, but I am able to build more than 800 FreeBSD user and kernel space files with it.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the Newlib mailing list