From: Wolfgang Denk Date: Sun, 17 Aug 2008 00:04:06 +0200 Subject: [U-Boot] [PATCH 1/1] add u-boot/types to simplify HOST support In-Reply-To: <1218905776-3096-1-git-send-email-plagnioj@jcrosoft.com> References: <1218905776-3096-1-git-send-email-plagnioj@jcrosoft.com> Message-ID: <20080816220406.6DA6F247A4@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Jean-Christophe PLAGNIOL-VILLARD, In message <1218905776-3096-1-git-send-email-plagnioj@jcrosoft.com> you wrote: > add fix MacOS HOST support > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD > --- > 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 > + * > + * > + * 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 > +#else > + > +#if defined(__BEOS__) || \ > + defined(__NetBSD__) || \ > + defined(__FreeBSD__) || \ > + defined(__sun__) || \ > + defined(__APPLE__) > +#include > +/* sysv */ > +typedef unsigned char unchar; > +typedef unsigned short ushort; > +typedef unsigned int uint; > +typedef unsigned long ulong; > + > +#elif defined(__linux__) > +#include > +#elif defined(__WIN32__) > +#include > +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 -#else -# include -#endif So it would include for for native builds. With your change, we have added complexity of selecting from or or 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."