Condividi tramite


/analyze (Code Analysis)

 

The latest version of this topic can be found at -analyze (Code Analysis).

Enables code analysis and control options.

Syntax

/analyze[-][:WX-][:log filename][:quiet][:stacksize number][:max_paths number][:only]  

Arguments

/analyze
Turns on analysis in the default mode. Analysis output goes to the Output window like other error messages. Use /analyze- to explicitly turn off analysis.

/analyze:WX-
Specifying /analyze:WX- means that code analysis warnings are not treated as errors when you compile by using /WX. For more information, see /w, /W0, /W1, /W2, /W3, /W4, /w1, /w2, /w3, /w4, /Wall, /wd, /we, /wo, /Wv, /WX (Warning Level).

/analyze:log filename
Detailed analyzer results are written as XML to the file that is specified by filename.

/analyze:quiet
Turns off analyzer output to the Output window.

/analyze:stacksize number
The number parameter that is used with this option specifies the size, in bytes, of the stack frame for which warning C6262 is generated. If this parameter is not specified, the stack frame size is 16KB by default.

/analyze:max_paths number
The number parameter that is used with this option specifies the maximum number of code paths to be analyzed. If this parameter is not specified, the number is 256 by default. Larger values perform more thorough checking, but the analysis might take longer.

/analyze:only
Typically, the compiler generates code and does more syntax checking after it runs the analyzer. The /analyze:only option turns off this code generation pass; this makes analysis faster but compile errors and warnings that might have been discovered by the code generation pass of the compiler are not emitted. If the program is not free of code-generation errors, analysis results might be unreliable; therefore, we recommend that you use this option only if the code already passes code-generation syntax checking without errors.

Remarks

For more information, see Code Analysis for C/C++ Overview and Code Analysis for C/C++ Warnings.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see How to: Open Project Property Pages.

  2. Expand the Configuration Properties node.

  3. Expand the Code Analysis node.

  4. Select the General property page.

  5. Modify one or more of the Code Analysis properties.

To set this compiler option programmatically

  1. See EnablePREfast.

See Also

Compiler Options
Setting Compiler Options