Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1659384
| From | David Rientjes <rientjes@google.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC] clang: 'unused-function' warning on static inline functions |
| Date | 2017-06-07 08:00 +0200 |
| Message-ID | <tPCaB-2s3-5@gated-at.bofh.it> (permalink) |
| References | (2 earlier) <tPkGJ-82Q-5@gated-at.bofh.it> <tPpGq-2N6-17@gated-at.bofh.it> <tPud4-5O1-17@gated-at.bofh.it> <tPud4-5O1-15@gated-at.bofh.it> <tPx1f-7Cp-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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?
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC] clang: 'unused-function' warning on static inline functions Matthias Kaehlcke <mka@chromium.org> - 2017-05-30 20:20 +0200
Re: [RFC] clang: 'unused-function' warning on static inline functions Matthias Kaehlcke <mka@chromium.org> - 2017-06-01 02:00 +0200
Re: [RFC] clang: 'unused-function' warning on static inline functions Arnd Bergmann <arnd@arndb.de> - 2017-06-06 13:20 +0200
Re: [RFC] clang: 'unused-function' warning on static inline functions Linus Torvalds <torvalds@linux-foundation.org> - 2017-06-06 18:40 +0200
Re: [RFC] clang: 'unused-function' warning on static inline functions Matthias Kaehlcke <mka@chromium.org> - 2017-06-06 23:30 +0200
Re: [RFC] clang: 'unused-function' warning on static inline functions Linus Torvalds <torvalds@linux-foundation.org> - 2017-06-06 23:30 +0200
Re: [RFC] clang: 'unused-function' warning on static inline functions Matthias Kaehlcke <mka@chromium.org> - 2017-06-07 02:30 +0200
Re: [RFC] clang: 'unused-function' warning on static inline functions David Rientjes <rientjes@google.com> - 2017-06-07 08:00 +0200
Re: [RFC] clang: 'unused-function' warning on static inline functions Jens Axboe <axboe@kernel.dk> - 2017-06-06 23:30 +0200
Re: [RFC] clang: 'unused-function' warning on static inline functions Arnd Bergmann <arnd@arndb.de> - 2017-06-07 10:20 +0200
Re: [RFC] clang: 'unused-function' warning on static inline functions Steven Rostedt <rostedt@goodmis.org> - 2017-06-07 15:00 +0200
Re: [RFC] clang: 'unused-function' warning on static inline functions Arnd Bergmann <arnd@arndb.de> - 2017-06-07 15:20 +0200
csiph-web