Intel® Fortran Compiler XE 13.1 User and Reference Guides
To build your application for Static Analysis in Microsoft Visual Studio, use the Build for Intel Static Analysis menu option. This creates a new build configuration for static analysis and sets the required properties in the Visual Studio IDE.
There are several forms of the Build for Intel Static Analysis menu option, including:
The first time you use this menu option, a dialog box appears to guide you through the setup process.
Using Static Analysis for an Intel® Visual Fortran Solution
To perform Static Analysis on Intel® Visual Fortran solutions and projects:
Analysis results will open automatically in the Intel® Inspector XE user interface.
There are several Microsoft Visual Studio* IDE property pages related to static analysis. You can change the options for static analysis by modifying the properties for the Intel_SSA configuration. To do this, use the following property pages:
If you are building from the command line, you need to create a new build configuration or target distinct from your existing build configuration or target. Once you do this, you can add the command line options to enable static analysis. You must supply the options that request static analysis on each compilation and link step. The following table summarizes the static analysis options.
|
Option (Windows* and Linux* OS syntax) |
Result |
|---|---|
|
/Qdiag-enable:sc{[1|2|3]} -diag-enable sc{[1|2|3]} |
Enables static analysis. The number specifies the severity level of diagnostics reported (1=only critical errors, 2=all errors and warnings, and 3=all diagnostics regardless of severity level). |
|
/Qdiag-enable:sc-{full|concise|precise} -diag-enable sc-{full|concise|precise} |
Enables static analysis and determines the analysis mode. |
|
/Qdiag-disable:sc -diag-disable sc |
Disables static analysis |
|
/Qdiag-enable:sc-include -diag-enable sc-include |
Analyzes include files as well as source files. By default apparent errors in include files are not reported. |
|
/Qdiag-enable:sc-single-file -diag-enable sc-single-file |
Processes each file individually, skipping the usual whole-program analysis. This reduces memory requirements and analysis time on large programs, but may detect fewer real errors. |
|
/Qdiag-sc-dir:dir -diag-sc-dir dir |
Directs diagnostic results to the given directory. If this option is not specified, results are directed to the current working directory. Each run creates results in a new subdirectory whose name has the form "r@@@sc", where "@@@" is replaced the next available sequence number (001, 002, ...). This option requires that you also specify the compiler option to enable static analysis. |
|
/Qdiag-enable:sc-enums -diag-enable sc-enums |
Instructs static analysis to treat enumeration variables in C++ programs as known values equal to any one of the associated enumeration literals. By default, static analysis treats unknown enumeration variables as unknown integer values. Setting this option may find additional errors, but tends to create more false positives. |
Even if your project must build on the command line, it is still possible to integrate your project into Visual Studio. To do this, create a Visual Studio "makefile project," in which case, Visual Studio will build the project by invoking a command line of your choosing. If you plan to use a makefile project, you should add the /Qdiag-sc-dir:dir or -diag-sc-dir dir option on the link step to direct the output to the "My Inspector XE Results-<product name>" folder in the project root directory. This allows Intel® Inspector XE to find your results and display them in the Visual Studio Solution Explorer. If you do not want to use Visual Studio at all, you should use the stand-alone form of the Intel® Inspector XE GUI. If you do this, you can place your results wherever you like.
To enable OpenMP*, specify the /Qopenmp (Windows* OS) or -openmp (Linux* OS) option. You must do this if your program uses OpenMP.
Using Build Specifications: As an alternative to creating a new build configuration, you can create a build specification. See Creating and Using Build Specification Files for more information.
Static analysis results are generated at the link step. The Intel linker must be used for linking and the compiler driver automatically invokes the Intel linker when building an executable. On Windows* OS, you must build static libraries with the Intel librarian, xilib.exe. The xilib program recognizes the static analysis compiler options such as /Qdiag-enable:sc{1|2|3}. If you supply an option that enables static analysis, you can generate a static analysis result for the static library. On Linux* OS, you must build the static library for static analysis with the Intel archive program, xiar. If you want to generate a static analysis result for the static library, you need to use xiar and supply the static analysis compiler options such as -diag-enable=sc{1|2|3} but preceded by a "q", for example, -qdiag-enable=sc3.