admin管理员组文章数量:1122846
I use Ninja 1.10 to build the project and MSVC 14.42.34433 to compile the project.
I didn't use the Visual Studio toolchain; instead, I copied the MSVC, WDK, and SDK folders to a separate directory and configured the relevant paths in CMake myself.
In order to analyze the code, I added the following compiler options:
target_compile_options(dxu PRIVATE "/FIrgxdefs.h")
target_compile_options(dxu PRIVATE "/analyze")
target_compile_options(dxu PRIVATE "/analyze:external-")
target_compile_options(dxu PRIVATE /analyze:projectdirectory ${CMAKE_SOURCE_DIR_SLASHIFIED})
target_compile_options(dxu PRIVATE /analyze:ruleset ;RuleSet1.ruleset;)
target_compile_options(dxu PRIVATE "/analyze:pluginEspXEngine.dll")
Among them, RuleSet1.ruleset is a rule file that I wrote myself, and it is placed in the root directory of the project. Its contents are as follows:
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="New Rule Set" Description=" " ToolsVersion="17.0">
<Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native">
<Rule Id="C26495" Action="Error" />
</Rules>
</RuleSet>
Code analysis indeed only detects C26495, but it is flagged as a warning rather than an error.
I tried changing the Action to Error, Warning, Info, and Hidden, and found that as long as it’s not set to Hidden, it always shows as a Warning.
本文标签: cMSVC Code Analyze can only show warnings and can39t show errorStack Overflow
版权声明:本文标题:c++ - MSVC Code Analyze can only show warnings and can't show error; - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736282341a1926613.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论