libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Fixing malloc.h related warning


From: Bob Friesenhahn
Subject: RE: Fixing malloc.h related warning
Date: Mon, 15 Sep 2003 13:34:21 -0500 (CDT)

On Mon, 15 Sep 2003, Boehne, Robert wrote:

> Dalibor,
>
> This would require a patch that looks for whatever malloc.h is #included for
> in stdlib.h and prefers it in stdlib.h.  So it isn't as simple as 
> s/malloc/stdlib/.

The question is how necessary is it to support non-ANSI C.  Stdlib.h
is ANSI C standard while malloc.h is a legacy header.  The header is
included in order to obtain prototypes for malloc() and free().  If
the compilation environment is ANSI C, malloc.h should never be
included.

Probably this is sufficient:

#if defined(HAVE_STDLIB_H)
#include <stdlib.h>
#else
#if defined(HAVE_MALLOC_H)
#include <malloc.h>
#endif
#endif

Bob

> -----Original Message-----
> From: Dalibor Topic [mailto:address@hidden
> Sent: Monday, September 15, 2003 11:36 AM
> To: Libtool mailing list
> Subject: Fixing malloc.h related warning
>
>
> Hi,
>
> bulding code that uses libtool 1.5 on i386-FreeBSD 4.8, I noticed a
> compiler warning:
>
>   gcc -DHAVE_CONFIG_H -I. -I../../kaffe-1.1.1/libltdl -I. -g -O2 -c
> ../../kaffe-1.1.1/libltdl/ltdl.c  -fPIC -DPIC -o .libs/ltdl.o
> In file included from ../../kaffe-1.1.1/libltdl/ltdl.c:57:
> /usr/include/malloc.h:2: warning: #warning "this file includes
> <malloc.h> which is deprecated, use <stdlib.h> instead"
>
> Could the offending include be removed from source of ltdl.c?
>
> cheers,
> dalibor topic
>
>
>
> _______________________________________________
> Libtool mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/libtool
>
>
> _______________________________________________
> Libtool mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/libtool
>

======================================
Bob Friesenhahn
address@hidden
http://www.simplesystems.org/users/bfriesen





reply via email to

[Prev in Thread] Current Thread [Next in Thread]