Is it time to --enable-warnings?

Fred Wright fw at fwright.net
Wed Feb 12 21:42:17 UTC 2025


On Tue, 11 Feb 2025, Hal Murray wrote:

>> For example, I just submitted an MR to fix a warning for something which
>> is perfectly legal, but which broke the build here due to -Werror.
>
> Thanks.  Just curious.  What OS/Distro found that?

It's clang 6.  The OS doesn't enter into it.

>> Turning on -Werror in general is a really bad idea.  The "nonportability"
>> in question is the huge variation across compilers on what produces
>> warnings.  There are lots of things which are perfectly legal C code but
>> which the compiler may decide to warn about, just in case you *may* have
>> done something unintended.  There's no way to predict when that happens,
>> so turning on -Werror by default is just a recipe for broken builds.
>
> --disable-Werror will turn it off.  My expectation is that with a few
> fixes like yours we won't have many problems.  If that turns out to be
> wrong, we can change the default.
>
> About "the huge variation across compilers"...
>
> Is that a real problem?  If so, how much of the problem is old old
> compilers vs new compilers?  How much do we care about it being easy to
> port to ancient gear vs finding a rare bug in modern environments?

Warnings are for developers, not end users.  Inflicting broken builds on 
end users is far more likely to piss people off than to get useful 
feedback.

It's also not just about old vs. new in the direction you think.  It's not 
at all uncommon for *newer* compilers to issue new warnings.

Fred Wright


More information about the devel mailing list