compile `--rule-file` pattern only once / extracted regular expressions code to separate file
This is mainly so the issues are reported on start-up instead on each file. It does not improve performance much.
The refactoring and improved testing will also make it easier to add support for PCRE2 since PCRE is EOL since quite a while (see https://trac.cppcheck.net/ticket/10610).
So it seems the shared pointers do not seem to work with forked processes.
But there is something else:
[processfs_1.cpp :0]: (error) Internal error: Child process exited with 1
I wonder where the whitespace in the filename is coming from.
I will split the changes which are are not related to the compilation into a separate PR.
I will split the changes which are are not related to the compilation into a separate PR.
See #6212.
So it seems the shared pointers do not seem to work with forked processes.
The problem is that the memory behind the shared pointer is leaked in the forked process:
=================================================================
==8818==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 1248 byte(s) in 13 object(s) allocated from:
#0 0x560b0513391f in malloc (/home/runner/work/cppcheck/cppcheck/cmake.output/bin/testrunner+0x4a791f) (BuildId: 6af36c8d50c9763d4f05b83d43e79ba4537c85c0)
#1 0x7f7c196469b9 (/lib/x86_64-linux-gnu/libpcre.so.3+0x559b9) (BuildId: 3982f316c887e3ad9598015fa5bae8557320476a)
Indirect leak of 1056 byte(s) in 4 object(s) allocated from:
#0 0x560b0513391f in malloc (/home/runner/work/cppcheck/cppcheck/cmake.output/bin/testrunner+0x4a791f) (BuildId: 6af36c8d50c9763d4f05b83d43e79ba4537c85c0)
#1 0x7f7c1961f2a3 (/lib/x86_64-linux-gnu/libpcre.so.3+0x2e2a3) (BuildId: 3982f316c887e3ad9598015fa5bae8557320476a)
SUMMARY: AddressSanitizer: 2304 byte(s) leaked in 17 allocation(s).