>Number:         155429
>Category:       misc
>Synopsis:       Including malloc.h aborts compile.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 10 09:30:11 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Steve Whiteley
>Release:        7.3-release
>Organization:
Whiteley Research Inc.
>Environment:
FreeBSD kipling 7.3-RELEASE-p3 FreeBSD 7.3-RELEASE-p3 #3: Sun Oct  3 17:29:39 
PDT 2010     stevew@kipling:/usr2/obj/usr2/src/sys/KIPLING  i386
>Description:
The is not really a bug, just (IMHO) a dumb decision that affects at least up 
to 7.3.  Including <malloc.h> in a c++ source file aborts the compile, with a 
message informing to include stdlib instead.  Well, fine, but some source files 
written for other OSes may include malloc.h, and are nonportable to FreeBSD 
simple because of this, i.e., if the malloc.h include is commented out the file 
compiles fine.  The FreeBSD malloc.h should be an empty stub, or at worst emit 
an info message that malloc.h is not needed in FreeBSD.  But to abort the 
compile?
So I have the choice of hunting through a big source like OpenAccess to fix all 
the malloc.h includes, or hacking the include file itself (my approach, but it 
always reverts when I update).
>How-To-Repeat:
test.cc
---------
#include <malloc.h>
int main() { return 0; }
>Fix:
/* $FreeBSD: src/include/malloc.h,v 1.5.38.1 2010/02/10 00:26:20 kensmith Exp $
*/
#if __STDC__
/* XXX commented to avoid ridiculousness
#error "<malloc.h> has been replaced by <stdlib.h>"
*/
#else
#include <stdlib.h>
#endif


>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to