codereport / jsource

J Language Source Code. Livestream links ⬇️
https://www.youtube.com/playlist?list=PLVFrD1dmDdvfVhYLU_iKkV67X9XqCJLWe
Other
38 stars 20 forks source link

Enable `-Werror` #90

Closed codereport closed 3 years ago

codereport commented 3 years ago

Currently -Werror is commented out in our CMakeLists.txt:

# add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-Werror>)
# add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-Wextra>)

We want to turn this on.

Sebanisu commented 3 years ago

Maybe good to reference https://github.com/lefticus/cpp_starter_project/blob/master/cmake/CompilerWarnings.cmake you can create a interface library that implements the warnings and just link it to the projects you want to have them with. And the way they format the warnings you can just comment the lines out you don't want. I used this in my project because the warnings I had enabled caused Google test to fail to compile. I could probably. Related https://github.com/codereport/jsource/issues/89

juntuu commented 3 years ago

I would propose the following workflow for getting rid of the warnings incrementally:

  1. Move few -Wno-<warning>'s at a time to -Wno-error=<warning>
  2. Fix the code that produces warnings
  3. Remove the -Wno-error=<warning> when the corresponding warnings are fixed
  4. Repeat while applicable warnings are still being ignored

This allows us to:

I used this approach for organising the cmake file in #109.