All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] cmd_test: fix a compile error on Blackfin
@ 2013-11-19  3:01 Masahiro Yamada
  2013-11-19  3:15 ` Masahiro Yamada
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Masahiro Yamada @ 2013-11-19  3:01 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

For example, when I try to compile bct-brettl2 board,
I got an error like follows at compiling common/cmd_test.c.

 bfin-uclinux-gcc  -g  -Os   -ffixed-P3 -fomit-frame-pointer -mno-fdpic
 -ffunction-sections -fdata-sections -mcpu=bf536-0.3 -D__KERNEL__
 -I/home/yamada/u-boot/include -I/home/yamada/u-boot/arch/blackfin/include
 -fno-builtin -ffreestanding -nostdinc
 -isystem /opt/gcc-4.6.3-nolibc/bfin-uclinux/bin/../lib/gcc/bfin-uclinux/4.6.3/include
 -pipe  -DCONFIG_BLACKFIN -Wall -Wstrict-prototypes -fno-stack-protector
 -Wno-format-nonliteral -Wno-format-security     -o cmd_test.o cmd_test.c -c
 In file included from /home/yamada/u-boot/arch/blackfin/include/asm/blackfin.h:13:0,
                 from /home/yamada/u-boot/include/common.h:92,
                 from cmd_test.c:17:
 /home/yamada/u-boot/arch/blackfin/include/asm/blackfin_local.h:54:1: error: unknown type name 'bool'
 make[2]: *** [cmd_test.o] Error 1
 make[2]: Leaving directory `/home/yamada/u-boot/common'
 make[1]: *** [common/built-in.o] Error 2
 make[1]: Leaving directory `/home/yamada/u-boot'
 make: *** [bct-brettl2] Error 2

This is not a compiler problem.
It looks like this behavior is common for all blackfin compilers.


 common/cmd_test.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/common/cmd_test.c b/common/cmd_test.c
index bacc368..1800cff 100644
--- 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
+
 static int do_false(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	return 1;
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-11-26 10:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-19  3:01 [U-Boot] [PATCH] cmd_test: fix a compile error on Blackfin Masahiro Yamada
2013-11-19  3:15 ` Masahiro Yamada
2013-11-19  7:01 ` Wolfgang Denk
2013-11-19  7:50   ` Masahiro Yamada
2013-11-25  1:43   ` Masahiro Yamada
2013-11-25 13:06     ` Tom Rini
2013-11-25 14:19     ` Wolfgang Denk
2013-11-26 10:34       ` Masahiro Yamada
2013-11-25 21:58   ` [U-Boot] " Tom Rini
2013-11-19 15:51 ` [U-Boot] [PATCH] " Måns Rullgård
2013-11-20  4:29   ` Masahiro Yamada

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.