On 8/23/25 5:42 AM, Andrew Morton wrote:
> On Fri, 22 Aug 2025 13:20:57 +0500 Muhammad Usama Anjum 
> <usama.an...@collabora.com> wrote:
> 
>> Recently, I reviewed a patch on the mm/kselftest mailing list about a
>> test which had obvious type mismatch fix in it. It was strange why that
>> wasn't caught during development and when patch was accepted. This led
>> me to discover that those extra compiler options to catch these warnings
>> aren't being used. When I added them, I found tens of warnings in just
>> mm suite.
>>
>> In this series, I'm adding these flags and fixing those warnings. In the
>> last try several months ago [1], I'd patches for individual tests. I've
>> made patches better by grouping the same type of fixes together. Hence
>> there is no changelog for individual patches.
> 
> I think it would be best to avoid adding warnings to selftests which
> aren't present in the main kernel code.  If only to avoid surprising
> people over what isn't permissible in selftests/.
> 
> In particular, there's an expectation that we can do
> 
> #else
> static inline int some_stub(type1 arg1, type2 arg2)
> {
> }
> #endif
> 
> without warning.  We do this extensively.

I'm only adding -Wunreachable-code -Wunused flags now. The above shouldn't
cause any warnings. I'll double check again in next series.

> 
> Also, please be aware that there's already a patch in mm-new which
> centralizes selftests' __maybe_unused definition.
> https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-centralise-maybe-unused-definition-in-kselftesth.patch
I'll rebase on top of it and send again.


-- 
---
Thanks,
Usama

Reply via email to