Required to support Python 3.13 and later because the new C API used
in 1d8c525af was introduced in Python 3.8; the previous API was a
holdover from Python 2, deprecated in 3.7, and is removed in 3.13.
To use pass -DCMAKE_BUILD_TYPE=Debug or Asan -DCOVERAGE=ON and build as
usual, then do ninja lcov-initialize && ninja check && ninja
lcov-collect. The result will be a directory, <Builddir>/Coverage
containing lcov tracefiles, including an aggregate file gnucash.info
which you can use for further processing. It will also report an overall summary.
Note that only C/C++ files are included.
There's one more target, lcov-generate-html, that you can run after
lcov-collect. It will generate a simple website in
<Builddir>/Coverage-HTML showing coverage by source directory (the
directories in <Builddir> have coverage for generated files). Each
directory path is a clickable link to a page that shows coverage for
each source file; the filenames link to a page for each showing which
lines have been exercised.
pass -DLEAKS=ON or -DODR=ON to enable these features. They have an
effect only with CMAKE_BUILD_TYPE=Asan and don't work on Apple because
Apple clang doesn't enable them.
Python scripts that run with the default version of Python 3 by executing
with /usr/bin/python3 that try to import gnucash can't find it if it has
been built for a different version.
Instead of using other installed versions of Python 3 that happen to be
present, default to using the default "unversioned" version.
It doesn't look like CMake are going to fix the default behaviour, so every
project has to do this:
https://gitlab.kitware.com/cmake/cmake/-/issues/24878https://gitlab.kitware.com/cmake/cmake/-/issues/24126https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8287
This is only supported on CMake 3.20 or newer, so users of older versions
will still get the broken behaviour.
Use the newer default Python3_FIND_STRATEGY=LOCATION (CMP0094).
There is a new find module since cmake 3.12. Cmake 3.27 will start
emitting warnings if the old modules are still in use.
Current implementation supports both. As soon as we can bump our minimal
cmake version to 3.12, the old support code can be dropped as well.
- Also, remove unnecessary "static" in gnucash-style.c
The second one in guid.cpp is UB:
libgnucash/engine/guid.cpp:137:5: warning: undefined behavior, source object type 'const gnc::GUID' is not TriviallyCopyable [bugprone-undefined-memory-manipulation]
memcpy (&target, &source, sizeof (GncGUID));
^