简体   繁体   English

将特定级别的所有警告视为错误,但不将下一级别的警告视为错误

[英]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 . 我知道/WX将所有警告都视为错误 And there is /we1234 to treat a specific warning (ie 1234) as an error. 并且/we1234特定警告(即1234)视为错误。

What I miss is a flag to treat all warnings of level 3 as errors but not those of level 4. 我错过的是一个标志,将第3级的所有警告都视为错误,但没有将第4级的警告视为错误。

In my legacy project we just managed to get rid of all W3 warnings and increased to W4. 在我的遗留项目中,我们设法摆脱了所有W3警告,并增加到W4。 As this raised a couple thousands warnings, we will not be able to spot any new warnings of W3 when being introduced. 由于这引发了成千上万的警告,因此在引入W3时我们将无法发现任何新的警告。
Thus we want to make all W3 warnings errors. 因此,我们要使所有W3警告错误。

I could compile a list of all W3 warnings and add a /weXYZ for each of them, but this seems way too tedious. 我可以编译所有W3警告的列表,并为每个警告添加一个/weXYZ ,但这似乎太繁琐了。

You have a couple of choices: 您有两种选择:

Either add a /weXYZ for each level three warning. 为每个三级警告添加一个/weXYZ Do this as follows: 执行以下操作:

  • Add a couple of such flags through the GUI 通过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). 或者,不启用所有第4级警告,而是一次启用一个(一旦您已经修复了先前的警告)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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