• Masahiro Yamada's avatar
    kbuild: allow Clang to find unused static inline functions for W=1 build · 6863f564
    Masahiro Yamada authored
    GCC and Clang have different policy for -Wunused-function; GCC does not
    warn unused static inline functions at all whereas Clang does if they
    are defined in source files instead of included headers although it has
    been suppressed since commit abb2ea7d ("compiler, clang: suppress
    warning for unused static inline functions").
    
    We often miss to delete unused functions where 'static inline' is used
    in *.c files since there is no tool to detect them. Unused code remains
    until somebody notices. For example, commit 075ddd75 ("regulator:
    core: remove unused rdev_get_supply()").
    
    Let's remove __maybe_unused from the inline macro to allow Clang to
    start finding unused static inline functions. For now, we do this only
    for W=1 build since it is not a good idea to sprinkle warnings for the
    normal build (e.g. 35 warnings for arch/x86/configs/x86_64_defconfig).
    
    My initial attempt was to add -Wno-unused-function for no W= build
    (https://lor...
    6863f564
Makefile.extrawarn 2.61 KB