The BUILD_BUG_ON macros moved from ubi_uboot.h to common.h
PATCH 1/3 The BUILD_BUG_ON macros moved from ubi_uboot.h to common.h
The BUILD_BUG_ON macros made availible for rest of the u-boot code by moving it from ubi_uboot.h to common.h. In Linux kernel this widely used macros is defined in kernel.h file.
--- include/common.h | 3 +++ include/ubi_uboot.h | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-)
include/common.h +3 -0
@@ -136,6 +136,9 @@ typedef volatile unsigned char vu_char;#define BUG_ON (condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)#endif /* BUG */ +/* Force a compilation error if condition is true */ +#define BUILD_BUG_ON (condition) ((void)sizeof(char[1 - 2*!!(condition)])) +typedef void (interrupt_handler_t )(void *);#include <asm/u-boot.h> /* boot information for Linux kernel */
include/ubi_uboot.h +0 -3
@@ -191,9 +191,6 @@ static inline long IS_ERR(const void *ptr)return IS_ERR_VALUE ((unsigned long )ptr); } -/* Force a compilation error if condition is true */ -#define BUILD_BUG_ON (condition) ((void)sizeof(char[1 - 2*!!(condition)])) -/* module */ #define THIS_MODULE 0#define try_module_get (...) 1
Signature · 1 line
1.6.3.3
PATCH 1/3 The BUILD_BUG_ON macros moved from ubi_uboot.h to common.h
Quoted 3 lines · On Thursday 01 April 2010 13:16:53 Michael Zaidman wrote:
The
BUILD_BUG_ONmacros made availible for rest of the u-boot code by moving it fromubi_uboot.htocommon.h. In Linux kernel this widely used macros is defined inkernel.hfile.
compiler.h might be a better place so that it is available to host tools too -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100402/2df3e63c/attachment.pgp
PATCH 1/3 The BUILD_BUG_ON macros moved from ubi_uboot.h to common.h
Quoted 8 lines · Mike Frysinger
Quoted 3 lines · On Thursday 01 April 2010 13:16:53 Michael Zaidman wrote:
The
BUILD_BUG_ONmacros made availible for rest of the u-boot code by moving it fromubi_uboot.htocommon.h. In Linux kernel this widely used macros is defined inkernel.hfile.
compiler.hmight be a better place so that it is available to host tools too -mike
The common.h includes image.h which includes compiler.h, so technically it should works also. I have a doubt however - what about location of similar staff such as BUG, BUG_ON, debug, error, etc. Should it also be moved into compiler.h file?
PATCH 1/3 The BUILD_BUG_ON macros moved from ubi_uboot.h to common.h
Quoted 11 lines · On Friday 02 April 2010 06:56:41 Michael Zaidman wrote:
Quoted 7 lines · Mike Frysinger
Quoted 3 lines · On Thursday 01 April 2010 13:16:53 Michael Zaidman wrote:
The
BUILD_BUG_ONmacros made availible for rest of the u-boot code by moving it fromubi_uboot.htocommon.h. In Linux kernel this widely used macros is defined inkernel.hfile.
compiler.hmight be a better place so that it is available to host tools tooThe
common.hincludesimage.hwhich includescompiler.h, so technically it should works also.
you're looking the wrong direction. host tools include compiler.h, they dont include common.h.
Quoted 2 lines
I have a doubt however - what about location of similar staff such as BUG,
BUG_ON, debug, error, etc. Should it also be moved intocompiler.hfile?
many should not. BUG_ON requires functions that only u-boot implements and are not available in host C libraries.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100402/ee8ba090/attachment.pgp
PATCH 1/3 The BUILD_BUG_ON macros moved from ubi_uboot.h to common.h
Quoted 6 lines · Mike Frysinger
Quoted 3 lines
The
common.hincludesimage.hwhich includescompiler.h, so technically it should works also.you're looking the wrong direction. ?host tools include
compiler.h, they dont includecommon.h.
It was clear to me. I meant the u-boot code here.
Quoted 6 lines
Quoted 3 lines
I have a doubt however - ?what about location of similar staff such as BUG,
BUG_ON, debug, error, etc. Should it also be moved intocompiler.hfile?many should not. ?BUG_ON requires functions that only u-boot implements and are not available in host C libraries.
So why do not place all useful staff which pass the compilation into compiler.h file?
-michael
PATCH 1/3 The BUILD_BUG_ON macros moved from ubi_uboot.h to common.h
Quoted 10 lines · On Saturday 03 April 2010 04:23:58 Michael Zaidman wrote:
Quoted 6 lines · Mike Frysinger
Quoted 3 lines
I have a doubt however - what about location of similar staff such as BUG,
BUG_ON, debug, error, etc. Should it also be moved intocompiler.hfile?many should not.
BUG_ONrequires functions that only u-boot implements and are not available in host C libraries.So why do not place all useful staff which pass the compilation into
compiler.hfile?
i just told you why: only things that work with general C libraries/compilers may go into compiler.h. BUG_ON does not fall into that category. BUILD_BUG_ON does.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100403/c221c192/attachment.pgp
PATCH 1/3 The BUILD_BUG_ON macros moved from ubi_uboot.h to common.h
Quoted 9 lines · Mike Frysinger
Quoted 8 lines · On Saturday 03 April 2010 04:23:58 Michael Zaidman wrote:
Quoted 6 lines · Mike Frysinger
Quoted 3 lines
I have a doubt however - ?what about location of similar staff such as BUG,
BUG_ON, debug, error, etc. Should it also be moved intocompiler.hfile?many should not. ?BUG_ON requires functions that only u-boot implements and are not available in host C libraries.
Quoted 8 lines
Quoted 2 lines
So why do not place all useful staff which pass the compilation into
compiler.hfile?i just told you why: only things that work with general C libraries/compilers may go into
compiler.h. ?BUG_ON does not fall into that category.BUILD_BUG_ONdoes.
-mike
Thanks, I understood this. All I am trying to say is that the compiler.h file probably is not the best choice for such things hosting. The fact that it is the common header file _ONLY_ between u-boot and host tools code does not mean that we should fill it with all kind of things we would share between both codes. And if we see necessity to shared some useful definitions perhaps it makes sense to place them into the header file especially dedicated for this purpose. -michael
PATCH 1/3 The BUILD_BUG_ON macros moved from ubi_uboot.h to common.h
Please see my proposal in
http://lists.denx.de/pipermail/u-boot/2010-May/071443.html
Regards,
Michael