El Tue, Jun 06, 2017 at 09:32:35AM -0700 Linus Torvalds ha dit: > On Tue, Jun 6, 2017 at 4:16 AM, Arnd Bergmann <a...@arndb.de> wrote: > > > > Those should all be fairly easy to address, I'd vote for leaving the > > warning enabled > > in clang, and possibly asking the gcc maintainers to add a similar feature > > for > > warning about it. > > Hell no. That warning is pointless shit.
I tend to disagree, the warning is useful to detect truly unused static inline functions, which should be removed, rather than be carried around/maintained for often long periods of time. Also lets not forget that the kernel is somewhat special with its heavy use of #ifdefs , which leads to the larger number of false positives. At least for many other projects the warning makes perfect sense IMO. A switch to enable/disable it could be interesting. > The function is inlined. If it's not used, why the f*ck should you get > a warning? To detect dead code? > Just to add more pointless #ifdef'fery around a function that is > perhaps only used under certain circumstances? The vast majority of instances could be fixed by simply marking the function as __maybe_unused, which is already widely used in the kernel. I don't fully understand why adding the attribute to static inline functions (in .c files) is considered an offense, while it is a standard practice for non-inline function. Granted, unused static inline functions don't waste (binary) space, but doesn't the extra capability to detect dead code also have a value?