[U-Boot] [PATCH 1/1] add u-boot/types to simplify HOST support

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Sun Aug 17 00:38:46 CEST 2008


> > +
> > +
> > +#endif /* __U_BOOT_TYPES_H__ */
> 
> My initial reaction was "what a good idea", bt after looking at the
> resulting code I find that it bocmes even less readable. With this
> patch applied, I lost the last bit of track I had which define was
> coming where from.
> 
> For example, include/environment.h used to have this code:
> 
> -#ifdef USE_HOSTCC
> -# include <stdint.h>
> -#else
> -# include <linux/types.h>
> -#endif
> 
> So it would include <linux/types.h> for <stdint.h> for native builds.
> 
> With  your  change,  we  have  added  complexity  of  selecting  from
> <inttypes.h> or <stdint.h> or <unistd.h> or nothing.

we can modify it as 

#ifdef USE_HOSTCC
#include <linux/types.h>
#else
#if defined(__BEOS__)	 || \
    defined(__NetBSD__)  || \
    defined(__FreeBSD__) || \
    defined(__sun__)	 || \
    defined(__APPLE__)
#include <inttypes.h>
/* sysv */
typedef unsigned char	unchar;
typedef unsigned short	ushort;
typedef unsigned int	uint;
typedef unsigned long	ulong;

#elif defined(__WIN32__)
#include <unistd.h>
typedef	 unsigned char	 uint8_t;
typedef	 unsigned short  uint16_t;
typedef	 unsigned int	 uint32_t;
#else /* __linux__ & default */
#include <stdint.h>
#endif
#endif /* USE_HOSTCC */


> 
> Are you absolutely sure that this is 100% equivalent and working?
> 

I've test it on MacOs and Linux.

Best Regards,
J.



More information about the U-Boot mailing list