Analysis configuration

Using Console

Console exposes the Technology configuration options once a version has been accepted/imported, or an analysis has been run. Click C/C++ Technology to display the available options:

Technology settings are organized as follows:

  • Settings specific to the technology for the entire Application (i.e. all Analysis Units)
  • List of Analysis Units (a set of source code files to analyze) created for the Application
    • Settings specific to each Analysis Unit (typically the settings are the same or similar as at Application level) that allow you to make fine-grained configuration changes.

Settings are initially set according to the information discovered during the source code discovery process when creating a version. You should check that these auto-determined settings are as required and that at least one Analysis Unit exists for the specific technology:

Click to enlarge

Technology and Analysis Unit settings

Notes on Technology and Analysis Unit settings:

Technology
  • These are the default options that will be used to populate the same fields at Analysis Unit level when the source code discovery is not able to find a particular setting in the project files. If you need to define specific settings at Technology level then you can override them. These settings will be replicated at Analysis Unit level (except as described in the point below).
  • If you make a change to a specific option at Analysis Unit level, and then subsequently change the same option at Technology level, this setting will NOT be mirrored back to the Analysis Unit - this is because specific settings at Analysis Unit level have precedence if they have been changed from the default setting available at Technology level.
Analysis Unit
  • Options available at this level are valid only for the specific Analysis Unit.
  • When the Analysis Unit has been created automatically during the source code delivery process, options will "inherit" their initial configuration settings from the discovery process (i.e. "project" settings). Where an option could not be defined automatically, it will "inherit" its initial configuration settings from those defined at Technology level.
  • Analysis Units that are manually defined will "inherit" their initial configuration settings from the settings defined at Technology level
  • Modifying an identical option at Technology level will automatically update the same option in the Analysis Unit editor unless that specific option has already been modified independently in the Analysis Unit editor

Technology level settings

Settings

Option Description
Development Environment

Use this option to choose the development environment of your source code files - this option is detected automatically during source code delivery. AIP Console then applies a default Environment Profile (these can be viewed here on the AIP Node: <install_folder>\EnvProf\CPP) that matches the selected Development Environment.

  • If the source code is detected as a variant of Visual C++, then the appropriate option will be set at Analysis Unit level.
  • If you do not have the correct installation of Visual Studio on the AIP Node, you can choose the Not Specified option - this will impact your analysis results however and should only be used if your analyses fail.
STL Support

This option allows you to choose how you want CAST to handle STL header files that are referenced in your source code. Not all other Environment Profiles provided by CAST contain STL header files (for copyright reasons) and this can lead to an incomplete analysis, and thus to incomplete results.  As a direct result of this, CAST has introduced this option that allows you to tell AIP Console whether the STL header files are available or not:

CAST emulation
If STL header files are not available in your source code, select this option. This will then force the CAST Management Studio to activate a basic (i.e. non exhaustive) emulation of the most common STL headers (i.e. <string>, <vector>, <algorithm> etc.), thus avoiding an incomplete analysis or ambiguous/erroneous analysis results in most circumstances.

This option is provided via a pre-defined Environment Profile, and you can list the headers that are handled by viewing the contents of the following folder:

<install_folder>\EnvProf\CPP\STLforUnix
STL already in your Source Code Repository If STL header files are available in your source code, select this option. The STL header files will be analyzed along with the rest of your source code as normal.

This is the default option.

