Linux 5.15 Enabling "-Werror" By Default For All Kernel Builds

Written by Michael Larabel in Linux Kernel on 5 September 2021 at 03:45 PM EDT. 45 Comments
A change made by Linus Torvalds and merged today for Linux 5.15 is enabling the "-Werror" compiler flag by default for all kernel builds.

The "-Werror" compiler flag treats all warnings as build errors. By promoting all warnings to errors, it enforces the developers to ensure such build warnings that may otherwise go unnoticed or only loosely concerned about by developers to now treat it with priority given that it will interrupt the build process. Many software projects already use "-Werror" by default to enforce better quality control in ensuring warnings get addressed, but most using it tend not to be the size of the Linux kernel.

Linus Torvalds commented with the change, "We really should always have a clean build, and will disable specific over-eager warnings as required, if we can't fix them. But while I fairly religiously enforce that in my own tree, it doesn't get enforced by various build robots that don't necessarily report warnings. So this just makes '-Werror' a default compiler flag."

However, this patch does also add WERROR as a Kconfig switch. This allows for disabling the "-Werror" flag should new compiler versions introduce new warnings that can't be immediately fixed by the kernel or other selective issues where making a warning-free kernel isn't feasible. The WERROR option is enabled by default for all kernel builds.

Linus ended the patch message with, "Hopefully this will mean that I get fewer pull requests that have new warnings that were not noticed by various automation we have in place. Knock wood."
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via

Popular News This Week