Subject: Re: Cross compiling on FreeBSD 5.0, malloc.h is deprecated
To: None <current-users@netbsd.org>
From: Aron Stansvik <elvstone@home.se>
List: current-users
Date: 10/28/2003 21:38:02
Ok, 4.x is a bit stricter than 5.x and treats it as an error. I guess I'll
hack around it the way you described for now, but will this be changed in
current so that it works "out of the box" on FreeBSD 5.x in the future (and
also any other platform that treat this as an error)?

Sincerely,
Aron Stansvik

--
unemployed

On Tue, Oct 28, 2003 at 11:10:41PM +0300, Valeriy E. Ushakov wrote:
> On Tue, Oct 28, 2003 at 20:35:17 +0100, Aron Stansvik wrote:
> 
> > And the only file that, from what I can tell (there might be more, but
> > my compilation bails out), that's affected is:
> > 
> > src/usr.bin/lex/flexdef.h
> > 
> > which on line 40 defines the __STDC__ macro and on line 61 includes the
> > deprecated header malloc.h. This gives a preprocessor error on my
> > system:
> 
> Oh, it's only a warning on FreeBSD 4.x, so I never bothered...
> 
> I think this:
> 
> #ifdef HAVE_MALLOC_H
> #include <malloc.h>
> #endif
> 
> #ifdef STDC_HEADERS
> #include <stdlib.h>
> #endif
> 
> should be changed to only check/include malloc.h if STDC_HEADERS are
> not defined.
> 
> Alternatively (as we don't run configure for lex), we can just
> undefine HAVE_MALLOC_H in config.h
> 
> SY, Uwe
> -- 
> uwe@ptc.spbu.ru                         |       Zu Grunde kommen
> http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen
>