lkml.org 
[lkml]   [2017]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC] clang: 'unused-function' warning on static inline functions
    El Tue, Jun 06, 2017 at 02:28:03PM -0700 Linus Torvalds ha dit:

    > I applied the patch from David Rientjes to just make "inline"
    > automatically mean "maybe unused" for clang.

    Unfortunately as is the patch doesn't work:

    include/linux/compiler-clang.h:20:9: error: 'inline' macro redefined [-Werror,-Wmacro-redefined]
    #define inline inline __attribute__((unused))
    ^
    include/linux/compiler-gcc.h:78:9: note: previous definition is here
    #define inline inline notrace

    Another version of David's patch (https://lkml.org/lkml/2017/5/24/878)
    first undefines 'inline' before redefining it:

    #ifdef inline
    #undef inline
    #define inline inline __attribute__((unused))
    #endif

    This works at least in the sense of not causing compiler errors. I
    couldn't validate if it actually still indicates the compiler to
    inline a function, since in any case 'inline' is only a
    recommendation. In the few experiments I did without the patch clang
    didn't make a difference between static inline and non-inline
    functions.

    The redefinition above could be used to fix the build error, however
    it would imply to lose the extra attributes from compiler-gcc.h.

    \
     
     \ /
      Last update: 2017-06-12 00:58    [W:3.433 / U:0.392 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site