On Thu, Aug 29, 2024 at 09:37:34PM +0300, Jani Nikula wrote: > On Thu, 29 Aug 2024, Nathan Chancellor <nathan@xxxxxxxxxx> wrote: > > Since commit 6863f5643dd7 ("kbuild: allow Clang to find unused static > > inline functions for W=1 build"). clang warns about unused static inline > > functions in .c files, unlike GCC (they both do not warn for functions > > coming from .h files). This difference is worked around for the normal > > build by adding '__maybe_unused' to the definition of 'inline' but > > Masahiro wanted to disable it for W=1 to allow this difference to find > > unused/dead code. There have not been too many complaints as far as I am > > aware but I can see how it is surprising. > > Heh, I was just going to reply citing the same commit. > > I occasionally build with clang myself, and we do enable most W=1 by > default in the drm subsystem, so I was wondering why I hadn't hit > this. The crucial difference is that we lack -DKBUILD_EXTRA_WARN1 which > W=1 adds. > > I see there's no subdir-cppflags-y, but I don't see any harm in us > adding -Wundef and -DKBUILD_EXTRA_WARN1 to subdir-ccflags-y. After we > fix the fallout, of course. Do you? No, that seems entirely reasonable when your goal is to enable W=1 for your subsystem. > I don't much like the __maybe_unused stuff, but I guess it's fine as a > stopgap measure, and then we can grep for that when running out of > things to do. :p Perhaps worth a TODO or something? Maybe a kernel newbie could work on that at some point if it is not high enough priority. Cheers, Nathan