Skip to content

cleaned up access of the check classes#5387

Merged
danmar merged 2 commits intocppcheck-opensource:mainfrom
firewave:checks-3
Sep 11, 2023
Merged

cleaned up access of the check classes#5387
danmar merged 2 commits intocppcheck-opensource:mainfrom
firewave:checks-3

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

@firewave firewave commented Sep 1, 2023

No description provided.

@firewave
Copy link
Copy Markdown
Collaborator Author

firewave commented Sep 1, 2023

This highlights that (outside of testing) most of the implementations of the check do not need to be visible at all outside of their TU. This is what triggered me to start #5323.

Copy link
Copy Markdown
Collaborator

@danmar danmar left a comment

Choose a reason for hiding this comment

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

Well I agree it would be ideal to encapsulate the check classes better in the normal cppcheck program. However I do not feel sure about this. friend is really ugly. There is the expression: "In C++, your friend can see your privates".

I see no ideal solution that people will not see problems with.

@firewave
Copy link
Copy Markdown
Collaborator Author

firewave commented Sep 1, 2023

Well I agree it would be ideal to encapsulate the check classes better in the normal cppcheck program. However I do not feel sure about this. friend is really ugly. There is the expression: "In C++, your friend can see your privates".

I see no ideal solution that people will not see problems with.

The friend is only for test usage which is good. I will make further adjustments in follow-up PRs so they can be reduced/dropped in preparation of #5323.

@danmar
Copy link
Copy Markdown
Collaborator

danmar commented Sep 2, 2023

The friend is only for test usage which is good.

Yeah I know, that is your intention. Any class that happens to have a certain name can see those privates, you don't technically enforce somehow that this is only used in testing.

I don't feel excited about adding friends. And well I don't feel totally excited about alternatives neither.

@firewave
Copy link
Copy Markdown
Collaborator Author

firewave commented Sep 2, 2023

Any class that happens to have a certain name can see those privates, you don't technically enforce somehow that this is only used in testing.

Before it was public and anybody could have used the implementation stuff.

The code should not have friend declarations (we already have it in other places) but that requires tests (or even library code) to be refactored or even completely re-written. This at least gives an indication where there is work to do.

@danmar
Copy link
Copy Markdown
Collaborator

danmar commented Sep 4, 2023

we can delay this refactoring until after the release at least.

@firewave firewave added the merge-after-next-release Wait with merging this PR until after the next Release label Sep 4, 2023
@firewave
Copy link
Copy Markdown
Collaborator Author

firewave commented Sep 4, 2023

we can delay this refactoring until after the release at least.

Fine with me.

@firewave firewave removed the merge-after-next-release Wait with merging this PR until after the next Release label Sep 10, 2023
@danmar
Copy link
Copy Markdown
Collaborator

danmar commented Sep 11, 2023

well.. all I say is that I don't know any solution that I like. Let's do it this way if you think this is better.

@danmar danmar merged commit bbe45ff into cppcheck-opensource:main Sep 11, 2023
@firewave firewave deleted the checks-3 branch September 11, 2023 11:00
@firewave
Copy link
Copy Markdown
Collaborator Author

well.. all I say is that I don't know any solution that I like. Let's do it this way if you think this is better.

You're gonna like #5435. 😃

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.

2 participants