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.
==158291== 6 bytes in 1 blocks are definitely lost in loss record 18 of 824
==158291== at 0x4848C63: realloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==158291== by 0x4A91473: scm_realloc (in /usr/lib/x86_64-linux-gnu/libguile-3.0.so.1.5.0)
==158291== by 0x4AFF26B: scm_to_stringn (in /usr/lib/x86_64-linux-gnu/libguile-3.0.so.1.5.0)
==158291== by 0x4CB473D: _wrap_gnc_mktime(scm_unused_struct*) (swig-engine.cpp:38703)
...
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.
g_assert() can be compiled out, so should not be used for tests
g_assert_true was removed
to fis https://bugs.gnucash.org/show_bug.cgi?id=792008 because
g_assert_true was introduced in glib-2.38 and at the time GnuCash required
only glib-2.26. GnuCash has required glib >= 2.40 since 8acbc41c6 so
g_assert_true can be restored.
- 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));
^
This is done to be consistent with the GSettings
prefix (which is also a GLib subsystem).
In the process replace the magic string with
a single, globally defined macro.
They were only there due to how the source directories
are organized and not really adding useful detail.
Removing it from the resource paths gives more freeedom
wrt to the organization of source files.
This inverts the logic from
- having an xml file and extracting dependencies
from it to
- having a list of dependencies and generating
an xml file from it
In the original configuration adding or removing a
resource to/from the gresources.xml file would not
be detected by cmake as a change in dependencies.
The user would have to remember to rerun cmake manually.
By explicitly listing the dependencies, cmake will
properly recongifure and regenerate if that list is
updated. The remainder of the dependency configuration
also ensures proper rebuilds of gnucash, libaqbanking
and libofx if any of the resource files change, a new
one is added or an existing one is removed.
For reusability the code to generate the gresource related
files as been extracted into a separate function.
With XCode 14 or newer CMake tries to use the "new build system" which has a
requirement that if two targets depend on the same generated file one of them
must depend on the other. This commit adds reduntant dependencies to satisfy
this requirement.
Found via `codespell -q 3 -S *.po,./po,*.min.js,./ChangeLog*,./NEWS,./borrowed,./doc/README*,./AUTHORS,./libgnucash/tax/us/txf-de*,./data/accounts -L ans,ba,cas,dragable,gae,iff,iif,mut,nd,numer,parm,parms,startd,stoll`
The original merge was of a PR based on master into maint, bringing
along all of the development changes in master along with it. We don't
want that so the merge was reverted and the PR's two changes
cherry-picked in. That fixed maint, but then the next regular merge of
maint into master naturally included that revert commit undoing the
changes in master. Not so good. Reverting the revert, this commit,
restores the changes, albeit with messed up history.
We had hardcoded HAVE_HTMLHELPW to always be true so the fallback
code that's only reached when it is false was never reached.
Time to drop this dead code.