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

Måns Rullgård mans at mansr.com
Tue Nov 19 16:51:42 CET 2013


Masahiro Yamada <yamada.m at jp.panasonic.com> writes:

> 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.
>
> Blackfin header file
> arch/blackfin/include/asm/blackfin_local.h
> uses bool type here:
>   extern bool bfin_os_log_check(void);
>
> This means Blackfin boards which define CONFIG_SYS_HUSH_PARSER
> always failed in compiling.
>
> This commit fixes this issue by undefining true and false macro.

[...]

> +/*
> + * Undef true and false here to avoid macro expansion by <stdbool.h>
> + */
> +#undef true
> +#undef false

This won't work if stdbool.h defines true/false as an enum.  Some
versions of gcc did this.  The correct fix is to change the code so it
doesn't use any of the identifiers bool, true, or false for other
purposes than those intended by stdbool.h.

I agree with Wolfgang that using "boolean" types is generally a bad idea
that only introduces problems.

-- 
Måns Rullgård
mans at mansr.com


More information about the U-Boot mailing list