Intel® C++ Compiler XE 13.1 User and Reference Guides

diag-enable sc, Qdiag-enable:sc

Enables static analysis diagnostics. You can determine which diagnostics to emit based on severity or you can specify an analysis mode for diagnostic messages.

Syntax

Linux:

-diag-enable sc[n]

-diag-enable sc-mode

-diag-disable sc

OS X:

None

Windows:

/Qdiag-enable:sc[n]

/Qdiag-enable:sc-mode

/Qdiag-disable:sc

Arguments

n

Specifies the level of severity to report. Possible values are:

1

Reports only diagnostics with a severity level of "critical". Diagnostics with a severity level of "error" or "warning" are not displayed.

2

Reports all diagnostics with a severity level of "critical" and "error". Diagnostics with a severity level of "warning" are not reported. This is the default.

3

Reports all diagnostics regardless of the severity level.

This value is equivalent to deprecated option sv[n].

mode

Specifies the analysis mode. Possible values are:

full

This mode attempts to find all program weaknesses, even at the expense of more false positives. This mode is recommended when using the tool for security assurance.

This is the default if -diag-enable sc{[1|2|3]} (Linux* OS and OS X*) or /Qdiag-enable:sc{[1|2|3]} (Windows* OS) is present. Otherwise, the default is None (static analysis diagnostics are disabled).

concise

This mode attempts to reduce false positives somewhat more than reducing false negatives. This mode is recommended when using the tool for general error detection.

precise

This mode attempts to avoid all false positives, even at the expense of substantially reduced error checking. This mode is recommended when using the tool for acceptance screening.

Default

-diag-disable sc and /Qdiag-disable:sc

Static analysis diagnostics are disabled.

Description

This option enables static analysis diagnostics.

If you specify n for the option, you can determine which diagnostics to emit based on severity. If you specify mode, you can also specify an analysis mode for diagnostic messages.

To disable static analysis, specify /Qdiag-disable:sc (Windows* OS) or option -diag-disable sc (Linux* OS).

You can also specify the following options that affect the diagnostics:

IDE Equivalent

Windows: Diagnostics > Level of Static Analysis (/Qdiag-enable:sc{1|2|3} )

Diagnostics > Mode of Static Analysis (/Qdiag-enable:sc-{full|concise|precise})

Linux: Compilation Diagnostics > Level of Static Analysis (-diag-enable sc{1|2|3} or -diag-disable sv)

Compilation Diagnostics > Mode of Static Analysis (-diag-enable sc-{full|concise|precise})

OS X: None

Alternate Options

None

Example

The following example shows how to produce static analysis diagnostic messages for all critical errors:

-diag-enable sc1      ! Linux systems
/Qdiag-enable:sc1     ! Windows systems

The following example shows how to cause static analysis diagnostics (and default diagnostics) to be sent to a file:

-diag-enable sc -diag-file=stat_ver_msg   ! Linux systems 
/Qdiag-enable:sc /Qdiag-file:stat_ver_msg ! Windows systems

Note that you need to enable static analysis diagnostics before you can send them to a file. In this case, the diagnostics are sent to file stat_ver_msg.diag. If a file name is not specified, the diagnostics are sent to name-of-the-first-source-file.diag.

See Also


Submit feedback on this help topic