Re:size_t-to-int vulnerability in Linux’s filesystem layer
by j1elo on Tuesday July 20, 2021 @07:17PM
(#27900474)
The golden rule is: use -Werror for Debug builds, so you catch and fix all warnings during development. That's fair enough.
But never ever leave -Werror enabled for building in Release mode. You'll be preventing your code from building as soon as a new compiler version goes out. Maintainers or code archeologist will have a much worse time than if this option was simply disabled to start with.
If you write for C compiler Foo 8, there's a decent chance Foo 9 will raise a warning which didn't exist before. Now you have to handle "why doesn't this compile" issues and distributions have to patch your sources to do future releases. And that's ignoring bugs like GCC in the past where in some versions you could not satisfy specific warnings.