[PATCH] build_bug.h: Also define static_assert() when __CHECKER__ is defined

Tom Rini trini at konsulko.com
Wed May 3 22:02:38 CEST 2023


On Thu, Jan 26, 2023 at 07:17:48PM +0100, Christophe Leroy wrote:

> When doing a build with C=2, the following failure is encountered on
> several files:
> 
> 	  CHECK   arch/powerpc/cpu/mpc8xxx/fsl_lbc.c
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c: note: in included file (through arch/powerpc/include/asm/global_data.h, include/init.h):
> 	include/asm-generic/global_data.h:494:21: error: Expected ) in function declarator
> 	include/asm-generic/global_data.h:494:21: error: got (
> 
> And because of the error, the interesting part which are the
> warnings don't appear. This is because static_assert() is defined
> only when __CHECKER__ is not defined.
> 
> Add a stub when __CHECKER__ is defined. With that fix, the expected
> warnings are now seen:
> 
> 	  CHECK   arch/powerpc/cpu/mpc8xxx/fsl_lbc.c
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:32:27: warning: incorrect type in argument 1 (different address spaces)
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:32:27:    expected unsigned int const volatile [noderef] <asn:2> *addr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:32:27:    got unsigned int *
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:32:45: warning: incorrect type in argument 1 (different address spaces)
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:32:45:    expected unsigned int const volatile [noderef] <asn:2> *addr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:32:45:    got unsigned int *
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:35:24: warning: incorrect type in argument 1 (different address spaces)
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:35:24:    expected unsigned int const volatile [noderef] <asn:2> *addr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:35:24:    got unsigned int *
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:35:40: warning: incorrect type in argument 1 (different address spaces)
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:35:40:    expected unsigned int const volatile [noderef] <asn:2> *addr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:35:40:    got unsigned int *
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:67:17: warning: incorrect type in argument 1 (different address spaces)
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:67:17:    expected unsigned int volatile [noderef] <asn:2> *addr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:67:17:    got unsigned int *
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:68:17: warning: incorrect type in argument 1 (different address spaces)
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:68:17:    expected unsigned int volatile [noderef] <asn:2> *addr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:68:17:    got unsigned int *
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:72:17: warning: incorrect type in argument 1 (different address spaces)
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:72:17:    expected unsigned int volatile [noderef] <asn:2> *addr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:72:17:    got unsigned int *
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:73:17: warning: incorrect type in argument 1 (different address spaces)
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:73:17:    expected unsigned int volatile [noderef] <asn:2> *addr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:73:17:    got unsigned int *
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:78:9: warning: incorrect type in argument 1 (different address spaces)
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:78:9:    expected unsigned int volatile [noderef] <asn:2> *addr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:78:9:    got unsigned int *
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:79:9: warning: incorrect type in argument 1 (different address spaces)
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:79:9:    expected unsigned int volatile [noderef] <asn:2> *addr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:79:9:    got unsigned int *
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:131:22: warning: incorrect type in argument 1 (different address spaces)
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:131:22:    expected unsigned int const volatile [noderef] <asn:2> *addr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:131:22:    got unsigned int *
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:132:49: warning: incorrect type in argument 1 (different address spaces)
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:132:49:    expected unsigned int const volatile [noderef] <asn:2> *addr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:132:49:    got unsigned int *
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:144:26: warning: incorrect type in argument 1 (different address spaces)
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:144:26:    expected unsigned int volatile [noderef] <asn:2> *addr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:144:26:    got unsigned int [usertype] *mxmr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:144:41: warning: incorrect type in argument 1 (different address spaces)
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:144:41:    expected unsigned int const volatile [noderef] <asn:2> *addr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:144:41:    got unsigned int [usertype] *mxmr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:145:27: warning: incorrect type in argument 1 (different address spaces)
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:145:27:    expected unsigned int volatile [noderef] <asn:2> *addr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:145:27:    got unsigned int *
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:146:32: warning: incorrect type in argument 1 (different address spaces)
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:146:32:    expected unsigned int const volatile [noderef] <asn:2> *addr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:146:32:    got unsigned int *
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:149:39: warning: incorrect type in argument 1 (different address spaces)
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:149:39:    expected unsigned int const volatile [noderef] <asn:2> *addr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:149:39:    got unsigned int [usertype] *mxmr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:155:18: warning: incorrect type in argument 1 (different address spaces)
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:155:18:    expected unsigned int volatile [noderef] <asn:2> *addr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:155:18:    got unsigned int [usertype] *mxmr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:155:33: warning: incorrect type in argument 1 (different address spaces)
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:155:33:    expected unsigned int const volatile [noderef] <asn:2> *addr
> 	arch/powerpc/cpu/mpc8xxx/fsl_lbc.c:155:33:    got unsigned int [usertype] *mxmr
> 
> Signed-off-by: Christophe Leroy <christophe.leroy at csgroup.eu>

Based on my re-read of the thread in patchwork, it seems like the best
answer would be to re-sync this include, along with a few others, from
the latest kernel release, yes?

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20230503/e9d46255/attachment.sig>


More information about the U-Boot mailing list