Fwd: parse cpp files imported by #include "*.cpp"

Milian Wolff mail at milianw.de
Fri Nov 22 09:16:50 UTC 2013


On Friday 22 November 2013 16:59:32 black wrote:
> 于 2013年11月22日 08:19, Sven Brauch 写道:
> > There were complaints about this issue before; there's not really a sane
> > way for an IDE to know which context the file will be embedded in, since
> > this might be multiple different contexts. Additionally, I consider this
> > pattern a very bad idea code-wise, so I'd call this a wontfix.
> > 
> > If you see a sane way to do this, feel free to come up with a patch. I
> > don't think it's worth the effort though -- try solving the issue
> > differently code- wise instead
> 
> Thanks for your time. It is a bad coding style indeed. However , I want
> to use kdevelop with
> a big library for Computational Fluid Dynamics, named "OpenFOAM". And
> this coding style was
> used in this library everywhere, the work to change this bad coding
> style in OpenFOAM will be
> very huge. So it maybe worth to have a try.

The example you posted does work btw. What won't work, is if you put these 
includes into namespaces or classes, which I've also seen projects do (Eigen 
e.g.).

a.h
namespace a {
#include "a_impl.h"
}

a_impl.h
int foo;

b.cpp
#include "a.h"
auto foo = a::foo;

But, as Sven said, this is a wontfix. It will probably be resolved as a side-
effect once we use Clang instead of our own parser though.

Bye
-- 
Milian Wolff
mail at milianw.de
http://milianw.de


More information about the KDevelop-devel mailing list