[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [cdt-dev] Parsing code under inactive #if or #ifdef
|
Hi!
I am sure that this is a lot of work, and obviously solution 3 is the
way to go. Without this effort I don't think there can be any reliable
refactoring tools. If only one configuration is analyzed, and you rename
or move elements that occur in different configurations, then the code
would be broken for all other configurations.
Best regards,
Gerhard
________________________________
From: cdt-dev-bounces@xxxxxxxxxxx
[mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Chris Recoskie
Sent: Donnerstag, 11. September 2008 15:18
To: CDT General developers list.
Subject: Re: [cdt-dev] Parsing code under inactive #if or #ifdef
Conditional compilation is very tricky to handle properly. It is
not a matter of just letting the preprocessor output all the code from
all paths through the code as this will generally result in incorrect
code, and thus an unsuccessful parse (or at lesast, one filled with
problem bindings).
Here is a presentation I gave at last year's summit on how we
could handle this:
http://wiki.eclipse.org/images/b/b3/Handling_Conditional_Compilation_In_
CDT%E2%80%99s_Core.pdf
Beforewarned, doing this feature right would mean a lot of work.
I think, in retrospect, that even my large estimates that I gave in that
presentation were somewhat naive.
===========================
Chris Recoskie
Team Lead, IBM CDT Team
IBM Toronto
http://www.eclipse.org/cdt
"Dmitry Smirnov" <divis1969@xxxxxxxxx>
"Dmitry Smirnov" <divis1969@xxxxxxxxx>
Sent by: cdt-dev-bounces@xxxxxxxxxxx
09/11/2008 08:58 AM
Please respond to
"CDT General developers list." <cdt-dev@xxxxxxxxxxx>
To
cdt-dev@xxxxxxxxxxx
cc
Subject
[cdt-dev] Parsing code under inactive #if or #ifdef
Hi,
I'm trying to use AST/PDOM for parsing a project in goal to
build
browsable view of the code (outside of Eclipse, some set of WEB
pages).
For this purpose I would like to have inactive code to be parsed
too.
As I can see, now this is prevented by CPreprocessor class.
Method
executeIfdef() and other similar methods call
skipOverConditionalCode().
I would like to propose some enchancement for this. I believe
some
scanner options could be added that changes default behaviour.
If this
option is active, CPreprocessor will not call
skipOverConditionalCode() thus making parser to handle all the
code.
I suppose, some methods should also be changed (like values of
macro
defined inside active/inactive branches).
What do you think about such feature? Perhaps, CDT already have
some
plans for similar enchancement?
I'm going to test this approach with CDT 5.0. If you have some
thoughts that could help me with it, please let me know.
Dmitry
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev

