Oops. Meant for the list. --DD
From: Dominique Devienne
Sent: Friday, February 27, 2004 2:58 PM
To: 'Curt Arnold'; Dominique Devienne
Subject: RE: [Ant-contrib-developers] [CppTasks] About parsers used
> From: Curt Arnold [mailto:carnold@...]
> On Feb 27, 2004, at 2:10 PM, Dominique Devienne wrote:
> > Looking over CppTasks' parser code, that extracts included/imported
> > files to check for out-of-date'ness of target files, I have the
> > growing feeling it completely ignores the fact that an include
> > statement can be commented out, or #if 0, etc...
> > Is this really the case?
> > This can lead to incorrect dependencies, no?
> > I'd appreciate any insight. --DD
> The dependency parsers does ignore any #ifdefs, comment blocks and the
> like. Evaluating #ifdef's would require Cpptasks to know all the
> builtin preprocessor macros and evaluate all included files to evaluate
> preprocessor expressions which would be hugely more complex if even
> possible to be implemented. The only downside of the current approach
> is the occassional unnecessary rebuild if you did something like:
> #ifdef (__WIN32__)
> #include "foo.h"
Well, there is more than an occasional conditional include for truly
Portable C/C++ code... I understand that paying attention to all
#if, #ifdef, #indef, #define, #undef in the code would be error prone,
and possibly slow, so it should be fine.
But what about non-existent files included on one platform, but not
on the other? Do I not see excessive recompiles only because they
are on the sysincludepath?
BTW, a long time ago, I wrote in Java a prototype C-pre-processor
to get at include files, that obeyed the #if conditionals, etc...
I'm not saying it's complete, nor did it do any caching, but I had
it working OK. Are you interested in looking at it?
> and were running on Linux and changing foo.h then you might have a
> rebuild that you didn't need.
> Commenting out an include like this:
> #include "foo.h"
> would still result in a false dependencty on "foo.h" where
> //#include "foo.h"
> would not meet the production.
I believe the parser should at least be aware of the comments
in the file. This would remove some spurious recompiles. --DD
Get latest updates about Open Source Projects, Conferences and News.