Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help CLion IDE evaluate PYBIND11_NUMPY_DTYPE #899

Merged
merged 1 commit into from
Jun 23, 2017
Merged

Conversation

dean0x7d
Copy link
Member

I'm a bit hesitant to propose this PR since it's really a problem which should be taken care of by the IDE. The issue is that CLion slows to a crawl when its static analysis hits the intricate PYBIND11_NUMPY_DTYPE macro -- making it unresponsive while it churns through the recursive preprocessor replacements. I've raised the issue in their bug tracker but it doesn't look like it's getting fixed anytime soon, so I'm proposing a quick workaround here.

This PR adds a special #ifdef for the IDE to replace the macro cascade with a simple (void)0 to ease evaluation. This doesn't affect any actual code compilation, just the IDE's static analysis (but PYBIND11_NUMPY_DTYPE doesn't have any static side effects anyway).

Adding workarounds to the code is always ugly so I don't want to push this if it's deemed too much of a nuisance, but the macro performance hiccups have gotten bad enough that I had to at least propose it.

CLion slows to a crawl when evaluating the intricate `PYBIND11_NUMPY_DTYPE`
macro. This commit replaces the macro cascade with a simple `(void)0`
to ease IDE evaluation.
@aldanor
Copy link
Member

aldanor commented Jun 10, 2017

Ha, this is cheesy and clever :) I'd for one support it since but I'm being subjective too since I've just started using CLion (again) recently. I didn't know they define __CLION_IDE__, is this very recent?

@dean0x7d
Copy link
Member Author

Yeah, pretty recent. It's defined starting with version 2017.1: from the EAP blog.

@jagerman
Copy link
Member

No objection from me. I should point out how ${MYEDITOR} is better, though.

(For the record, vim + clang-based youcompleteme).

@dean0x7d
Copy link
Member Author

dean0x7d commented Jun 12, 2017

Ha, we should avoid touchy subjects like editors and certain invisible characters.

@dean0x7d dean0x7d merged commit 24dec80 into pybind:master Jun 23, 2017
@dean0x7d dean0x7d deleted the clion branch June 23, 2017 11:32
@dean0x7d dean0x7d modified the milestone: v2.2 Aug 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants