From: David Rientjes <rientjes@google.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
Matthias Kaehlcke <mka@chromium.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
Steven Rostedt <rostedt@goodmis.org>,
Douglas Anderson <dianders@chromium.org>,
Guenter Roeck <linux@roeck-us.net>,
Mark Brown <broonie@kernel.org>,
David Miller <davem@davemloft.net>
Subject: Re: [RFC] clang: 'unused-function' warning on static inline functions
Date: Tue, 6 Jun 2017 22:59:50 -0700 (PDT) [thread overview]
Message-ID: <alpine.DEB.2.10.1706062257040.124117@chino.kir.corp.google.com> (raw)
In-Reply-To: <20170607002840.GA141096@google.com>
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?
next prev parent reply other threads:[~2017-06-07 5:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-30 18:13 [RFC] clang: 'unused-function' warning on static inline functions Matthias Kaehlcke
2017-05-31 23:55 ` Matthias Kaehlcke
2017-06-06 11:16 ` Arnd Bergmann
2017-06-06 16:32 ` Linus Torvalds
2017-06-06 21:23 ` Matthias Kaehlcke
2017-06-06 21:28 ` Linus Torvalds
2017-06-07 0:28 ` Matthias Kaehlcke
2017-06-07 5:59 ` David Rientjes [this message]
2017-06-07 19:43 ` Arnd Bergmann
2017-06-07 20:36 ` Linus Torvalds
2017-06-07 21:24 ` Steven Rostedt
2017-06-08 8:59 ` Arnd Bergmann
2017-06-06 21:29 ` Jens Axboe
2017-06-07 8:17 ` Arnd Bergmann
2017-06-07 12:58 ` Steven Rostedt
2017-06-07 13:12 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.10.1706062257040.124117@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=axboe@kernel.dk \
--cc=broonie@kernel.org \
--cc=davem@davemloft.net \
--cc=dianders@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mingo@kernel.org \
--cc=mka@chromium.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).