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

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@csgroup.eu --- CC: Masahiro Yamada masahiroy@kernel.org --- include/linux/build_bug.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/include/linux/build_bug.h b/include/linux/build_bug.h index 9c7088bafa4..5a819961f15 100644 --- a/include/linux/build_bug.h +++ b/include/linux/build_bug.h @@ -12,6 +12,7 @@ #define BUILD_BUG_ON_MSG(cond, msg) (0) #define BUILD_BUG_ON(condition) (0) #define BUILD_BUG() (0) +#define static_assert(expr, ...) #else /* __CHECKER__ */
/* Force a compilation error if a constant expression is not a power of 2 */

On 26/01/2023 19.17, 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:
So sparse has supported _Static_assert since basically forever, and in the linux version of build_bug.h, the static_assert definition is not inside #ifndef __CHECKER__. So I think a better fix is to synchronize build_bug.h with linux again, so that we actually also do those static_asserts with sparse (if nothing else then as a sanity check of sparse itself, it really should grok ICEs and barf at 'static_assert(sizeof(int) == 3)').
The __CHECKER__ guard around most of the file vanished from upstream in 527edbc18a70, just before the static_assert define was added in 6bab69c65013, and I didn't notice that discrepancy when porting that to U-Boot in ef0f4e834c66.
Rasmus

