Zack's Kernel News

The New "No New Warnings" Warning

Recently, Linus threw all the kernel developers into a jar and shook the jar really hard by making all compiler warnings into errors by default. This broke everything for light years in all directions and resulted in much wailing and unhappy bioluminescent patterns.

Now things have returned pretty much to normal, but developers are each finding their own ways to deal with the new "no warnings" policy. For example, Paolo Bonzini submitted some KVM patches from a variety of other contributors, one of which was described in the patch comment as, "avoid warning with -Wbitwise-instead-of-logical."

Linus prepared to put Paulo back in the jar, saying:

"Christ. Please no.

"Guys, you can't just mindlessly shut off warnings without even thinking about the code.

"Apparently the compiler gives completely insane warning 'fixes' suggestions, and somebody just completely mindlessly followed that compiler badness.

"The way to do a logical 'or' (instead of a bitwise one on two boolean expressions) is to use '||'.

"Instead, the code was changed to completely insane

(int) boolexpr1 | (int) boolexpr2

"thing, which is entirely illegible and pointless, and no sane person should ever write code like that.

"In other words, the *proper* fix to a warning is to look at the code, and *understand* the code and the warning, instead of some mindless conversion to just avoid a warning.

"NEVER EVER do mindless changes to source code because the compiler tells you to. Apparently the clang people wrote a particularly bad warning 'explanation', and that's on clang.

"I'm not going to pull this. The clang warning fix is wrong, and then another commit literally disables accounting for another non-fatal run-time warning.

"Again – warnings are not an excuse to just 'mindlessly shut up the warning'.

"They need some thought.

"None of this kind of 'I'll do wrong things just to make the warning go away' garbage that this pull request has two very different examples of.

"I'm adding some clang people, because apparently that

note: cast one or both operands to int to silence this warning

"thing came from clang. Somebody in the clang community really needs to re-think their 'informational' messages.

"Giving people those kinds of insane suggestions is a disservice to everybody. Clang should fix their stupid 'note' before release. Please, guys."

And that was that.

The Author

The Linux kernel mailing list comprises the core of Linux development activities. Traffic volumes are immense, often reaching 10,000 messages in a week, and keeping up to date with the entire scope of development is a virtually impossible task for one person. One of the few brave souls to take on this task is Zack Brown.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Kernel News

    Chronicler Zack Brown reports on the latest news, views, dilemmas, and developments within the Linux kernel community.

  • Kernel News

    Adding git Documentation; Untangling the System Call Situation; and Bit or Bitmap?

  • Kernel News

    Chronicler Zack Brown reports on the latest news, views, dilemmas, and developments within the Linux kernel community.

  • Kernel News

     

  • Kernel News

    Chronicler Zack Brown reports on the NOVA filesystem, making system calls userspace only, and extending module support to plain executables. 

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News