* dump: Fix concurrency problem with dump files
This adds the process ID for the cppcheck process to the filenames
of the .dump and .ctu-info files that the process generates.
So
lib/cppcheck.cpp.dump
becomes
lib/cppcheck.cpp.<PID>.dump
For example:
lib/cppcheck.cpp.2637871.dump
The reason for this change is that if there is a buildsystem which
supports concurrency, multiple instances of cppcheck may be run for
the same file. For example, if the same file is compiled in multiple
build variants, or for multiple targets.
If running the MISRA plugin over such a project with concurrency
enabled in the buildsystem, the plugin ends up crashing as multiple
jobs attempt to create/trample/delete the same files while other
jobs are using them.
For more information see:
https://sourceforge.net/p/cppcheck/discussion/general/thread/02c757b4af/
* dump: Include pid in filename if dump not explicit
Only change the dump and ctu-info filenames to include the PID if
they are being generated due to an addon.
This means that existing scripts that use `--dump` will still work
if they depend on the previous naming behaviour. The more robust
filenames containing the pid will be used when the dump files are
used as an internal implementation detail for passing data to addons.
However this means that anything that does explicitly use `--dump`
will be susceptible to concurrency problems.
* test: Update addon dump file test to account for pid
This test causes a dump file to be created by enabling the misra
addon. Since the dump files now include the cppcheck process pid
this test had to be updated to account for the change.
* moved `plistFile` from `ErrorLogger` to `CppCheck`
* got rid of global CWE objects
* lib/CMakeLists.txt: suppress some `-Wfloat-equal` clang warning in matchcompiled builds as well
* lib/CMakeLists.txt: moved a loop into proper block
* test/CMakeLists.txt: simplified `add_fixture`
* test/CMakeLists.txt: moved `fixture_cost`
* fixed `naming-privateMemberVariable` selfcheck warning
* iwyu.yml: use debian:unstable to always get latest include-what-you-use
* cleaned up includes based on include-what-you-use
* mitigated include-what-you-use false positives
In the CppCheck::executeAddons function, a check that specifically tests
for the misra add-on, was not taking into account the cases when the
addon is identified with the '.py' extension or indirectly via json.
This resulted in the add-on not being executed a second time which is
needed to detected some of the misra violations. By using the AddonInfo
class name field, the addon name is uniformized for all these cases and
the add-on executed a second time.
Signed-off-by: Jose Martins <josemartins90@gmail.com>