Le 27/01/2023 à 08:43, Rasmus Villemoes a écrit :
[Vous ne recevez pas souvent de courriers de rasmus.villemoes@prevas.dk. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
On 26/01/2023 19.17, 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:
So sparse has supported _Static_assert since basically forever, and in the linux version of build_bug.h, the static_assert definition is not inside #ifndef __CHECKER__. So I think a better fix is to synchronize build_bug.h with linux again, so that we actually also do those static_asserts with sparse (if nothing else then as a sanity check of sparse itself, it really should grok ICEs and barf at 'static_assert(sizeof(int) == 3)').
The __CHECKER__ guard around most of the file vanished from upstream in 527edbc18a70, just before the static_assert define was added in 6bab69c65013, and I didn't notice that discrepancy when porting that to U-Boot in ef0f4e834c66.
Ah right, I didn't see that difference with Linux.
By the way, there are other changes in Linux that we are missing in Uboot and create problems for me when using sparse:
80591e61a0f7 ("kbuild: tell sparse about the $ARCH") 6c49f359ca14 ("kbuild: disable sparse warnings about unknown attributes")
Also I have a problem with the following u-boot commit : aa9e891c633 ("include/linux/stddef.h: avoid 'warning: preprocessor token offsetof redefined'")
On uboot mainline I get:
CHECK drivers/pci/pci-uclass.c drivers/pci/pci-uclass.c:88:9: error: typename in expression drivers/pci/pci-uclass.c:88:9: error: typename in expression drivers/pci/pci-uclass.c:88:9: error: undefined identifier 'offsetof' drivers/pci/pci-uclass.c:88:9: error: cast from unknown type drivers/pci/pci-uclass.c:88:9: error: undefined identifier 'offsetof' drivers/pci/pci-uclass.c:88:9: error: cast from unknown type
If I revert that patch I get
CHECK drivers/pci/pci-uclass.c drivers/pci/pci-uclass.c:852:20: warning: function 'board_pci_fixup_dev' with external linkage has definition drivers/pci/pci-uclass.c:594:17: warning: incorrect type in argument 1 (different address spaces) drivers/pci/pci-uclass.c:594:17: expected unsigned char volatile [noderef] asn:2 *addr drivers/pci/pci-uclass.c:594:17: got unsigned char volatile [usertype] * drivers/pci/pci-uclass.c:597:17: warning: incorrect type in argument 1 (different address spaces) drivers/pci/pci-uclass.c:597:17: expected unsigned short volatile [noderef] asn:2 *addr drivers/pci/pci-uclass.c:597:17: got unsigned short volatile [usertype] * drivers/pci/pci-uclass.c:600:17: warning: incorrect type in argument 1 (different address spaces) drivers/pci/pci-uclass.c:600:17: expected unsigned int volatile [noderef] asn:2 *addr drivers/pci/pci-uclass.c:600:17: got unsigned int volatile [usertype] * drivers/pci/pci-uclass.c:625:27: warning: incorrect type in argument 1 (different address spaces) drivers/pci/pci-uclass.c:625:27: expected unsigned char const volatile [noderef] asn:2 *addr drivers/pci/pci-uclass.c:625:27: got unsigned char volatile [usertype] * drivers/pci/pci-uclass.c:628:27: warning: incorrect type in argument 1 (different address spaces) drivers/pci/pci-uclass.c:628:27: expected unsigned short const volatile [noderef] asn:2 *addr drivers/pci/pci-uclass.c:628:27: got unsigned short volatile [usertype] * drivers/pci/pci-uclass.c:631:27: warning: incorrect type in argument 1 (different address spaces) drivers/pci/pci-uclass.c:631:27: expected unsigned int const volatile [noderef] asn:2 *addr drivers/pci/pci-uclass.c:631:27: got unsigned int volatile [usertype] * drivers/pci/pci-uclass.c:1563:16: warning: Using plain integer as NULL pointer drivers/pci/pci-uclass.c:1841:1: warning: symbol '_u_boot_list_2_uclass_driver_2_pci' was not declared. Should it be static? drivers/pci/pci-uclass.c:1863:1: warning: symbol '_u_boot_list_2_driver_2_pci_bridge_drv' was not declared. Should it be static? drivers/pci/pci-uclass.c:1870:1: warning: symbol '_u_boot_list_2_uclass_driver_2_pci_generic' was not declared. Should it be static? drivers/pci/pci-uclass.c:1880:1: warning: symbol '_u_boot_list_2_driver_2_pci_generic_drv' was not declared. Should it be static?
But there are other files that then exhibit the original problem:
On mainline:
CHECK drivers/rtc/ds1374.c drivers/rtc/ds1374.c:68:12: warning: symbol 'RtcTodAddr' was not declared. Should it be static?
With above commit reverted;
CHECK drivers/rtc/ds1374.c drivers/rtc/ds1374.c: note: in included file (through include/compiler.h, include/env.h, include/command.h): /opt/cldk-1.4.11/lib/gcc/ppc-linux/5.5.0/include/stddef.h:417:9: warning: preprocessor token offsetof redefined drivers/rtc/ds1374.c: note: in included file (through include/linux/posix_types.h, include/linux/types.h, include/time.h, include/common.h): include/linux/stddef.h:19:9: this was the original definition drivers/rtc/ds1374.c:68:12: warning: symbol 'RtcTodAddr' was not declared. Should it be static?
What can we do about it ? At least reverting it replaces an error with a warning, I think that's better isn't it ?
Thanks Christophe

On 27/01/2023 09.41, Christophe Leroy wrote:
Also I have a problem with the following u-boot commit : aa9e891c633 ("include/linux/stddef.h: avoid 'warning: preprocessor token offsetof redefined'")
On uboot mainline I get:
...
What can we do about it ? At least reverting it replaces an error with a warning, I think that's better isn't it ?
Well, I don't have much time to look at that offsetof issue, but I know that I simplified linux recently in that area, dropping that poor man's definition of offsetof ('((size_t)&((TYPE *)0)->MEMBER)') and defining it always (also for __CHECKER__) in terms of __builtin_offsetof. See commit 14e83077d55f.
If we somehow include a system header that also defines offsetof, and end up doing that after we've included our own stddef.h, well, that's a bug in whatever code includes <stddef.h>, we really should not do that.
Rasmus

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@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?

Le 03/05/2023 à 22:02, Tom Rini a écrit :
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@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?
Yes that's right, a re-sync should work, together with a revert of aa9e891c633 ("include/linux/stddef.h: avoid 'warning: preprocessor token offsetof redefined'") IIRC
Thanks Christophe

On Thu, May 04, 2023 at 06:15:13AM +0000, Christophe Leroy wrote:
Le 03/05/2023 à 22:02, Tom Rini a écrit :
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@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?
Yes that's right, a re-sync should work, together with a revert of aa9e891c633 ("include/linux/stddef.h: avoid 'warning: preprocessor token offsetof redefined'") IIRC
Will you be sending a patch, or should I put it on my TODO list (and how exactly do I trigger the above problem?). Thanks.

Le 04/05/2023 à 15:54, Tom Rini a écrit :
On Thu, May 04, 2023 at 06:15:13AM +0000, Christophe Leroy wrote:
Le 03/05/2023 à 22:02, Tom Rini a écrit :
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@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?
Yes that's right, a re-sync should work, together with a revert of aa9e891c633 ("include/linux/stddef.h: avoid 'warning: preprocessor token offsetof redefined'") IIRC
Will you be sending a patch, or should I put it on my TODO list (and how exactly do I trigger the above problem?). Thanks.
Well, I was hoping to find some time during winter but I never succeeded. So if you can put it on your TODO list that's fine. Maybe you have some automated way to backport stuff from Linux to U-boot ?
Reproduction is done easily with:
make CROSS_COMPILE=powerpc-linux- CMPC885_defconfig
followed by
make CROSS_COMPILE=powerpc-linux- C=2
Then everytime you get a repetitive syntax-based error, it's something that shouldn't happen. Examples:
CHECK arch/powerpc/cpu/mpc8xx/cpu.c
arch/powerpc/cpu/mpc8xx/cpu.c: note: in included file (through arch/powerpc/include/asm/global_data.h): include/asm-generic/global_data.h:494:21: error: Expected ) in function declarator include/asm-generic/global_data.h:494:21: error: got (
arch/powerpc/cpu/mpc8xx/cpu.c: note: in included file (through include/compiler.h, include/env.h, include/net.h): /opt/gcc-12.2.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/12.2.0/include/stddef.h:433:14: error: expected ; at end of declaration /opt/gcc-12.2.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/12.2.0/include/stddef.h:433:14: error: Expected } at end of specifier /opt/gcc-12.2.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/12.2.0/include/stddef.h:433:14: error: got __max_align_f128 /opt/gcc-12.2.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/12.2.0/include/stddef.h:435:1: error: Expected ; at the end of type declaration /opt/gcc-12.2.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/12.2.0/include/stddef.h:435:1: error: got }
Christophe

