Indexer confusion [message #1407879] |
Wed, 13 August 2014 17:44 |
Tauno Voipio Messages: 742 Registered: August 2014 |
Senior Member |
|
|
I have a CDT project with several parallel source directories.
It seems that the CDT indexer gets confused with enumeration values
in headers in parallel directories. A minimal example contains two
directories, d/ and s/. There is a C source file d/d.c and a
corresponding header file d/d.h. In directory s/, there is a header
file s.h. Both header files contain an enumeration defining the same
value symbol.
So the structure is:
d/
d/d.c:
---
#include "d.h"
int testfunc(void)
{
return VALUE; /* this line will be flagged */
}
---
d/d.h:
---
#define BAD 0
#if BAD
enum separate
{
VALUE
};
#else
enum same
{
VALUE
};
#endif
---
s/
s/s.h:
---
enum same
{
ZERO,
VALUE
};
---
If #define BAD is changed to a non-zero value, CDT reports an error:
Symbol 'VALUE' could not be resolved d.c /test/d line 5 Semantic Error
The error disappears if the header file s.h is removed. As far as I
understand, the contents of directory s/ should not have any effect
to a file in directory d/, as s/ was not defined in the project include
search paths for the directory d/ and its ancestors.
--
Tauno Voipio
|
|
|
Powered by
FUDForum. Page generated in 0.02590 seconds