*Purpose

This page can be used to remedy the errors in the analysis log file, that can appear while running an analysis using the CPP extension.

For more information, refer to:

Observed in CAST Extension


Release
Yes/No
2.3 (tick)
2.2 (tick)
2.1 (tick)
2.0 (tick)


*Observed on RDBMS
RDBMS
Yes/No
CSS4(tick)
CSS3(tick)
CSS2(tick)



Action Plan

Perform the following steps:

  1. If the source code is built in VC6 then the project files created would be with the extensions .dsp and .dsw which are not managed by any discoverers which is already documented. This approach will decrease the effort we need to put in the manual configurations.
    1. Open the project file .dsw and / or all required .dsp in a recent Microsotf Visual Studio IDE.

    2. Visual studio will automatically propose to upgrade project files and create .vcxproj files
    3. Use DMT and package the new source code with .vcxproj files which would discover the AUs automatically with correct configuration and then deliver
    4. Accept the delivery and set it as current version.
    5. In CMS select the Visual studio version used to convert the .dsp files as IDE

  2. For all the projects built on Microsoft IDEs. Having Visual Studio installed is mandatory (Third-party Software Required by CAST)To check if the VS is installed correctly or not we need to follow below steps.
    1. In CMS, Open 'Manage Environment Profiles' Dialog box
    2. Select the IDE which you choose in CMS.
      Figure 1
    3. the $(WINREGISTRY.....) values are existing in the registry
    4. that the value of these registry keys are valid folders on the analysis machine, and that required subfolders are existing
  3. When we cannot install a VS on the analysis machine do the following.
    1. Get the list of necessary folders by looking at the corresponding Environment Profile as explained in Step 2.
    2. Copy necessary folders from another computer where the VS is installed
    3. Create the clone for for the environment profile "VC++ XXXXX - Mandatory part" and replace the values 
      $(WINREGISTRY,"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\CurrentInstallFolder")\include
      with the path of the folders, for exemple 
      C:\MYVCXXXHEADERS\include

  4. Compilation Error messages
    1. When you get many compilation error messages ('parser' xxx expected, parser variable has already a name, parser xxxx)(one or two message per line of an analyzed file), first try to correct erroneous include paths, and then work on macro definition. The main exception to this rule is when you see that a wrong header file is included (for instance, trying to include <windows.h> on linux), and the selection of file to include depends on a configuration macro. As a tip, you should not usually have to define more than a dozen macros. As long as there is not a reasonable number of parser messages, it helps nothing to let the analysis go further. Therefore, the macro definitions must be fixed first in the job configuration. Always run a test analysis to check if you have errors in the test analysis log and then try to improve it one by one.
    2.  In case the source code contain C & C++ files or some files are written in C++, even if their name ends with “C”, then it is important to separate your C and C++ files into 2 separate jobs, linked together. 
    3. If the log contains some of the below error messages, it means that there is a compilation problem. Configure the job so that the first file gets analyzed without errors:
      1. [Configuration] error: Encountered #error directive: <For instance : MFC requires use of Winsock2 .h>
        1. This is the message issued by the pre-processed file and comes when you have directly or indirectly included < Winsock2.h> before which conflicts with for instance< Winsock2.h> that has to be used for MFC. The compilation stops after this message and analysis ends with a fatal error
        2. Check for the configuration errors before this fatal error and fix those configuration errors first.If it doesn't solve the issue,proceed by the process of Dichotomy to identify which file causes the issue.
      2. [ Configuration ] FAR: Unknown identifier 'XXX' is probably an unknown compilation directive, the following results could be inconsistent. (file 'S:\WORLDWIDE\...\SSDLL.H', line 154)__ [ Configuration ] FAR: Please consider reviewing your settings. (file 'S:\WORLDWIDE\...\SSDLL.H', line 154)
      3.  [Configuration] error: Encountered #error* directive: ERROR : Use of C run time library internal header file .. (file 'C:\PROGRAM FILES (X86){}MICROSOFT VISUAL STUDIO 10.0\VC\CRT\SRC\CRTDEFS.H', line 36). This usually comes from include paths, defined by the user, that refer to Microsoft header files. The include paths encompass too many directories, and should be more restrictive. See section about Microsoft include paths.
  5. Parser Error messages. The below warnings concern internal functions of gcc __builtin_va_xxx (referenced in stdargs.h). The warning is specifically a system warning with no impact on the analysis:
    1.  [ parser ]  xxx : Single operand or parenthesized expression expected. (file 'U:\company\appname\SRC\xyz.C', line 163)
      When such messages appear, they may not denote a serious problem. If they appear inside the body of a function, you will lose some links starting from the function, and no more. If they appear in the function header, you will maybe lose the whole function. When the code around the error refers templates (code with lots of "<>" : std::map<std::vector<int> >), this is often an effect of missing header files (see section about pre-processor messages), which can be identified by running test analysis and checking the test analysis log. After running test analysis user will see the entries of missing headers in the test analysis log.
    2.  [ parser ] [: Unmatched parenthesis, brace or bracket, last valid position at ...
      and there is only a "<:" at the mentioned position:
      '<:' is a CPP convention for denoting '['. In this specific case, you need to deactivate the option Accept trigraphs
    3. Unresolved name 'xxx'(file 'Z:\SOURCE\...\ASN1KEYS.C', line 79)
    4. Preprocessor cannot find file 'xx\xxx.hpp'. (file 'Z:\SOURCE\...\ABOUT.H', line 5)
    5. Function xxxx() is called without having been declared. (file 'Z:\SOURCE\...\ASN1KEYS.C', line 80) 
    6. [Parser] --: Unexpected token: --. [ Unexpected token is raised in cases when the trigraphs is used in the source. So to get rid of such warning, Just check the option "accept" trigraphs in the analysis option ]
    7. If you encounter warnings like Warning: [Parser] __attribute__: ';', ',', or '=' expected, refer CMS Snapshot analysis - Run Analyzer - Warnings - CPP with Core CAST AIP - Parser_attribute


Notes


Related Pages