[U-Boot] [PATCH] cmd_test: fix a compile error on Blackfin

Wolfgang Denk wd at denx.de
Tue Nov 19 08:01:44 CET 2013


Dear Masahiro Yamada,

In message <1384830117-25345-1-git-send-email-yamada.m at jp.panasonic.com> you wrote:
> Before this commit, common/cmd_test.c defined
> _STDBOOL_H in order to avoid including <stdbool.h>.
> But this work-around is not a good idea.

Actually it is a good idea, as it attempts to be independent of the
actual implementation of the bool data types - it does the same no
matter if "true" and "flase" are members or a union or #define'd
constants.

> --- a/common/cmd_test.c
> +++ b/common/cmd_test.c
> @@ -5,15 +5,6 @@
>   * SPDX-License-Identifier:	GPL-2.0+
>   */
>  
> -/*
> - * Define _STDBOOL_H here to avoid macro expansion of true and false.
> - * If the future code requires macro true or false, remove this define
> - * and undef true and false before U_BOOT_CMD. This define and comment
> - * shall be removed if change to U_BOOT_CMD is made to take string
> - * instead of stringifying it.
> - */
> -#define _STDBOOL_H
> -
>  #include <common.h>
>  #include <command.h>
>  
> @@ -143,6 +134,12 @@ U_BOOT_CMD(
>  	"[args..]"
>  );
>  
> +/*
> + * Undef true and false here to avoid macro expansion by <stdbool.h>
> + */
> +#undef true
> +#undef false
> +

I don't like this.  I feel we should not change global files (that
build fine for everyone else) to work around problems in one specific
implementation.  Instead, we should fix the problem at the root cause,
for example like that.   Could you please test if this patch fixes the
problem, too?




More information about the U-Boot mailing list