Related
How to configure an analysis with C/C++
What's different with C/C++?
When analyzing C/C++ source files, important information needed for the analysis is specified at compilation time and Kiuwan Local Analyzer can't know about this in advance.
For example:
- Where header files used in the source code are located.
- Which macros are defined at compilation time.
Kiuwan Local Analyzer can automatically resolve this configuration to get a complete reliable analysis.
Inspecting build logs
Kiuwan Local Analyzer can inspect C and C++ build log files to automatically resolve headers and macros used in your source code.
Follow these steps to configure Kiuwan Local Analyzer by inspecting your build logs:
- Run the build tool (make, nmake, imake, MSbuild, scons, etc.) for the software to analyze and dump the build output to a log file. Make sure that build runs with clean dependencies. You may set the -n flag to make a build without executing compilation scripts and to ensure that commands are dumped. Examples:
make clean && make -n > build.log
nmake /N clean all > build.log --> cmd windows
msbuild /nologo /t:rebuild MyProject.proj > build.log
scons -Q -n > build.log
- Open the Kiuwan Local Analyzer, log in, select the application to analyze and set a source code folder.
- Select the language to analyze (C or C++) and click the Configuration button.
- In the Analysis Configuration tab, select the analysis language in the Select block dropdown menu (C or C++).
- Click on the Details button in the Analyze build logfile row.
- Browse the generated build log file and click Analyze.
The selected build log file will be analyzed to resolve used headers and macro definitions. Once the build log file analysis is done, a results window will be shown:
Follow these steps to apply the found information to your configuration:
- Click on OK to update the header and macro configuration with the found data.
- You can check that the "Header directories" and the defined macros will have been updated with the new information.
- Click on Save" button to apply the configuration to your application (or globally).
You can also click on "Cancel" button if you want to analyze again a log file, change the log file or not apply the found information to the current configuration. Note that the configuration will not be saved until you click on "Save" button in the main configuration dialog.
Now you can click on "Analyze" to analyze your C or C++ application with the new header and macro definitions.