Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Warnings as Errors #175

Open
DanRStevens opened this issue Sep 5, 2018 · 2 comments
Open

Enable Warnings as Errors #175

DanRStevens opened this issue Sep 5, 2018 · 2 comments

Comments

@DanRStevens
Copy link
Member

We can potentially enable warnings as errors. This could make sense for the CI builds, as it would report warnings as build failures, and force us to look at the logs.


Technical:

For MSVC there are two relevant settings to enable to treat warnings as errors. There is the /WX compiler flag, and the /WX linker flag.

For Clang and g++, the "-Werror" flag will promote warnings to errors.


As for the ramifications, when warnings are promoted to errors, it can prevent output of object files (.o), and halt the build process. Or rather, it can halt later build processes that depend on the current output. The CI servers should continue trying to compile non-dependent items, resulting in maximum possible error message generation. For Windows, I believe this is the default behaviour. For Linux, we run make -k to not immediately abort the build before reporting failure.

Failing to produce object files means library and executable files also won't be produced by the later stages. This means the test executable will not be built, and so unit tests will not run.


It would still be possible to merge branches, even with failing CI tests. They would just complain loudly as we did it.

It might be possible to modify the build scripts such that reporting of warnings as errors is delayed until after unit tests run. That would still allow for maximum reporting, and we could see if the warnings have any impact on later build stages. This would require a bit more investigation though.

@Brett208
Copy link
Member

Brett208 commented Sep 5, 2018

Would what you are proposing be implemented in the actual MSVC project file that I develop with (OP2Utility.vcxproj)? If it doesn't affect this copy it would be more palatable as I could still work locally without stopping compilations whenever a warning is encountered.

@DanRStevens
Copy link
Member Author

There is most likely a way to do this only on the CI build servers. For MSVC, I think there was a way to write changes to the project file before compiling. I haven't read up on the details. Failing that, there might be a way to pass a custom build parameter which could enable warnings as errors.

For the Linux makefile, I could probably get something working with the knowledge I already have, using an environment variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants