
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