Skip to content

removed CppCheck dependency from CppCheckExecutor::parseFromArgs() #4967

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

Merged
merged 2 commits into from
Apr 16, 2023

Conversation

firewave
Copy link
Collaborator

@firewave firewave commented Apr 14, 2023

That function is basically just parsing the command-line options into the settings so no need for a CppCheck object yet. Also moved the object down to the actual usage.

Preparation for moving the Settings ownership out of CppCheck in #4964.

@firewave firewave marked this pull request as draft April 14, 2023 10:49
@firewave firewave changed the title removed CppCheck dependency from CppCheckExecutor::parseFromArgs() relaxed CppCheck dependencies in CppCheckExecutor Apr 14, 2023
@firewave firewave marked this pull request as ready for review April 14, 2023 10:59
@@ -310,11 +303,15 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck)
AnalyzerInformation::writeFilesTxt(settings.buildDir, fileNames, settings.userDefines, settings.project.fileSettings);
}

CppCheck cppcheck(*this, true, executeCommand);
cppcheck.settings() = settings; // this is a copy
Copy link
Collaborator Author

@firewave firewave Apr 14, 2023

Choose a reason for hiding this comment

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

This highlights the issue I want to resolve by moving the ownership out of CppCheck. We need to propagate back all the changes from the settings attached to CppCheck. In some cases we are not doing this correctly. This is why the settings should be immutable during the analysis so we don't have to do that.

Also we do that copy for each file with the multi-threaded implementation which is a hot spot if there are many libraries loaded.

@firewave firewave changed the title relaxed CppCheck dependencies in CppCheckExecutor removed CppCheck dependency from CppCheckExecutor::parseFromArgs() Apr 14, 2023
@firewave
Copy link
Collaborator Author

I backed out the further refactoring as it doesn't work until the ownership has been changed.

@firewave firewave merged commit 9ad26f5 into danmar:main Apr 16, 2023
@firewave firewave deleted the cmd-cppcheck branch April 16, 2023 11:54
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