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

Allow to run clang-format on nocmodl generated C++ files #2542

Merged
merged 2 commits into from
Sep 27, 2023

Conversation

pramodk
Copy link
Member

@pramodk pramodk commented Sep 26, 2023

With the current master if we run clang-format on the MOD file generated C++ file and try to rebuild the NEURON then we get errors like

src/nrnoc/netstim.cpp:393:28: error: no member named '_prop' in 'Point_process'; did you mean 'prop'?
    auto* const _p = _pnt->_prop;

This is because we have some magic header macros that rename certain internal variables.

To avoid the issue, just tell clang-format to avoid sorting these specific headers included.

With the current master if we run clang-format on generated file
and try to rebuild then we get errors like

```
src/nrnoc/netstim.cpp:393:28: error: no member named '_prop' in 'Point_process'; did you mean 'prop'?
    auto* const _p = _pnt->_prop;
```

This is because we have some magic header macros that rename certain
internal variables.

To avoid the issue, just tell clang-format to avoid sorting headers
included.
@pramodk pramodk requested a review from alkino September 26, 2023 14:30
@1uc
Copy link
Collaborator

1uc commented Sep 26, 2023

Alternatively, one could add newlines. AFAICT clang-format and others format blocks of #include but not if they're separated by a newline. (Eliminates the risk of misspelling of.)

@bbpbuildbot

This comment has been minimized.

@azure-pipelines
Copy link

✔️ 3efad2e -> Azure artifacts URL

@pramodk
Copy link
Member Author

pramodk commented Sep 27, 2023

@1uc : I can change it. But may be having this explicit is better?

@pramodk pramodk merged commit 8985d2b into master Sep 27, 2023
20 of 29 checks passed
@pramodk pramodk deleted the pramodk/clang-format-fix branch September 27, 2023 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants