Imagix 4D User Guide


Fine Tune the Analyzer Options (C/C++)

6a. review the analysis results
When the analysis is completed, the Analysis Results window appears. You'll use the information in this window to fine-tune your analysis settings.

6b. correct any problem with filename specification
If you used the adding a makefile target approach, the Analyzer Results window starts off echoing the commands generated by make. If the window doesn't include any `Analyzing foo.c' style comments, then a problem occurred. The most common problem is that no source files were specified. Check your definition of IMAGIX_SOURCES in the makefile (using your own editor).

6c. determine any missing -I, -D or -U flags
Next, for any approach, the Analysis Results window lists each file that was analyzed (as `Analyzing foo.c'), followed by a list of any messages related to problems analyzing that file. These analyzer messages can be corrected by modifying the -I, -D and -U flags that are used to analyze the code.

If you see an analyzer message that says `cannot open file', the most likely cause is that the directory containing the include file hasn't been specified. Determine where the included file is actually located, and thus what directory should be included through a -I switch.

If the analyzer is finding the include files, but you're still getting a lot of error messages, such as `unknown type foo near symbol bar', the problem is likely to be incompletely or inaccurately specified -D and -U flags.

The most typical errors occur because required types are unknown, as their typedefs occurred in sections of header files that were passed over because of how the -D and -U flags were specified. First, examine the code where the analysis problem was reported, by opening the file (MOUSE [Double-Left]) from the appropriate message in the Analysis Results window). Determine if there are required types that are unknown (you can use Symbol Index or Database Lookup tabs to help with this). If they are unknown, determine where the type should have been defined. You can use the Grep Tool tab to help with this. Determine what set of macro definitions would have been necessary to cause this code to be analyzed.

Alternatively, you can have the Analysis Results window collect much of this data for you. Select (MOUSE [Left]) the line in the Analysis Results window to select a specific error message. Then switch to the error analysis view (LOCAL MENU Display > Show Error Analysis). This will automatically generate much of the data described in the previous paragraph. You'll still need to determine what changes to make to the macro definitions.

Note: The Imagix 4D analyzer will produce error messages that you might not get with lexical parsers. This is because the Imagix 4D analyzer does full semantic parsing, like a compiler, in order to extract more complete and accurate data from your source files. However, unlike a compiler, the Imagix 4D analyzer has built-in error correction. After encountering a parsing problem, Imagix 4D resynchronizes to your source code, and reports which lines had to be skipped while it was resynchronizing. So as you review analysis results to determine whether the parsing issues were significant, take into consideration how many lines were ignored.

6d. modify the -I, -D or -U flags
If you're using the compiler configuration file approach and the missing include directory is a system header file directory, or the missing -D applies to the system header files, modify the compiler configuration file appropriately.

Otherwise, add the additional -I and -D flags to the list of other preprocessor flags. Under the add target to makefile approach, you now need to work in the makefile itself and modify IMAGIX_FLAGS that is defined there.

For the other approaches, you'll continue to work in the Data Sources dialog; you may need reopen it via MENU Project > Data Sources. For the dialog-based approach, make the necessary changes on the Source Files or Include Dirs tab.

Under the extract from makelog approach, you'll need to decide whether the problem results from the makelog itself or from the processing of the makelog. If generating a new makelog or changing the processing rules can't fix the problem, there are a couple of workarounds to consider. The first is to add flags to the Options field on the Makelog tab; in this case the flags will be propagated to each of the Dialog-Based (C/C++) data sources when they are next generated. The second is to modify just certain of the Dialog-Based (C/C++) data sources that have already been generated. Generally, this second workaround is discouraged; any changes you make to specific Dialog-Based (C/C++) data sources will be lost the next time you process the makelog (step 5h), which you'll need to do if you change or regenerate the makelog, change the processing rules, or add flags to the Options field.

6e. specify the entire set of source files
If you are purposely only analyzing a subset of your files while you adjust the preprocessor flags, and if you have adjusted the -I, -D and -U flags so that you're getting just a few error messages, change the file definitions to reflect all the files you want to analyze. For the makefile approach, redefine IMAGIX_SOURCES in the makefile itself. For the dialog-based approach, use MENU Project Data Sources to bring up the original Data Sources dialog, and specify the change in the Files field on the Source Files tab.

6f. reanalyze the source files
Once you have modified the compiler configuration file, the makefile, and/or the Data Sources dialog as appropriate, reanalyze the code. For compiler configuration file or makefile changes, use MENU Project > Regenerate Project Data.

6g. repeat this process
Return to step 6a, and repeat this process until you're satisfied with the analysis results.