News for hackers. Stuff that matters.
Re:My favorite C compiler flags during development by DyslexicAtheist on Sunday April 30, 2023 @04:51AM (#35760793)
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

[2] https://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Warning-Options...

Re:My favorite C compiler flags during development by hulitu on Sunday April 30, 2023 @05:51AM (#35761080)
> 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.

Re:My favorite C compiler flags during development by pjmlp on Sunday April 30, 2023 @06:40AM (#35761318)
Allow developers to do whatever they feel like, impose -Werror on CI/CD and PR.