Le 04/05/2023 à 19:22, Christophe Leroy a écrit :
Le 04/05/2023 à 15:54, Tom Rini a écrit :
On Thu, May 04, 2023 at 06:15:13AM +0000, Christophe Leroy wrote:
Le 03/05/2023 à 22:02, Tom Rini a écrit :
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@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?
Yes that's right, a re-sync should work, together with a revert of aa9e891c633 ("include/linux/stddef.h: avoid 'warning: preprocessor token offsetof redefined'") IIRC
Will you be sending a patch, or should I put it on my TODO list (and how exactly do I trigger the above problem?). Thanks.
Well, I was hoping to find some time during winter but I never succeeded. So if you can put it on your TODO list that's fine. Maybe you have some automated way to backport stuff from Linux to U-boot ?
Reproduction is done easily with:
make CROSS_COMPILE=powerpc-linux- CMPC885_defconfig
followed by
make CROSS_COMPILE=powerpc-linux- C=2
Then everytime you get a repetitive syntax-based error, it's something that shouldn't happen. Examples:
CHECK arch/powerpc/cpu/mpc8xx/cpu.c
arch/powerpc/cpu/mpc8xx/cpu.c: note: in included file (through arch/powerpc/include/asm/global_data.h): include/asm-generic/global_data.h:494:21: error: Expected ) in function declarator include/asm-generic/global_data.h:494:21: error: got (
arch/powerpc/cpu/mpc8xx/cpu.c: note: in included file (through include/compiler.h, include/env.h, include/net.h): /opt/gcc-12.2.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/12.2.0/include/stddef.h:433:14: error: expected ; at end of declaration /opt/gcc-12.2.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/12.2.0/include/stddef.h:433:14: error: Expected } at end of specifier /opt/gcc-12.2.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/12.2.0/include/stddef.h:433:14: error: got __max_align_f128 /opt/gcc-12.2.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/12.2.0/include/stddef.h:435:1: error: Expected ; at the end of type declaration /opt/gcc-12.2.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/12.2.0/include/stddef.h:435:1: error: got }
There is the same kind of issue with qemu-x86_64_defconfig :
make qemu-x86_64_defconfig
make C=2
... CHECK arch/x86/lib/bdinfo.c arch/x86/lib/bdinfo.c: note: in included file (through include/compiler.h, arch/x86/include/asm/mrccache.h, arch/x86/include/asm/global_data.h, include/init.h): /usr/lib/gcc/x86_64-redhat-linux/12/include/stddef.h:415:9: warning: preprocessor token offsetof redefined arch/x86/lib/bdinfo.c: note: in included file (through include/linux/posix_types.h, include/linux/types.h, include/time.h, include/common.h): include/linux/stddef.h:19:9: this was the original definition arch/x86/lib/bdinfo.c: note: in included file (through arch/x86/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 (
Christophe

On Thu, May 04, 2023 at 05:32:12PM +0000, Christophe Leroy wrote:
Le 04/05/2023 à 19:22, Christophe Leroy a écrit :
Le 04/05/2023 à 15:54, Tom Rini a écrit :
On Thu, May 04, 2023 at 06:15:13AM +0000, Christophe Leroy wrote:
Le 03/05/2023 à 22:02, Tom Rini a écrit :
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@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?
Yes that's right, a re-sync should work, together with a revert of aa9e891c633 ("include/linux/stddef.h: avoid 'warning: preprocessor token offsetof redefined'") IIRC
Will you be sending a patch, or should I put it on my TODO list (and how exactly do I trigger the above problem?). Thanks.
Well, I was hoping to find some time during winter but I never succeeded. So if you can put it on your TODO list that's fine. Maybe you have some automated way to backport stuff from Linux to U-boot ?
Reproduction is done easily with:
make CROSS_COMPILE=powerpc-linux- CMPC885_defconfig
followed by
make CROSS_COMPILE=powerpc-linux- C=2
Then everytime you get a repetitive syntax-based error, it's something that shouldn't happen. Examples:
CHECK arch/powerpc/cpu/mpc8xx/cpu.c
arch/powerpc/cpu/mpc8xx/cpu.c: note: in included file (through arch/powerpc/include/asm/global_data.h): include/asm-generic/global_data.h:494:21: error: Expected ) in function declarator include/asm-generic/global_data.h:494:21: error: got (
arch/powerpc/cpu/mpc8xx/cpu.c: note: in included file (through include/compiler.h, include/env.h, include/net.h): /opt/gcc-12.2.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/12.2.0/include/stddef.h:433:14: error: expected ; at end of declaration /opt/gcc-12.2.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/12.2.0/include/stddef.h:433:14: error: Expected } at end of specifier /opt/gcc-12.2.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/12.2.0/include/stddef.h:433:14: error: got __max_align_f128 /opt/gcc-12.2.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/12.2.0/include/stddef.h:435:1: error: Expected ; at the end of type declaration /opt/gcc-12.2.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/12.2.0/include/stddef.h:435:1: error: got }
There is the same kind of issue with qemu-x86_64_defconfig :
make qemu-x86_64_defconfig
make C=2
... CHECK arch/x86/lib/bdinfo.c arch/x86/lib/bdinfo.c: note: in included file (through include/compiler.h, arch/x86/include/asm/mrccache.h, arch/x86/include/asm/global_data.h, include/init.h): /usr/lib/gcc/x86_64-redhat-linux/12/include/stddef.h:415:9: warning: preprocessor token offsetof redefined arch/x86/lib/bdinfo.c: note: in included file (through include/linux/posix_types.h, include/linux/types.h, include/time.h, include/common.h): include/linux/stddef.h:19:9: this was the original definition arch/x86/lib/bdinfo.c: note: in included file (through arch/x86/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 (
Thanks, I _think_ we could add a CI test then, once this is resolved, so long as C=2 issues still give a zero exit status, or at least a specific one we can catch and say OK to that's not the same as a fail to build.

Le 04/05/2023 à 21:55, Tom Rini a écrit :
On Thu, May 04, 2023 at 05:32:12PM +0000, Christophe Leroy wrote:
Le 04/05/2023 à 19:22, Christophe Leroy a écrit :
Le 04/05/2023 à 15:54, Tom Rini a écrit :
On Thu, May 04, 2023 at 06:15:13AM +0000, Christophe Leroy wrote:
Le 03/05/2023 à 22:02, Tom Rini a écrit :
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@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?
Yes that's right, a re-sync should work, together with a revert of aa9e891c633 ("include/linux/stddef.h: avoid 'warning: preprocessor token offsetof redefined'") IIRC
Will you be sending a patch, or should I put it on my TODO list (and how exactly do I trigger the above problem?). Thanks.
Well, I was hoping to find some time during winter but I never succeeded. So if you can put it on your TODO list that's fine. Maybe you have some automated way to backport stuff from Linux to U-boot ?
Reproduction is done easily with:
make CROSS_COMPILE=powerpc-linux- CMPC885_defconfig
followed by
make CROSS_COMPILE=powerpc-linux- C=2
Then everytime you get a repetitive syntax-based error, it's something that shouldn't happen. Examples:
CHECK arch/powerpc/cpu/mpc8xx/cpu.c
arch/powerpc/cpu/mpc8xx/cpu.c: note: in included file (through arch/powerpc/include/asm/global_data.h): include/asm-generic/global_data.h:494:21: error: Expected ) in function declarator include/asm-generic/global_data.h:494:21: error: got (
arch/powerpc/cpu/mpc8xx/cpu.c: note: in included file (through include/compiler.h, include/env.h, include/net.h): /opt/gcc-12.2.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/12.2.0/include/stddef.h:433:14: error: expected ; at end of declaration /opt/gcc-12.2.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/12.2.0/include/stddef.h:433:14: error: Expected } at end of specifier /opt/gcc-12.2.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/12.2.0/include/stddef.h:433:14: error: got __max_align_f128 /opt/gcc-12.2.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/12.2.0/include/stddef.h:435:1: error: Expected ; at the end of type declaration /opt/gcc-12.2.0-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/12.2.0/include/stddef.h:435:1: error: got }
There is the same kind of issue with qemu-x86_64_defconfig :
make qemu-x86_64_defconfig
make C=2
... CHECK arch/x86/lib/bdinfo.c arch/x86/lib/bdinfo.c: note: in included file (through include/compiler.h, arch/x86/include/asm/mrccache.h, arch/x86/include/asm/global_data.h, include/init.h): /usr/lib/gcc/x86_64-redhat-linux/12/include/stddef.h:415:9: warning: preprocessor token offsetof redefined arch/x86/lib/bdinfo.c: note: in included file (through include/linux/posix_types.h, include/linux/types.h, include/time.h, include/common.h): include/linux/stddef.h:19:9: this was the original definition arch/x86/lib/bdinfo.c: note: in included file (through arch/x86/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 (
Thanks, I _think_ we could add a CI test then, once this is resolved, so long as C=2 issues still give a zero exit status, or at least a specific one we can catch and say OK to that's not the same as a fail to build.
I finally dig into what I did in January found that it was almost ready. So let me send a patch as it seems it fixes all issues.
Christophe
participants (3)
-
Christophe Leroy
-
Rasmus Villemoes
-
Tom Rini