[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.10.1706062257040.124117@chino.kir.corp.google.com>
Date: Tue, 6 Jun 2017 22:59:50 -0700 (PDT)
From: David Rientjes <rientjes@...gle.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>,
Matthias Kaehlcke <mka@...omium.org>
cc: Arnd Bergmann <arnd@...db.de>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Christoph Hellwig <hch@....de>, Jens Axboe <axboe@...nel.dk>,
Steven Rostedt <rostedt@...dmis.org>,
Douglas Anderson <dianders@...omium.org>,
Guenter Roeck <linux@...ck-us.net>,
Mark Brown <broonie@...nel.org>,
David Miller <davem@...emloft.net>
Subject: Re: [RFC] clang: 'unused-function' warning on static inline
functions
On Tue, 6 Jun 2017, Matthias Kaehlcke wrote:
> 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.
>
I've followed up with a patch that handles this behavior in compiler-gcc.h
since clang defines __GNUC__ as well, so clang gets both compiler-gcc.h
and compiler-clang.h behavior.
I've tested it, but please feel free to add your Tested-by for more
confidence in the change.
Linus, who currently maintains include/linux/compiler*.h changes? I see
only an entry for a sparse maintainer. I'd happily manage a cross
compiler setup if it would be helpful to prevent this type of issue in the
future. First question would be if there is a minimum gcc major version
intended to be supported?
Powered by blists - more mailing lists