CACI-International / ergo-cpp

A C++ build system library for ergo.
MIT License
2 stars 0 forks source link

Add option to make compiler warnings visible #7

Closed calebzulawski closed 1 year ago

calebzulawski commented 1 year ago

I'm pretty sure this is as simple as writing stderr (and maybe stdout) during compilation.

stderr is unbuffered, so will warnings from multiple simultaneous tasks interfere? It might be appropriate to use std:log:warn to keep them coherent

afranchuk commented 1 year ago

Yeah, they would definitely interfere. One possibility is to store them all and print them at the end. Or just print them to stdout (after all, the user/configuration "asked" for the output). Using the log is also a good idea, and maybe the most appropriate.

And of course I'll throw in my usual plug to invert the warning workflow, promoting all of them to errors and then adding #pragmas to ignore where desired. It's annoying for third-party headers, so at scale that's burdensome.

An interesting alternative workflow would be to run static analysis tools instead (which undoubtedly incorporate compiler warnings as well). While such a workflow is a bit less familiar to most developers, such tools provide much more insight, both with regard to finding more complicated warning situations as well as providing suggestions to fix them. If such tools could be limited to analyze e.g. only files with unstaged changes in git, that would likely greatly speed up analysis but provide great info for developers looking to check their changes.