0

I know there is /WX to treat all warnings as errors. And there is /we1234 to treat a specific warning (i.e. 1234) as an error.

What I miss is a flag to treat all warnings of level 3 as errors but not those of level 4.

In my legacy project we just managed to get rid of all W3 warnings and increased to W4. As this raised a couple thousands warnings, we will not be able to spot any new warnings of W3 when being introduced.
Thus we want to make all W3 warnings errors.

I could compile a list of all W3 warnings and add a /weXYZ for each of them, but this seems way too tedious.

Torbjörn
  • 5,512
  • 7
  • 46
  • 73
  • `W4` would always trigger zillions of warnings from STL implementation. – Zereges Jul 28 '17 at 13:00
  • @Zereges I can not confirm. I'm mostly getting warnings from our code with VS2017. This was true for <=VS2015. – Torbjörn Jul 28 '17 at 13:08
  • Interesting point, another reason for upgrading :) – Zereges Jul 28 '17 at 13:10
  • @Zereges W4 [should be okay](https://stackoverflow.com/questions/4001736/whats-up-with-the-thousands-of-warnings-in-standard-headers-in-msvc-wall) but Wall will get the zillions of errors. – NathanOliver Jul 28 '17 at 13:12

1 Answers1

0

You have a couple of choices:

Either add a /weXYZ for each level three warning. Do this as follows:

  • Add a couple of such flags through the GUI
  • Open the project file in a text editor, and find the format it uses
  • Scrape a list of all the level three warnings from a suitable webpage
  • Edit it into the correct format
  • Put the settings into the project file.

Alternatively, rather than enabling all level 4 warnings, enable them one at a time (once you have fixed the previous ones).

  • 1
    A `.vsprops` file would be more useful, as it would be reusable. – MSalters Jul 28 '17 at 13:45
  • I'm using CMake to generate the project and solution files. So I'll not going to add anything through the VS GUI. You'r basically describing my last sentence of my question. – Torbjörn Jul 28 '17 at 14:08