Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Parsing inactive code in CDT
Parsing inactive code in CDT [message #1706963] Tue, 01 September 2015 08:09
Fadi J is currently offline Fadi JFriend
Messages: 11
Registered: June 2013
Junior Member
Hello everyone,

I'm developing a new Codan checker for C code static analysis purposes. My checker requires that the inactive code has to be included in the AST.

for example lets take the following code

#define z 10
int main(void) {
int x = 0, y = 0;
#if (z > 0)
x = 1;
#else
y = 2;
#endif
}

The generated AST for this code will not contain the statement y=2 because it will be marked as inactive code by the preprocessor.

I tried to solve the problem by calling the function
org.eclipse.cdt.internal.core.parser.scanner.ScannerContext.setParseInactiveCode(ture)
but it doesn't works.

the problem can be solved by modifying the class (org.eclipse.cdt.internal.core.parser.scanner.ScannerContext) or (org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor)
but I'm looking for a better solution so my checker can work with newer CDT releases without the need to modify the source code.

So my questions are: is there is a better solution, or can I commit my changes to the repository?

P.S. I'm using the C language preprocessor, not C++.

Thanks in advance.
Previous Topic:Old output keeps displaying, till process is ended in task manager
Next Topic:Passing system date / time to C program
Goto Forum:
  


Current Time: Wed Sep 11 17:22:55 GMT 2024

Powered by FUDForum. Page generated in 0.03713 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top