-
Notifications
You must be signed in to change notification settings - Fork 357
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
Modernize the code base and make it more compliant to common C++ style guides #2479
Conversation
The MacOS test seems to fail for some reason, can someone help me find the cause of the issue?
|
@JanVogelsang I built under macOS now (with Clang 14 while Github runners have Clang 13, but should not make much of a difference), and did not run into any problems. I also noted two things in the FULL_MACOS build here:
and there are probably a few more. They all seem to be related to overriding. |
@heplesser I addressed all issues related to overrides in my latest commit, which should fix the compiler warnings. The warning we got originated from the following problem: |
@JanVogelsang Thanks a lot, nice that all now passes without warnings on all systems. I saw that the "unlink" error message is still there on macOS, but that might just as well come from the py-mpi-testing setup, so I would not worry about it. |
...which was created automatically by some script and was not supposed to be committed.
I went through all my changes again, to make sure that my statement that nothing changes performance-wise is correct, and that is indeed the case. |
There are still quite a few formatting errors. Most of them because of leftover whitespace in empty parentheses of functions, for example here: nest-simulator/libnestutil/lockptr.h Line 124 in 96620fe
It's not picked up because of a bug (#2471) which will be fixed by #2478. |
Alright, will fix those asap. |
…ain (probably because of a different clang format version)
…fe more convenient
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JanVogelsang An impressive effort, thank you! I have some comments, please see inline.
@jougs Could you be the other reviewer? 95+% is quickly reviewed boiler plate, in the remaining 5% are a few things that would benefit from experienced eyes. |
@JanVogelsang Just one more comment: In order to keep this PR manageable, I'd suggest to not touch any other code lines in this PR beyond those already touched (except adding |
@JanVogelsang Please try compiling before you commit and push, so we don't get a lot of commits in master that doesn't compile (compiling would also have told you about the missing semicolon from earlier 😉). There are also still formatting errors that aren't picked up by the static checks. You can fix all C++ formatting errors by running the script |
Yeah, will do that every time before pushing in the future. Usually do that, didn't do it in this case as I didn't imagine the changes could break anything. Good to know, will run that! |
@hakonsbm How do I run |
Maybe better to not run that script directly, as it is being called from the I recommend to check instead |
@hakonsbm By the way, is it possible to squash commits that are already pushed somewhere? Would be great if I could squash all commits of this PR into a single one once everything is done. |
I would think that squashing could make sense in this case, but I would leave the final word to @jougs and @terhorstd. |
@JanVogelsang @med-ayssar CLANG_FORMAT=clang-format-13 build_support/format_all_c_c++_files.sh |
@hakonsbm I am unsure why the script is not working out of the box, as it seems correct to me (and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm generally positive about this one even though the problem with this type of PR is usually not what is in, but what was forgotten and thus cannot be reviewed ;-)
I'll approve when my comments have been addressed
@JanVogelsang Thanks, I have marked most of the matters I had raised as resolved. |
Concerning
I have not systematically tried to go below four threads and eight neurons. The nest-simulator/nestkernel/connection_manager.cpp Line 1448 in e1c80d0
Without the nest-simulator/nestkernel/connection_manager.cpp Lines 1449 to 1471 in e1c80d0
will in the end just return But this does not seem clean to me. @jougs, what do you think? NB: If there is any need to act on this, we need to open a new issue. |
Just an update to my previous post: I think we can solve the problem by changing the order of test in the code above in such a way that we first check for |
I am genuinely confused why, but after running
|
Please create another PR, as to reduce confusion for reviewers. |
… min in dictutils
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JanVogelsang Thanks for all the work! I have resolved all questions I had raised, so now just points raised by @jougs remain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm approving and closing all conversations, trusting that a NESTML issue will be filed soon. Many thanks for this nice cleanup!
After working on the nest kernel for some time, I stumbled across multiple cases of either error-prone or nonmodern code that in some cases even led to hard-to-find bugs that could have been easily avoided if the code followed modern C++ style guides.
Running cang-tidy on the whole codebase with the most important checks gave me ~8000 possible improvements. I took the time and went through all suggestions and applied the most important ones, especially those for which I knew they would definitely not break anything. I manually applied about 2000 of them, fixing the following problems:
It still would be a lot of work to clean up the whole codebase, but this PR is a good start in making NEST a sustainable software.