[U-Boot] Including stdlib.h / ldiv_t

Mike Frysinger vapier at gentoo.org
Fri Oct 14 06:25:11 CEST 2011


On Tuesday 27 September 2011 12:13:03 Simon Glass wrote:
> On Mon, Sep 26, 2011 at 3:05 PM, Mike Frysinger wrote:
> > On Monday, September 26, 2011 16:23:01 Simon Glass wrote:
> >> At the moment including stdlib and including common.h are mutually
> >> exclusive. This probably makes some sense (why would anyone include
> >> stdlib.h in U-Boot except with hostcc?), but in that case we should
> >> try to replace any need for stdlib with our own definitions. Does that
> >> sounds right?
> > 
> > sounds like something for compiler.h to worry about ?
> 
> The header of compiler.h says 'Keep all the ugly #ifdef for system
> stuff here', so I was hoping to avoid association with that file.
> People do explicitly include div64.h but compiler.h is included by
> common.h. So it seems to be that a separate header is called for...?

compiler.h is meant to provide a sane view to both u-boot and the host tools, 
so this would be an acceptable use imo.  it's really not that scary :).

however, the code you're referring to is only used by u-boot code, and it's 
merely to provide the API to lib/ldiv.c.  since ldiv and div64 are so 
conceptually similar, i think it's fine to keep the two in the same header.  if 
we really detest the "64" part, let's rename include/div64.h to include/div.h, 
and then pull all this duplicated ldiv logic out of files and into the new 
div.h header.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111014/483a02c7/attachment.pgp 


More information about the U-Boot mailing list