Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Mar 2011 09:28:03 GMT
From:      Steve Whiteley <stevew@srware.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/155429: Including malloc.h aborts compile.
Message-ID:  <201103100928.p2A9S3o3048202@red.freebsd.org>
Resent-Message-ID: <201103100930.p2A9UBZw026178@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:



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