[PATCH] Revert "Enable '-Werror' by default for all kernel builds"
fweimer at redhat.com
Mon Sep 13 09:50:31 UTC 2021
* Pavel Machek:
> Do we really want developers treat warnings as errors? When the code
> is okay but some random version of gcc dislikes it...
There are some warnings-as-errors which are quite reasonable, like
-Werror=implicit-function-declaration (which we can't make the compiler
default without cleaning up userspace first) and perhaps
-Werror=implicit-int. Some other warnings can be used to enforce coding
style, and there -Werror could make sense as well (-Werror=vla and
But there are also warnings which are emitted by the GCC middle-end (the
optimizers), and turning on -Werror for those is very problematic.
These warnings are very target-specific and also depend on compiler
version and optimization parameters. Unfortunately that includes the
buffer size warnings based on function attributes (which would otherwise
be a good fit for the kernel because it uses few external headers).
GCC also lacks a facility to suppress warnings if they concern code that
was introduced during optimization and removed again later
(e.g. inlining, constant propagation, dead code removal).
More information about the Linux-security-module-archive