Help CDT parser [message #848602] |
Wed, 18 April 2012 11:58 |
CoR Missing name Messages: 1 Registered: April 2012 |
Junior Member |
|
|
Hi all,
I've been a big fan of Eclipse for a while, and the more I use it, the more I like it.
I'm currently working on a big (~1000 compiled headers and sources files) code tree, and CDT parser is doing quite a good job actually, but there is few things that it's not confortable with, and I would like to help it get through that.
Here is the kind of things the parser is dealing with:
(includes are shown as a tree structure, and this is a "simplified" view)
/* Get all signals in a big union */
#define GET_UNION
union MyUnion {
#include <signal.h>
|
|...
|#if defined(GET_UNION)
|# define SIGNAL(ENUM, UNION) UNION;
|
|#include <signals.h>
||#include <testsignals.h>
|||SIGNAL(testa, int TestA)
|||SIGNAL(testb, int TestB)
||#include <othersignals.h>
|||SIGNAL(othera, int OtherA)
|...
|#endif /* GET_UNION */
};
#undef GET_UNION
/* Get all defined signals as an enum */
#define GET_ENUM
enum MyEnum {
#include <signal.h>
|
|...
|#if defined(GET_ENUM)
|# define SIGNAL(ENUM, UNION) ENUM,
|
|#include <signals.h>
||#include <testsignals.h>
|||SIGNAL(testa, int TestA)
|||SIGNAL(testb, int TestB)
||#include <othersignals.h>
|||SIGNAL(othera, int OtherA)
|...
|#endif /* GET_ENUM */
};
#undef GET_ENUM
The thing is that headers (testsignals.h for instance) is interpreted differently depending on the context, and I understand that this is no easy task to handle.
My problem is that these definitions are at the core of our system, and having these symbols recognized and the "Open Declaration" function working would redefine awesomeness.
That's why I manually wanted to help the parser by having some kind of rule saying that every time it encounters a SIGNAL macro, it must define two declarations:
- one as an enumeration in MyEnum
- one as an union element in MyUnion
... and both of these declarations would point to the same line.
This is a project-specific feature, but I wondered if there was some hook when a matching (or even undefined) symbol is encoundered, and an API in CDT that would allow me to push definitions into the parser index ?
Even pointers to source code would be really nice
Thanks,
Bertrand
|
|
|
Powered by
FUDForum. Page generated in 0.01836 seconds