I am using Eclipse CDT v4.3.2 from the ARM DS-5 v5.20.0 package for code development and debug of a Makefile
project.
The makefile is actually a hierarchy of mkefiles that create multiple targets in multiple configurations, based on command line options.
In order to allow effective static analysis, I use the project's setting Paths and Symbols
to help the Indexer find the various include files and to highlight the right conditionally compiled code segments.
Our project contains a header file that is included in many of the modules across the code tree. However, two variants of the header file are present in two adjacent directories, for conditional use with two build configurations:
My_Project
|
+-- Include_1
| |
| +-- header.h
|
+-- Include_2
| |
| +-- header.h
|
+-- Source
| |
| +-- module_1.c
|
+-- makefile
The two variants are mostly similar, but contain some differences. These headers contain a few macro definitions and an enum
erated typedef
. Specifically, the following sample parts are identical in both variants:
// header.h
#define SYMBOL 0x1
typedef enum {
constant = 0x2
} enum_t
A typical code module includes one of these headers, depending on configuration in the makefile, and contains references to SYMBOL
and constant
.
In the paths and Symbols
tab, I added only My_Project/Include_1
to the paths list, so the indexer should not get confused. I also disabled the Allow heuristic resolution of includes
option in the Window
->Preferences
->C/C++
->Indexer
menu (in fact, I disabled all Indexer options).
With all of that, when I open the module.c
file in the editor, the references to constant
are marked with the wavy red underline, and a Symbol 'constant' could not be resolved
error is indicated. At the same time, references to SYMBOL
don't have an error indication.
When I rename one of the header files to header_x.h
then the error indication disappears.
1. Why do I get these Indexer error indications?
2. How can I eliminate them?
3. Why only the enums and not the #define-s?