Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Indexer problems at Mars.2 (Eclipse CDT 8.8.1)

I am working on updating My companies CDT integration from Luna SR2 to Mars.2 (equivalent versions of CDT).

 

The only problem that I have ran into so far is that with Mars.2 I get some Indexer problems that I did not get in Luna.

 

Below is an example of some code that can produce 1 of the problems I am seeing.

 

Basically the code below creates a red squiggly in 2 areas that it did not in Luna.

The problem lines are:

58:  #define STR(idx) MY_STRUCT(idx).str

str has a red squiggly under it with error message (Field ‘STR(0)’ could not be resolved)

64: char* str2 = MY_STRUCT(0).str;

str again has a red squiggly under it with error message (Field ‘str’ could not be resolved)

 

This is mostly an annoyance, but it is a pretty big one considering now with Mars.2 almost every file that we work on has some sort of “Error” in it that did not appear before.

 

If this has already been reported, could you send me to the bug report.

 

If you have any clue where I could start looking for the cause of this bug, that would be helpful. I have fixed a few bug in the indexer in the past, so I am somewhat familiar with how it works, but could use a bit of help getting started.

 

Thanks,

Joseph Henry.

 

 

/*

* IndexTest.c

*

*  Created on: Jun 2, 2016

*      Author: johenr

*/

 

#include "stdio.h"

 

/*

* ARRAY_SIZE macro

*

* Returns size of a constant array

*/

#ifndef ARRAY_SIZE

#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))

#endif

 

/*

* ELEM_AT macro

*

* returns the element at i for array a and returns v if out of bounds

*/

#ifndef ELEM_AT

#define ELEM_AT(a, i, v) ((unsigned int) (i) < ARRAY_SIZE(a) ? (a)[(i)] : (v))

#endif

 

typedef struct MyStruct

{

                char* str;

                int   id;

}MyStruct;

 

#define MY_STRUCTS \

                ENTRY(str1, 1) \

                ENTRY(str2, 2) \

                ENTRY(str3, 3)

 

static const struct MyStruct globs[] =

{

#define ENTRY(val,id) \

                                {             \

                        #val,     \

                                                id        \

                                },            \

 

                                MY_STRUCTS

#undef ENTRY

};

 

static const struct MyStruct unknown =

{

                "Unknown",

                -1

};

 

#define MY_STRUCT(idx) ELEM_AT(globs,idx,unknown)

#define STR(idx) MY_STRUCT(idx).str

 

int main()

{

                char* str = STR(0);

                char* str2 = MY_STRUCT(0).str;

                printf("%s",str);

                return 0;

}


Back to the top