Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Aug 2008 13:12:37 -0500
From:      "Jeremy Messenger" <mezz7@cox.net>
To:        "Luigi Rizzo" <rizzo@iet.unipi.it>
Cc:        ports@freebsd.org
Subject:   Re: best way to work around <malloc.h> vs <stdlib.h> ?
Message-ID:  <op.uf5bjbr19aq2h7@mezz.mezzweb.com>
In-Reply-To: <20080819172631.GA25160@onelab2.iet.unipi.it>
References:  <20080819172631.GA25160@onelab2.iet.unipi.it>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 19 Aug 2008 12:26:31 -0500, Luigi Rizzo <rizzo@iet.unipi.it> 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 think patch it is best, because if I understand it corrects is that  
malloc() in stdlib.h is standard of ANSI C. Correct me if I am wrong.  
However, I don't see anything wrong with patch. You can simple use  
wildcard (*.c) or use find(1) to find files to replace the malloc.h ->  
stdlib.h by use REINPLACE_CMD without have to create multi-file patch.

Cheers,
Mezz

> 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 ?
>
> 	cheers
> 	luigi


-- 
mezz7@cox.net  -  mezz@FreeBSD.org
FreeBSD GNOME Team
http://www.FreeBSD.org/gnome/  -  gnome@FreeBSD.org



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