Malloc.h obsolete

Hi,

I have a question regarding this warning message (which is repeated many
times):

In file included from src/os/unix/ngx_posix_config.h:74,
from src/core/ngx_config.h:37,
from src/core/nginx.c:7:
/usr/include/malloc.h:4:2: warning: #warning “<malloc.h> is obsolete,
use <stdlib.h>”

stdlib.h seems to be assumed always, and malloc.h hasn’t been needed for
some time. Do some of the supported systems still use malloc.h instead
of stdlib.h for this stuff? Or can the malloc.h detection simply be
removed from auto/headers, ngx_posix_config.h, et al?

On Sat, Dec 29, 2007 at 11:05:56AM -0700, Darrin Chandler wrote:

of stdlib.h for this stuff? Or can the malloc.h detection simply be
removed from auto/headers, ngx_posix_config.h, et al?

What OS ?
malloc.h is required for memalign(), however, now memalign() is not used
in
nginx.

On Sat, Dec 29, 2007 at 09:39:21PM +0300, Igor S. wrote:

stdlib.h seems to be assumed always, and malloc.h hasn’t been needed for
some time. Do some of the supported systems still use malloc.h instead
of stdlib.h for this stuff? Or can the malloc.h detection simply be
removed from auto/headers, ngx_posix_config.h, et al?

What OS ?
malloc.h is required for memalign(), however, now memalign() is not used in
nginx.

This is on OpenBSD. I maintain the OpenBSD nginx port, and I am looking
for ways to reduce warnings and generally improve platform support.

FYI, it’s working well as far as I’ve tested except for mail, which I
have not set up an auth server to test yet.

On Sat, Dec 29, 2007 at 10:16:59PM +0300, Igor S. wrote:

On FreeBSD I see in objs/autoconf.err:


checking for malloc.h

In file included from objs.gcc/autotest.c:2:
/usr/include/malloc.h:3:2: #error “<malloc.h> has been replaced by <stdlib.h>”

OpenBSD’s malloc.h has:

#warning “<malloc.h> is obsolete, use <stdlib.h>”

#include <stdlib.h>

So autoconf lets it be used.

One way is to add

./configure … --with-cc-opt="-DNGX_HAVE_MALLOC_H=0"

Yes. I’ll use that unless some better idea comes to me. Thanks!

Note that this is not causing problems. I just like to reduce warnings
so that I can more easily spot real issues, if any should come up.
Thanks again. :slight_smile:

On Sat, Dec 29, 2007 at 11:53:47AM -0700, Darrin Chandler wrote:

for ways to reduce warnings and generally improve platform support.

FYI, it’s working well as far as I’ve tested except for mail, which I
have not set up an auth server to test yet.

On FreeBSD I see in objs/autoconf.err:


checking for malloc.h

In file included from objs.gcc/autotest.c:2:
/usr/include/malloc.h:3:2: #error “<malloc.h> has been replaced by
<stdlib.h>”

#include <malloc.h>

int main() {
return 0;
}


gcc -o objs.gcc/autotest objs.gcc/autotest.c

One way is to add

./configure … --with-cc-opt="-DNGX_HAVE_MALLOC_H=0"

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs