best way to work around <malloc.h> vs <stdlib.h> ?

Kris Kennaway kris at FreeBSD.org
Tue Aug 19 18:10:27 UTC 2008


Luigi Rizzo wrote:
> A fair amount of third party software in ports still uses <malloc.h>
> which in our system is like this:
> 
> 	/* $FreeBSD: src/include/malloc.h,v 1.5 2001/11/07 23:14:31 obrien Exp $ */
> 	#if __STDC__
> 	#error "<malloc.h> has been replaced by <stdlib.h>"
> 	#else
> 	#include <stdlib.h>
> 	#endif
> 
> What is the best way to disable the error without an
> explicit patch (there are over 200 patchfiles in ports
> just doing that) ?
> 
> I tried the following
> 
> + CPPFLAGS += -U__STDC__
>   seems to work, though it gives some warnings because a
>   built-in define is undefined. Also i am not sure if there
>   are other parts of the system that are affected;
> 
> + CPPFLAGS += -traditional-cpp
>   is also reported to unset __STDC__, but it generates an
>   independent set of warnings and errors;
> 
> Any other ideas ?

The only reasonable fix is to patch or use sed (e.g. REINPLACE_CMD), 
then send the fixes upstream.

Kris


More information about the freebsd-ports mailing list