Closed BrunoMSantos closed 8 months ago
Point 3. might actually be made redundant by point 1.
Replying to https://github.com/jnikula/hawkmoth/issues/235#issuecomment-2016783664
I don't think any of those points are particularly interesting as long as it works reliably and I think it does, but I was letting you have a say on them I guess. Point 2 particularly, could be investigated a bit more (I spent maybe 15min on this, most of it setting up my environment to replicate the issue).
I don't think any of the points are blockers for merging this as-is now, but rather things to consider for the future.
There hasn't been much activity lately, but I might do a release sooner rather than later with the fixes.
- This would require a version check on the libclang that is actually loaded.
I don't actually see a way to cleanly check the libclang version from python-clang. Do you have any ideas?
I don't think any of the points are blockers for merging this as-is now, but rather things to consider for the future.
Very well, I'm leaning that way too.
I don't actually see a way to cleanly check the libclang version from python-clang. Do you have any ideas?
Not really. Actually I asked you in IRC after having given up already.
Best I could come up with was to look into cindex.Config.library_{file,path}
and infer it from there or, if None
, look into the LD path and so on. Not clean at all...
Merged, thanks for the prompt fix @BrunoMSantos!
Clang 18 now issues the right cursor kind for
extern "C"
blocks, so we need to extend the detection code.Fixes #235.
-->8--
This should reliably fix the detection of those blocks on all supported versions of Clang, but a few improvements might still be possible:
We should probably not check for UNEXPOSED_DECL unless we are on pre-18 versions to keep it neater. This would require a version check on the libclang that is actually loaded.
It is unclear whether we can avoid token matching for v18+. In principle, if the cursor kind is LINKAGE_SPEC, the children cursors are in the C domain. But is that a guarantee or just a strong heuristic? If not, is there a way of checking without token matching?
We should come up with a way to systematically mark code portions that need to be revisited as we update minimum requirements and such to avoid dead code. I can only think of another instance where we might want to do something along those lines (anonymous symbol handling), but I think it may be good to think about this soon-ish rather than later just in case more cases pop up.