Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
false diagnostics in include files due to never-firing #ifdefs #115
I am aware of this issue. https://github.com/MaskRay/ccls/releases/tag/0.20180924 It parsed import file (
Added a section to https://github.com/MaskRay/ccls/wiki/FAQ
Diagnostics in headers
For headers that are not self-contained (e.g. some /usr/include/bits/*.h which require a predefined macro) ccls emits diagnostics that you don't see when building the project.
// a.c #define M #include "a.h" // a.h #ifndef M #error M not defined #endif
One approach ccls explored before was to compile its import file a.c, but it caused severe performance issue for some projects. For smaller files this does not matter and checking for a header guard may help the situation.
BTW (see FAQ), if you don't need any cflags, neither
referenced this issue
Dec 20, 2018
Thanks @MaskRay I read the FAQ which does summarize the problem well. Just to be clear, what the FAQ is saying is that it's a known limitation at this time?
What I would like to see (I know this is probably not trivial) would be (a) allowing for both
Finally, it would be very nice if the
These enhancements would allow us to create a
This is a reasonable extension to the current behavior.
We've already have 3 things to describe cflags:
This is also reasonable.
Thinking about this, I suggest this set of priorities, from lowest to highest:
My justification for this ordering is:
Translating these general rules into concrete behavior is maybe not so simple. For non-preprocessor options like
However, for preprocessor flags it's the inverse: if you have
Since ccls cares more about preprocessor options and not as much about other options, maybe it should say that higher-priority sources will be prepended to lower-priority sources. Of course there are other options ccls will care about I expect like architecture choosing options etc.
Another idea would be to have the user explicitly request things in the order they wanted.
For example, if the
So, in this situation the rules for ccls would be:
or something like that (allowing multiple
One nice thing about this is it allows users to choose to ignore
I'm not sure how initialization options fit into this. Maybe they're just added to the end. Or, maybe those options themselves have a way to request loading of the