Dan Carpenter <dan.carpen...@oracle.com> writes: > On Wed, Jan 26, 2022 at 12:21:49PM +0000, Christophe Leroy wrote: >> The code is enclosed in a #ifdef CONFIG_PPC64, it is not used for PPC32: >> >> /arch/powerpc/include/asm/bug.h >> 99 #ifdef CONFIG_PPC64 > > Ah... > > You know, life would be a lot easier for me personally if we added an > #ifndef __CHECKER__ as well... I can't compile PowerPC code so I can't > test a patch like that.
Ubuntu & Fedora both have cross compilers packaged, or there's cross compilers on kernel.org. But I assume you mean you'd rather not bother compiling for powerpc, which is fair enough. Do you mean something like below? I'm not sure about that, as it would prevent sparse from checking the actual BUG_ON code we're using, vs the generic version which we never use on 64-bit. Is there a smatch specific macro we could check? cheers diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h index 02c08d1492f8..5cbfe9d8232d 100644 --- a/arch/powerpc/include/asm/bug.h +++ b/arch/powerpc/include/asm/bug.h @@ -96,7 +96,7 @@ __label_warn_on: \ break; \ } while (0) -#ifdef CONFIG_PPC64 +#if defined(CONFIG_PPC64) && !defined(__CHECKER__) #define BUG_ON(x) do { \ if (__builtin_constant_p(x)) { \ if (x) \