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

Core library cleanup #1457

Merged
merged 4 commits into from
Mar 14, 2025
Merged

Core library cleanup #1457

merged 4 commits into from
Mar 14, 2025

Conversation

blaisb
Copy link
Contributor

@blaisb blaisb commented Mar 12, 2025

Description

In the aims of deploying a CI that would check for warnings using the clang compiler, I am fixing some of these warnings ahead of time by cleaning the code file by file. This PR addresses this for only 4 files in the core library, but this has impact beyond the code library itself.

One important thing, I have learnt that according to clang we should not mark stuff const in the .h file, but on in the .cc file ( see https://stackoverflow.com/questions/38660537/why-is-const-unnecessary-in-function-declarations-in-header-files-for-parameters) and so I have applied these changes also here.

Testing

All unit tests should not change. They did not.

Miscellaneous (will be removed when merged)

Checklist (will be removed when merged)

See this page for more information about the pull request process.

Code related list:

  • All in-code documentation related to this PR is up to date (Doxygen format)
  • Copyright headers are present and up to date
  • Lethe documentation is up to date
  • The branch is rebased onto master
  • Code is indented with indent-all and .prm files (examples and tests) with prm-indent
  • If parameters are modified, the tests and the documentation of examples are up to date
  • Changelog (CHANGELOG.md) is up to date if the refactor affects the user experience or the codebase

Pull request related list:

  • No other PR is open related to this refactoring
  • Labels are applied
  • There are at least 2 reviewers (or 1 if small feature) excluding the responsible for the merge
  • If this PR closes an issue or is related to a project, it is linked in the "Projects" or "Development" section
  • If any future works is planned, an issue is opened
  • The PR description is cleaned and ready for merge

@blaisb blaisb added the Refactoring This PR is only refactoring or clean up label Mar 12, 2025
Copy link
Collaborator

@oguevremont oguevremont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes make sense to me!

@@ -97,17 +95,17 @@ maximum_number_of_previous_solutions()
*/
inline unsigned int
number_of_previous_solutions(
Parameters::SimulationControl::TimeSteppingMethod method)
const Parameters::SimulationControl::TimeSteppingMethod method)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the const be absent here, given the link in the description?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good question friend. Because this is an inline function the function is defined afterwards. So here the header does not contain the function prototype but the function itself. Consequently, the const has to be there because the function is defined straight up afterwards :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that makes sense! Thank you for the explanation

@blaisb blaisb force-pushed the core_library_cleanup branch from 9f00f03 to 2ac943a Compare March 14, 2025 15:48
@blaisb blaisb merged commit d55c788 into master Mar 14, 2025
11 checks passed
@blaisb blaisb deleted the core_library_cleanup branch March 14, 2025 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactoring This PR is only refactoring or clean up Reviewed and ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants