-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Support selected Intel-specific preprocessor macro expansions #341
base: master
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #341 +/- ##
==========================================
+ Coverage 87.51% 87.79% +0.27%
==========================================
Files 35 35
Lines 4756 4824 +68
==========================================
+ Hits 4162 4235 +73
+ Misses 594 589 -5 ☔ View full report in Codecov by Sentry. |
I'm not sure what to do about the warning on the regex above, but otherwise this seems to be working like a champ. I look forward to your comments and/or your merging hopefully soon :-) |
I see a lot of changes that are seemingly unrelated in this PR. My expectation would be that you would only need to add |
I buried the lede perhaps, but did rename the PR to say it is performing full macro expansions for function-like macros. That was actually the intent of this PR and the whitespace changes were just a bonus. I will change the name again to be even more explicit about what is going on here. This resulted in a need for updated/new unit tests, which are the remaining updates. In order to also support lines containing tabs in addition to spaces, I chose to use |
Sorry, should have included this in my last message, but let me elaborate on specifically how I do this. The updated If regex group 3 contains a match, parens are present in the macro name, and rather than just adding the string of the #define's "value" to the In later code that parses out values from pp_defs dicts, I add code to detect if the contents are a tuple rather than simple string. If so, then the expansion is performed as necessary. Otherwise, it behaves just as before. I searched the code for everywhere it seemed like pp_defs or something similar were being referenced, so all the bases should be covered on handling the tuple where previously it was only a string. I added unit tests for these expansions as well as testing for additional whitespace in PP directives, which themselves broke other unit tests, and I made a number of changes as a result of expected changes due to the new unit test and code changes. The only test that continued to fail was one regarding server update, which was the result of my running the tests in a conda environment. It is expected that the update will not be performed when tests are run in a conda environment, so that test checks if the test environment is a conda environment and changes the expected test value if so. Another Easter egg update I forgot about until reviewing the changes again just now, ha ha. |
I will have a detailed look at the PR but I am not sure the proposed solution works for all cases |
I can replace the \s with spaces, happy to do that. At a minimum, this implementation should be consistent with Intel and gfortran conventions. I can't speak to any other preprocessors. I am happy to continue improvement to support others if there are cases that this doesn't work, I just need test cases for those and I can add to the unit tests. Now that this infrastructure is in place for doing the expansions, it shouldn't difficult to tweak as needed for other edge cases. |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
I made the requested update above to only check for spaces. I have subsequently come across some code that depended on Intel's compiler directives, so I added an option here to support that (defaults to disabled, Intel users would need to opt in). |
I haven't forgotten about this @emanspeaks, I have a mostly-finished review (that is now outdated since the last push). It is in my TODO list and I will try and finish today, but I am quite busy (so no promises) I will make it 😟 |
I've noticed the PR now includes Intel-specific options. Let's break down these features into separate PRs to keep things manageable and focused. Intel OptionsRemember, our language server is vendor-neutral. We can't start adding compiler-specific features; it's not sustainable. If Intel directives fit with our current preprocessor, great, let's include them. If not, we can't realistically rewrite the preprocessor for both We should discuss this further, but as a separate issue and PR. For this PR, what are the features that are vendor agnostic and are responsible for the macro expansion? These should be the focus. Let's cherry-pick and either update this PR or open a new one with only these features. |
Yeah, this morphed rather organically from where this branch started. I agree it makes sense to split this up. It shouldn't be terribly difficult to take care of, and will try to do that this weekend. |
for more information, see https://pre-commit.ci
Given that the name of this branch I'm working from here is named Assuming, though, it's ok to proceed here, let me reconcile this branch now with the forked changes in #350 and will let you know when this is ready for review again. |
Closes issue 297Addresses spaces on either side of the hash in preprocessor lines(Edit: this PR has been repurposed after refactoring. The previously-cited description now applies to #350.)
Addresses Intel compiler extensions present due to legacy support for older compiler versions. These are particularly prolific in their implementation of Fortran standard library modules and system/platform-specific modules, but for which it would be desired to have hover capabilities for those users working in the Intel ecosystem.