
Dear Masahiro Yamada,
In message 1384770105-32364-1-git-send-email-yamada.m@jp.panasonic.com you wrote:
Currently U-boot defins bool type by including <stdbool.h> rather than defining directly. But it does not work for some cross compilers.
Can you explain why this fails?
AFAICT, <stdbool.h> is a compiler provided header file, which is mandatory by the C99 ISO standard. So if a compiler fails to work using it, it looks as if the compiler was broken.
In file included from /home/yamada/u-boot/arch/blackfin/include/asm/blackfin.h:13, 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: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'bfin_os_log_check'
Which code does the compiler generate for line # 54:
extern bool bfin_os_log_check(void);
diff --git a/include/linux/stddef.h b/include/linux/stddef.h index c540f61..5893ec9 100644 --- a/include/linux/stddef.h +++ b/include/linux/stddef.h @@ -12,6 +12,11 @@ #include <linux/types.h> #endif
+enum {
- false = 0,
- true = 1
+};
This looks fishy to me. Files that used to include <stdbool.h> do not necessarily include <linux/stddef.h>, so they may now be missing the definitions of "true" and "false".
For example, arch/arm/cpu/armv7/mx6/soc.c (which you touched above) does not include <linux/stddef.h> ...
diff --git a/include/linux/types.h b/include/linux/types.h index 9aebc4e..157e1ae 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -3,7 +3,6 @@
#include <linux/posix_types.h> #include <asm/types.h> -#include <stdbool.h>
#ifndef __KERNEL_STRICT_NAMES
@@ -18,6 +17,8 @@ typedef __kernel_daddr_t daddr_t; typedef __kernel_key_t key_t; typedef __kernel_suseconds_t suseconds_t;
+typedef _Bool bool;
#ifdef __KERNEL__ typedef __kernel_uid32_t uid_t; typedef __kernel_gid32_t gid_t;
I can't say that I'm happy with that. I think we should first understand the real cause of the problem.
Best regards,
Wolfgang Denk