[Bug 155429] [headers] including malloc.h should not abort compile.

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Jan 12 06:01:47 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=155429

Jan Beich <jbeich at FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|kern                        |standards
           Assignee|bugs at FreeBSD.org            |standards at FreeBSD.org

--- Comment #2 from Jan Beich <jbeich at FreeBSD.org> ---
On Linux/glibc <malloc.h> defines extensions (e.g., memalign,
malloc_usable_size, mallinfo) that FreeBSD provides via <malloc_np.h> (e.g.,
*allocx, malloc_usable_size, mallctl) while similar to upstream jemalloc. If
FreeBSD doesn't want to implement glibc extensions like Solaris maybe time to
remove <malloc.h> instead e.g.,

https://github.com/DragonFlyBSD/DragonFlyBSD/commit/02b66c54cac986a0bf93435b8d5ae1b17521515b
https://github.com/openbsd/src/commit/d88f57029e5acaaaf028633c7fa15c5d7325c5cc

$ cat a.c
#if __has_include(<malloc.h>)
#include <malloc.h>
#endif

$ cc -c a.c
In file included from a.c:2:
/usr/include/malloc.h:3:2: error: "<malloc.h> has been replaced by <stdlib.h>"
#error "<malloc.h> has been replaced by <stdlib.h>"
 ^
1 error generated.

$ rm /usr/include/malloc.h

$ cc -c a.c

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-standards mailing list