简体   繁体   中英

Treat all warnings of specific level as errors but not those of next level

I know there is /WX to treat all warnings as errors . And there is /we1234 to treat a specific warning (ie 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.

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM