4 ms·
not sure why your comment is downvoted. The only way to ensure discipline and rid a large code base of warnings is to use -Werror It may sound drastic until y
by DyslexicAtheist 3y ago
not sure why your comment is downvoted.
The only way to ensure discipline and rid a large code base of warnings is to use -Werror
It may sound drastic until you're the poor intern that needs to refactor an active codebase with thousands of warning. Other than the technical debt it creates you're setting yourself up for having serious issue slipping through in all the noise.
"But some warnings might be false positives" ?
If one really must override the behavior it should be done explicitly and with a strong justification. This is possible either with a pragma[1]
#pragma GCC diagnostic ignored "-Wfoo"
or by globally[2] removing the entire warning category.
-Wno-foo
[1] http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html
[2] https://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Warning-Options.html https://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Warning-Options...
- hulitu 3y ago> The only way to ensure discipline and rid a large code base of warnings is to use -Werror And this works as long as everybody has the same setup as you. This is unfortunately never the case. Kernel changes, libc changes, the compiler changes and sooner or later you will break the build.
- pjmlp 3y agoAllow developers to do whatever they feel like, impose -Werror on CI/CD and PR.