Accept trigraphs Select this option only if your code contains trigraphs. The analyzer will then interpret normalized character sequences as a single character - for example ??< will be interpreted as {. Note also that this option will also force the analyzer to accept digraphs.

Files to Analyze

This section displays a list of the file extensions for the various parts of your C/C++ application. These file extensions are the default included in the current file filter and only files that match these file extensions will be taken into account during the analysis. You can manually update these file extensions if necessary.

C File Extensions Use this option to specify the file extensions that will be considered as C files for analysis purposes. By default, a list of extensions will already be present.
C++ File Extensions Use this option to specify the file extensions that will be considered as C++ files for analysis purposes. By default, a list of extensions will already be present.

Resources

The options Force Include File and Includes enable you to define additional paths for files that have been specified in the #include part of your project files. This is to ensure the correct resolution of links to files located in other directories. The analyzer will take into account the two “include” styles:

  • #include “fileA.h” > in this case, the analyzer will automatically search the path of the file that contains the #include, THEN the additional paths you have added and in the order specified.
  • #include <fileB.h> > in this case, the analyzer will search the additional paths first then, THEN the path of the the file that contains the #include.

The include paths are locations from where the included headers are found. These parameters should be identified automatically from the compilation directives. The files found in these include paths will be saved in the Analysis schema. Thus, the only header paths you should mention here are the header path of the customer applications.

Force Include File

This option is used to provide an extra header file which will be appended at the beginning of the preprocessed source, as if each source file were beginning with a #include directive on this file. It is useful in the following cases:

  • When you have a very large number of macros
  • When you have macros that need to be undefined (the GUI here can only define them)
  • When the code is using embedded 'C' on Sybase: contrary to Oracle, the Sybase embedded 'C' preprocessor adds some code at the beginning of the generated files. To compensate for this behaviour, you should add the following code in the header used for this option: 
    • #include <sybhesql.h>
      SQLCA sqlca;

You should indicate here the "ExternFunctions.h". If you have several files to "force include", all you need to do is to create an additional file that will include them (using the #include directive) and set this file as being "force included".

  • Use the Add button to browse for the file you want to include. This file will contain the macros that you want the analyzer to take into account and must have the same structure as any C/C++ file (in other words, this file can contain "#define" orders to define macros, "#include" orders to include files, but also declare functions).
  • It is possible to enter a simple filename (for example test.h) without an absolute path. In this case, the analyzer will search for the file as follows:
    • in the associated Source Repository
    • then in any defined Include Path
Includes

This option enables you to add your include paths:

Adding a path

Click the ADD button. Select the specific path you want to include from the available source code.

Removing a path

To remove a path that you do not want to include in the analysis:

  • Select the path that you want to remove from the list by left-clicking with the mouse.
  • Click the Remove button to clear the selected item(s). The Delete key and the right-click short cut menu can also be used. You can remove multiple items by selecting the items in the list and then clicking the Remove button.
Editing an existing path

If you want to edit an existing path:

  • Select the item in the list and use the fields directly below the list to make your changes.
Note that include paths configured in the current Includes section will be processed BEFORE any definitions made in the Environment Profiles associated to the Development Environment option, and to any Custom Environment Profiles you have added.

Defining include paths for Microsoft compilers

Usually, if the Microsoft C++ compiler is installed on the analysis machine, you just need to select the default "Microsoft VCxxxx" Environment Profile (via the Development Environment option ). In some cases, you may also need to provide your include list yourself. The following rules should be followed:

  1. Do not add more directories then required
  2. Do not select the "recursive" option for these paths
  3. Do not select a path such as C:\Program Files\Microsoft Visual Studio 10.0\VC\crt\src (this typically contains files that are reserved for Microsoft internal use and debugger)

In any of the three cases above, you will get an error message during the analysis such as:

#error directive encountered 'Use of C runtime library internal header file
... (file 'C:\PROGRAM FILES\MICROSOFT[...]\VC\CRT\SRC\CRTDEFS.H")'

Include paths for Microsoft compilers should resemble the following:

For Microsoft VC 9.0 (2008) and higher:

  • C:\Program Files\Microsoft Visual Studio 10.0\VC\include
  • C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include
  • C:\Program Files\Microsoft SDKs\Windows\vxx.xx\include

(the third one is for <windows.h> etc., the exact value for xx.xx depends on your exact installation)

For older compilers:

  • C:\Program Files\Microsoft Visual Studio 8\VC\include
  • C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include
  • C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDKinclude

For even older MS Dev 6 (VC98):

  • C:\Program Files\Microsoft Visual Studio\VC98\Include
  • C:\Program Files\Microsoft Visual Studio\VC98\MFC\Include
  • C:\Program Files\Microsoft Visual Studio\VC98\atl\Include
Macros

Use this option to define any macros that are present in your source code and that need to be taken into account during the analysis.

Adding a macro

Click the ADD button and define the macro's name and value:


Removing a macro

To remove a macro that you do not want to include in the analysis, click the Remove button to clear the selected item(s):

Editing a macro

Use the Edit button to edit the macro:

  • Note that it is also possible to define persistent Macros via a custom Environment Profile in CAST Management Studio.
  • Note that macro definitions configured here will be processed AFTER any definitions made in the Environment Profiles associated to the Development Environment  option, and to any custom Environment Profiles you have added.
  • If you include a file containing a list of macros, this file is included in each main file that is analyzed. In other words, and for illustrative purposes only, it would be as if each file selected for analysis started with "#include "autoinclude.h" " (where autoinclude.h is the name of the file selected in the Includes section below). These macros are processed AFTER the macro definitions made in this section.
  • Most, if not all applications developed with Microsoft Visual C++ rely on a set of (standard or not) header files provided with the compiler (stdlib.h, windows.h...). These headers themselves heavily rely on various macros that are internally defined by the compiler. These macros are predefined via Environment Profiles that are applied automatically to the source code following the selections made in the Development Environment option (see IDE section above), as such there is no need to explicitly add them.

Dependencies

Dependencies are configured at Application level for each technology and are configured between individual Analysis Units/groups of Analysis Units (dependencies between technologies are not available as is the case in the CAST Management Studio). You can find out more detailed information about how to ensure dependencies are set up correctly, in Validate dependency configuration.

Analysis Units

This section lists all Analysis Units created either automatically based on the source code discovery process or manually. You should check that at least one Analysis Unit exists for the specific technology. Settings at Analysis Unit level can be modified independently of the parent Technology settings and any other Analysis Units if required - click the Analysis Unit to view its technology settings:

See Application - Config - Analysis - Working with Execution Groups for more information about the options available here. Clicking an Analysis Unit will take you directly to the available Analysis Unit level settings:

Technology settings at Analysis Unit level

Technology settings at Analysis Unit level are for the most part identical to those explained above. Some differences exist:

Settings

Use Microsoft Managed C++ extensions (CLR)

Select this option if your Source Code contains Microsoft Managed C++ extensions targeted at the Common Language Runtime (CLR). A corresponding Environment Profile will then be applied. See the following location on the AIP Node:

<install_folder>\EnvProf\CPP\Microsoft Managed C++

Note that this option is automatically ticked if the project is configured to execute code under the Common Language Runtime virtual machine.

Main Files

This section lists the location of the files for analysis. This is usually a location in the designated Deployment folder. You can include additional folder or exclude existing folders if required using the Add button. All three options will open the web interface on the following root folder location, unless the location has been changed during the AIP Console setup and installation:

%PROGRAMDATA%/CAST/AipConsole/AipNode/upload/

Using legacy CAST Management Studio

Introduction to analysis configuration options

The CAST Management Studio has three levels at which analysis configuration options can be set:

Technology
  • The options available at this level are valid for all Applications managed in the CAST Management Studio.
  • These are the default options that will be used to populate the same fields at Application and Analysis Unit level. If you need to define specific options for a specific Application or Analysis Unit, then you can override them.
  • If you make a change to a specific option at Application or Analysis Unit level, and then subsequently change the same option at Technology level, this setting will NOT be mirrored back to the Application or Analysis Unit - this is because specific settings at Application and Analysis Unit level have precedence if they have been changed from the default setting available at Technology level.
Application
  • The options available at this level set are valid for all corresponding Analysis Units defined in the current Application (so making changes to a specific option will mean all Analysis Units in that specific Technology will "inherit" the same setting). If you need to define specific options for a specific Analysis Unit in a specific Technology, then you can do so at Analysis Unit level.
Analysis Unit
  • Options available at this level are valid only for the specific Analysis Unit.
  • An Analysis Unit can best be described as a set of configuration settings that govern how a perimeter of source code is consistently analyzed.
  • Analysis Units are automatically created when you use the Set as current version option to deploy the delivered source code - as such they correspond to Projects discovered by the CAST Delivery Manager Tool. However, they can also be created manually for situations where no Analysis Unit has been automatically created for a given project.
    • When the Analysis Unit has been created automatically, options will "inherit" their initial configuration settings from the discovery process in the CAST Delivery Manager Tool (i.e. "project" settings). Where an option could not be defined automatically via the CAST Delivery Manager Tool, it will "inherit" its initial configuration settings from those defined at Technology level and at Application level.
    • Analysis Units that are manually defined will "inherit" their initial configuration settings from the settings defined at Technology level and at Application level.
  • Modifying an identical option at Technology level or at Application level will automatically update the same option in the Analysis Unit editor unless that specific option has already been modified independently in the Analysis Unit editor.

Some settings at Application and Analysis Unit level have a “Reset” option - using this will reset the option to the value set at the parent level:

Auto-configuration validation

Technology / Application level

Using the Technology level or Application level options, validate the settings for C / C++ packages. Make any update as required. These settings apply to the Technology or Application as a whole (i.e. all Analysis Units):

Analysis Unit level

To inspect the auto-generated analysis configuration, you should review the settings in each Analysis Unit - they can be accessed through the Application editor:

Technology options

Normally, the source code discoverer will auto-configure the Analysis Unit and analysis settings as described above. However, in some circumstances, these settings may be incorrect and must be adjusted manually. The main parameters to work on are as follows:

  • Source Settings
  • Analysis
    • IDE used for the Analysis Unit
    • STL Support
    • Include paths
    • Macro definitions
    • Precompiled header
    • Environment Profile

The available options for configuring an analysis are described below. Note that some options are not available at specific levels (Technology/Application/Analysis Unit).

Source Settings

This tab shows the location of each type of source code in the C / C++ Analysis Unit - this is determined automatically by the CAST Delivery Manager Tool. You should, however, review the configuration and make any changes you need:

Project path The file based location of the corresponding project. This field is read-only. When the field contains User defined, this indicates that the Analysis Unit has been defined manually instead of automatically following the use of the CAST Delivery Manager Tool.
Consider Files As C only If this option is selected, C++ specifics are ignored (templates, namespaces, classes, inheritance and polymorphism) and are not taken into account when the source files are analyzed.

This option allows optimized handling of C files.

C++ only If this option is selected, C++ specifics (templates, namespaces, classes, inheritance and polymorphism) are taken into account when the source files are analyzed.
Both C and C++ If this option is selected only one distinct job is generated and executed: one C++ technology job using the Consider Files As > C++ option. However the results stored in the CAST Analysis Service will contain both C and C++ object types.

In other words, both file types are analyzed as C++ files and Line Of Code Count (LoC) for C files will be included in the C++ technology rather than the C technology.

C File Extensions Use this option to specify the file extensions that will be considered as C files for analysis purposes.
C++ File Extensions Use this option to specify the file extensions that will be considered as C++ files for analysis purposes.

Impacts of choosing one parsing option over the other.

Selecting one of these options will cause the source code to be handled differently by the analyzer:

  • A function or a method contains any number of declarations and at least one definition. The grouping of these blocks in one unique object is done differently by the analyzer according to whether the C++ or C option has been selected:
    • With option C, declaration or definition blocks with the same name are grouped together in the same function or in the same method without taking into account any parameters.
    • With option C++, declaration or definition blocks with the same name and the same parameters are grouped together in the same function or in the same method.

For example, using the option C++ here would create two functions called “foo” in the Analysis Service schema, whereas using the C option would only create one “foo” function.

 void foo();
 void foo(int a)
 {
 }
  • The analyzer detects calling links differently depending on whether the C or C++ option is selected:
    • With option C, the analyzer believes that the function or the method is called as soon as an object with the same name is called.
    • With option C++, the analyzer believes that the function or the method is called if an object with the same name and comparable parameters is also called.

For example (and using the previous example), because using the C++ option with the previous example would create two functions “foo” in the Analysis Service - one with a parameter, the other without - the analyzer will only create a Call type link to the function WITHOUT the parameter. Using the C option, the analyzer will create a link to the one function even if it has parameters.

void main ()
 {
 foo();
 }

Notes

  • A file written in class C can be analyzed with the option C++ only with no risk. The only consequences are that the job may take slightly longer to run and some groupings of functions/methods with the same name but different parameters will not be carried out.

  • A file written in C++ must NOT be analyzed with the option C File.

  • When C/C++ Analysis Units are auto created in the CAST Delivery Manager Tool from Visual Studio project files (.vcproj files) and these project files have the Visual Studio option Compile As NOT set in bold (i.e. this reflects a default Visual Studio value which is not written in the .vcproj file), the CAST Management Studio will not be able to detect the Compile As value. As a result the Compile As value cannot be reflected in the Analysis Unit under the option Consider File As. In this instance, the source file extension will be used to determine the Analysis Unit Consider File As value.

    For example, you may have a project which has the value Compile As set to Compile as C++ Code in the Visual Studio environment (NOT set in bold). In this instance, when the Analysis Units are auto created, the CAST Management Studio cannot detect the Compile As value and will set the Analysis Unit Consider File As option to C only (using the file extension).

  • If you have an application where .c files must be analyzed as C++ files, you should set the .c extension as a C++ extension - i.e. add it to the C++ File Extensions field.

Analysis

The settings in this tab govern how the source code is handled by the analyzer:

Global settings
Analyzer to invoke Use this option to choose between the analysis engine that will be used to run the analysis:
Legacy analyzer

This option invokes the legacy C/C++ analyzer as provided in previous releases of CAST AIP and in the C and Cpp Analyzer extension. By default this option will always be active at Technology/Application/Analysis Unit level.

Please do not modify this option when using the C and Cpp Analyzer extension.

Clang analyzer

This option is only relevant for those that are using the CAST AIP Objective C Extension in order to analyze Objective C source code. This option must be active in order for the Objective C source code to be analyzed by correctly.

If this option is invoked and:

  • the CAST AIP Objective C Extension is not installed, then an error will be displayed when the analysis is run:
The C-Family analyzer is not installed. Please use the Extension Downloader to get it (com.castsoftware.cfamily)
  • the CAST AIP Objective C Extension is installed but your source code does not contain Objective C (i.e. it is a traditional Visual C/C++ application) then results will not be consistent with the output of the "legacy analyzer". In this situation where only traditional Visual C/C++ source code is being analayzed, CAST recommends that the Legacy analyzer option is always used.
IDE used to develop the Application/Analysis Unit Use this option to choose the development environment of your source code files. The CAST Management Studio then applies a default Environment Profile (these can be viewed here: <install_folder>\EnvProf\CPP) that matches the selected Development Environment.

Note that if the CAST Delivery Manager Tool detects the source code as a variant of Visual C++, then the appropriate option will be set at Analysis Unit level.

STL Support This option allows you to choose how you want CAST to handle STL header files that are referenced in your source code. Not all other Environment Profiles provided by CAST contain STL header files (for copyright reasons) and this can lead to an incomplete analysis, and thus to incomplete results.  As a direct result of this, CAST has introduced this option that allows you to tell the CAST Management Studio whether the STL header files are available or not:
CAST emulation
If STL header files are not available in your source code, select this option. This will then force the CAST Management Studio to activate a basic (i.e. non exhaustive) emulation of the most common STL headers (i.e. <string>, <vector>, <algorithm> etc.), thus avoiding an incomplete analysis or ambiguous/erroneous analysis results in most circumstances.

This option is provided via a pre-defined Environment Profile, and you can list the headers that are handled by viewing the contents of the following folder:

<install_folder>\EnvProf\CPP\STLforUnix
STL already in your Source Code Repository If STL header files are available in your source code, select this option. The STL header files will be analyzed along with the rest of your source code as normal.

This is the default option.

Use Microsoft Managed C++ extensions (CLR)

Select this option if your Source Code contains Microsoft Managed C++ extensions targeted at the Common Language Runtime (CLR). A corresponding Environment Profile will then be applied. See:

<install_folder>\EnvProf\CPP\Microsoft Managed C++

Note that this option is automatically ticked if the project is configured to execute code under the Common Language Runtime virtual machine.

Includes

The options Force Include File and Define the Include Paths enable you to define additional paths for files that have been specified in the #include part of your project files. This is to ensure the correct resolution of links to files located in other directories. The analyzer will take into account the two “include” styles:

  • #include “fileA.h” > in this case, the analyzer will automatically search the path of the file that contains the #include, THEN the additional paths you have added and in the order specified.
  • #include <fileB.h> > in this case, the analyzer will search the additional paths first then, THEN the path of the the file that contains the #include.

The include paths are locations from where the included headers are found. These parameters should be identified automatically from the compilation directives. The files found in these include paths will be saved in the Analysis Service. Thus, the only header paths you should mention here are the header path of the customer applications

The C++ Analyzer provides a feature that will scan the source code in order to detect missing header paths and macro definitions. This feature is available through the action Test analysis on the current Analysis Unit in the Execution tab of the Analysis Unit editor. The tools delivered in the CAST Implementation Framework are therefore no longer necessary.

You should not reference here any third party software header paths (see previous section). Also files that are common to several jobs should be defined in an Environment Profile. Note that include paths defined directly in the job are searched first. Include paths defined in Environment Profiles have a lesser priority. As for the compiler, inclusions defined within "" are searched within the path of the file being analyzed, while inclusions defined within <> aren’t.

You should also avoid adding more include paths than required: the search for an included file in the include path list occurs regularly and too many unnecessary paths will affect performance.

Note that the Include paths are not recursive unless you choose them to be: as such the default behavior is that sub-folders of the folders mentioned in the lists are not considered as potential include paths if not explicitly added to the list (nor are they in the compiler options of the output from the Macro Analyzer, so you should report them as is). However, if you have an include like #include “dir1/file1.h”, you should select the directory containing dir1, not the one containing file1.

Force Include File

This option is used to provide an extra header file which will be appended at the beginning of the preprocessed source, as if each source file were beginning with a #include directive on this file. It is useful in the following cases:

  • When you have a very large number of macros
  • When you have macros that need to be undefined (the GUI here can only define them)
  • When the code is using embedded 'C' on Sybase: contrary to Oracle, the Sybase embedded 'C' preprocessor adds some code at the beginning of the generated files. To compensate for this behaviour, you should add the following code in the header used for this option: 
    • #include <sybhesql.h>
      SQLCA sqlca;

You should indicate here the "ExternFunctions.h". If you have several files to "force include", all you need to do is to create an additional file that will include them (using the #include directive) and set this file as being "force included".

  • Use the Browse button to browse for the file you want to include. This file will contain the macros that you want the analyzer to take into account and must have the same structure as any C/C++ file (in other words, this file can contain "#define" orders to define macros, "#include" orders to include files, but also declare functions).
  • It is possible to enter a simple filename (for example test.h) without an absolute path. In this case, the analyzer will search for the file as follows:
    • in the associated Source Repository
    • then in any defined Include Path (defined in this section or in an Environment Profile defined via the IDE used to develop the application option above or via a Custom Environment Profile defined in the Custom Environment Profiles section below).
Define the Include Paths used by the Analysis Unit

This option enables you to add your include paths:

Adding a path
  1. Click the button. A new path called "Folder" will be displayed in the list.
  2. To define the path (using the Browse option) and whether it is recursive or not, select the "Folder" item and use the relevant fields directly below the list.
  3. The Recursive option indicates whether any sub-folders and the files they contain that are located in the chosen path will be included for resolution purposes (TRUE or FALSE). By default all paths that you add to the list will be flagged as FALSE - i.e. their sub-folders and any paths they contain will not be included. Choose whether the path is recursive as appropriate.

Notes

  • Please note that CAST only recommends selecting the Recursive option if you know exactly what you want to achieve. In the vast majority of situations, you should instead define each include path exactly as it is defined in the C++ project itself.

    For example, if your C++ project uses the "comp/include" include path, and your sources reference the file "stat.h" through:

    #include <sys/stat.h> // comp/include/sys/stat.h intended

    just add the path "comp/include" here, like in your C++ project, without selecting the Recursive option.

    Recursive is only useful if you really want to list all subdirectories of a directory, and spare some typing. This is generally not the case.
Removing a path

To remove a path that you do not want to include in the analysis:

  1. Select the path that you want to remove from the list by left-clicking with the mouse.
  2. Click the Remove button to clear the selected item(s). The Delete key and the right-click short cut menu can also be used. You can remove multiple items by selecting the items in the list and then clicking the Remove button.
Editing an existing path

If you want to edit an existing path:

  • Select the item in the list and use the fields directly below the list to make your changes.
Up and Down buttons If you have two or more paths, then you can use the Up and Down arrow buttons to re-order the paths. This is important as the order they appear in the list is the order in which the paths are dealt with during the analysis process. To move a path down one level, select the path, then click Down; to move it up one level, click Up.
Notes
  • Please note that you can also use the CAST environment variable $(CastCommonDir) when adding an include path. This variable corresponds to the CAST installation folder "%CommonProgramFiles%\CAST\CAST". When you are using a non-English version of Windows, this variable will be localized.
  • Note that it is also possible to define persistent Include Paths via a custom Environment Profile (see Custom Environment Profiles section below).
  • Note that include paths configured in the current Includes section will be processed BEFORE any definitions made in the Environment Profiles associated to the IDE used to develop the Analysis Unit option, and to any Custom Environment Profiles (see Custom Environment Profiles section) you have added.

Defining include paths for Microsoft compilers

Usually, if the Microsoft C++ compiler is installed on the analysis machine, you just need to select the default "Microsoft VCxxxx" Environment Profile (via the IDE used to develop the Analysis Unit option above). In some cases, you may also need to provide your include list yourself. The following rules should be followed:

  1. Do not add more directories then required
  2. Do not select the "recursive" option for these paths
  3. Do not select a path such as C:\Program Files\Microsoft Visual Studio 10.0\VC\crt\src (this typically contains files that are reserved for Microsoft internal use and debugger)

In any of the three cases above, you will get an error message during the analysis such as:

#error directive encountered 'Use of C runtime library internal header file
... (file 'C:\PROGRAM FILES\MICROSOFT[...]\VC\CRT\SRC\CRTDEFS.H")'

Include paths for Microsoft compilers should resemble the following:

For Microsoft VC 9.0 (2008) and higher:

  • C:\Program Files\Microsoft Visual Studio 10.0\VC\include
  • C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include
  • C:\Program Files\Microsoft SDKs\Windows\vxx.xx\include

(the third one is for <windows.h> etc., the exact value for xx.xx depends on your exact installation)

For older compilers:

  • C:\Program Files\Microsoft Visual Studio 8\VC\include
  • C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include
  • C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDKinclude

For even older MS Dev 6 (VC98):

  • C:\Program Files\Microsoft Visual Studio\VC98\Include
  • C:\Program Files\Microsoft Visual Studio\VC98\MFC\Include
  • C:\Program Files\Microsoft Visual Studio\VC98\atl\Include
Macros

Define the macros used by the application/analysis unit

Use this option to define any macros that are present in your source code and that need to be taken into account during the analysis.

Adding a macro
  1. Click the button. A new macro called "MY_MACRO" will be displayed in the list.
  2. Define the macro's name and value in the fields that are displayed below the macro list.
Removing a macro

To remove a macro that you do not want to include in the analysis:

  1. Select the macro that you want to remove from the list by left-clicking with the mouse.
  2. Click the Remove button to clear the selected item(s). The Delete key and the right-click short cut menu can also be used. You can remove multiple items by selecting the items in the list and then clicking the Remove button.

Editing a macro

If you want to edit an existing macro:

  • Select the item and edit the name and value as necessary in the fields that are displayed below the macro list
  • You can also double click the macro to right click it and select Edit from the shortcut menu to edit the name and values in a separate editor window.
Notes
  • Note that it is also possible to define persistent Macros via a custom Environment Profile (see Custom Environment Profiles - only in the Application editor (Analysis tab) or the Analysis Unit editor)
  • Note that macro definitions configured here will be processed AFTER any definitions made in the Environment Profiles associated to the IDE used to develop the Application/Analysis Unit option (see IDE section above), and to any custom Environment Profiles (see Custom Environment Profiles - only in the Application editor (Analysis tab) or the Analysis Unit editor) you have added.
  • If you include a file (see below) containing a list of macros, this file is included in each main file that is analyzed. In other words, and for illustrative purposes only, it would be as if each file selected for analysis started with "#include "autoinclude.h" " (where autoinclude.h is the name of the file selected in the Includes section below). These macros are processed AFTER the macro definitions made in this section.
  • Most, if not all applications developed with Microsoft Visual C++ rely on a set of (standard or not) header files provided with the compiler (stdlib.h, windows.h...). These headers themselves heavily rely on various macros that are internally defined by the compiler. These macros are predefined via Environment Profiles that are applied automatically to the source code following the selections made in the IDE used to develop the Application/Analysis Unit option (see IDE section above), as such there is no need to explicitly add them.
Precompiled Headers (PCH)
Precompiled header Enter the name of a header file, that the majority of the source code files in the project include first, and that self includes many other library files. Typically “stdafx.h” on most Microsoft projects.
PCH generator A source file that includes the Precompiled header file (as referenced above), and that should be analyzed first. Typically “stdafx.cpp” on most Microsoft projects.
Disable use of PCH Selecting this option will cause Precompiled headers to be ignored. This is generally not recommended, as PCHs improve analysis speed.
Custom Environment Profiles

This option enables you to select C/C++ based Environment Profiles that you have created yourself (as oppose to the Environment Profiles that are pre-defined by CAST and applied when the IDE used to develop the Application/Analysis Unit option is set)

Environment Profiles are a set of predefined configuration settings that can be included in an analysis. An Environment Profile can be particularly useful where you have several applications that rely on the same specific settings. By creating an Environment Profile that defines these settings, you then simply include the Environment Profile in the analysis. When the analysis is run, the settings in the Environment Profile are taken into account.

For C/C++ technologies, you can define:

  • Include Paths
  • Macros

See C and Cpp - Environment Profiles .

Parsing
>> allowed to close nested template list Many compilers allow to close two nested template lists with >> (instead of ">(blank)>" ). There is no reason to deactivate this option, unless "x>>y" is used in any template expression.
Accept Trigraphs Select this option only if your code contains trigraphs. The analyzer will then interpret normalized character sequences as a single character - for example ??< will be interpreted as {.

Note also that this option will also force the analyzer to accept digraphs.

Standard scope of "for" loops Variables declared inside "for" loops are not visible outside the loop.

Activating this option could generate messages about unknown variables on some pre-ISO compilers, like Microsoft VC6.

Standard processing of "typename" According to the standard, "T::X", not preceded by "typename" (where T is a template parameter) should always be interpreted as an expression.

Activating this option is recommended on most compilers, except Microsoft compilers.

Detect unknown compilation directives When this option is activated, the analyzer tries to detect compilation directives that have not been defined as macros (e.g. WINAPI and the like). Since this option is not 100% reliable, it is recommended to disable it once the analysis has been properly configured.

Production

Click to enlarge

Process Settings
Number of Instances This option is only relevant when the "Legacy analyzer" option is active. It allows you to limit the number of objects held in memory before they are committed to disk during the save process of an analysis.

Please contact CAST Support before modifying this option.

See the CAST Management Studio help for more information about this global option.