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

Wolfgang Denk wd at denx.de
Sun Aug 17 00:04:06 CEST 2008


Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <1218905776-3096-1-git-send-email-plagnioj at jcrosoft.com> you wrote:
> add fix MacOS HOST support
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
> ---
>  include/elf.h          |   15 +------------
>  include/environment.h  |    6 +----
>  include/image.h        |    1 +
>  include/libfdt_env.h   |    3 +-
>  include/u-boot/md5.h   |    2 +-
>  include/u-boot/types.h |   53 ++++++++++++++++++++++++++++++++++++++++++++++++
>  6 files changed, 58 insertions(+), 22 deletions(-)
>  create mode 100644 include/u-boot/types.h
...
> diff --git a/include/u-boot/types.h b/include/u-boot/types.h
> new file mode 100644
> index 0000000..e4afa98
> --- /dev/null
> +++ b/include/u-boot/types.h
> @@ -0,0 +1,53 @@
> +/*
> + * (C) Copyright 2008 Jean-Christophe PLAGNIOL-VILLARD
> + *  <plagnioj at jcrosft.com>
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +
> +#ifndef __U_BOOT_TYPES_H__
> +#define __U_BOOT_TYPES_H__
> +
> +#ifndef 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(__linux__)
> +#include <stdint.h>
> +#elif defined(__WIN32__)
> +#include <unistd.h>
> +typedef	 unsigned char	 uint8_t;
> +typedef	 unsigned short  uint16_t;
> +typedef	 unsigned int	 uint32_t;
> +#endif
> +#endif /* USE_HOSTCC */
> +
> +#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.

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


I have to admit that I don't like this change.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Who is the oldest inhabitant of this village?"
"We haven't got one; we had one, but he died three weeks ago."



More information about the U-Boot mailing list