Commit Graph

206 Commits

Author SHA1 Message Date
Christopher Lam
e2f5c74bb4 [engine.i] VECTORREF_HELPER_INOUT to handle SplitsVec& 2024-10-27 22:22:51 +08:00
John Ralls
5f18971afb SRFI-64 Handle run-test returning the runner instead of pass status.
Guile 3.0.5 fixed what they thought was a bug whering run-test returned
the rv of test-runner-on-final instead of the current test runner. Ctest
considered the returned object to be a successful test and always reported
the test passing.
2024-05-28 15:07:41 -07:00
Christopher Lam
cb7196a393 [base-typemaps.i] add VECTOR_HELPER_INOUT for Split* and Account*
efficiently convert std::vector<Obj> to/from guile list of objects
2024-04-22 19:34:02 +08:00
Geert Janssens
b9eb550b9a Do a better job of including the -py3 option only for swig 4.1
The previous attempt broke builds with swig older than 4.1
2024-02-22 11:13:59 +01:00
Geert Janssens
cbf89a73be Avoid deprecation warning for -py3 in swig >= 4.1 2024-02-22 10:30:52 +01:00
Christopher Lam
2918577a3d Merge branch 'stable-leaks' into stable #1839 2024-01-06 17:25:30 +08:00
John Ralls
93323cc1dc Fix Win32 build, broken by COMMAND_EXPAND_LISTS
Create a win32 analog to make_unix_path_list that escapes the
semicolons to prevent cmake turning them into list delimiters.
2023-12-11 11:49:59 -08:00
Christopher Lam
5bf9ca0b55 QofIdType and QofIdTypeConst: handle similarly to const char*
Previous swigged function- note the `new` is never deleted. Because
they are both const char*, they must be swigged similarly to strings.

static SCM
_wrap_QOF_ID_BOOK_SCM ()
{
 #define FUNC_NAME "QOF-ID-BOOK-SCM"
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  QofIdTypeConst result;

  result = QOF_ID_BOOK_SCM();
  {
    QofIdTypeConst * resultptr;
    resultptr = new QofIdTypeConst((const QofIdTypeConst &) result);
    gswig_result =  SWIG_NewPointerObj (resultptr, SWIGTYPE_p_QofIdTypeConst, 1);
  }

  return gswig_result;
 #undef FUNC_NAME
}

After this change:

static SCM
_wrap_QOF_ID_BOOK_SCM ()
{
 #define FUNC_NAME "QOF-ID-BOOK-SCM"
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  QofIdType result;

  result = QOF_ID_BOOK_SCM();
  gswig_result = result ? scm_from_utf8_string (result) : SCM_BOOL_F;

  return gswig_result;
 #undef FUNC_NAME
}
2023-12-11 22:45:59 +08:00
John Ralls
d92d97aef6 Add Scheme coverage collection with option GUILE_COVERAGE.
This can be used with or without COVERAGE, though if without the
results will reflect only the Scheme code exercised by the tests.
2023-12-08 14:55:49 -08:00
John Ralls
6834cb5025 Implement coverage option
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.
2023-12-08 14:53:02 -08:00
John Ralls
a3f14759ab Asan: Make leak and ODR violation reporting CMake options.
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.
2023-11-25 11:17:14 -08:00
John Ralls
2234fa433e Add Asan build type that enables the Address and UB sanitizers.
Uses generator statements instead of CMAKE_<TYPE>_FLAGS_ASAN to support multiconfig generators like Xcode.
2023-11-02 12:58:46 -07:00
John Ralls
e3d682c0e5 Merge Richard Cohen's 'fix-gnc-mktime' into stable. 2023-09-10 15:08:32 -07:00
John Ralls
8a91fa8deb Remove defective and fortunately unused typemap. 2023-09-10 15:06:46 -07:00
Richard Cohen
75f49aaec5 Valgrind: fix "definitely lost" memory in (gnc-mktime) - test-invoice-report-builtin-default
==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)
...
2023-09-10 14:54:30 -07:00
Richard Cohen
9fe19d6cf9 Move potentially unused "SCM zone" variable into the #ifdef 2023-09-10 14:54:30 -07:00
Geert Janssens
29b7a9099d Fix cmake warnings while searching for python
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.
2023-08-17 18:23:33 +02:00
John Ralls
4d46a8191d Merge Simon Arlott's 'test-xml-save' into stable. 2023-08-03 11:05:11 -07:00
Richard Cohen
66c5e398ae Change g_assert() -> g_assert_true() in tests
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.
2023-07-16 10:09:12 -07:00
Simon Arlott
ab4e595670
Add failuref() test function that allows the use of format strings 2023-06-27 19:58:01 +01:00
Richard Cohen
3abc9a5558 Refactor: Remove some unnecessary uses of memcpy
- 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));
        ^
2023-06-15 11:10:58 +01:00
Richard Cohen
80e9d9c35d scanf supports %lld since C++11, C99 2023-05-15 13:21:30 +01:00
Richard Cohen
7f1ce2b5e5 Remove references to cutecash 2023-05-15 13:21:29 +01:00
Richard Cohen
3a7464a312 Remove redundant uses of cmake -E env
- In GncAddTest, set_tests_properties() is already setting the env
- In the other uses, there is no change to the environment
2023-03-07 15:44:43 +00:00
Richard Cohen
be41bde58a Add missing MAKE_LINKS, and the local scm directory to %load-path
Before this change, "make check" would fail after
  rm -rf ${build}/share/guile/site/*/gnucash/
2023-02-28 11:51:23 +00:00
Richard Cohen
7cae61d97a Make the scheme tests fail immediately if they load an external gnucash file
This would be a mistake in the build, but can happen if there
is already a gnucash installed in the standard guile load path.
2023-02-28 11:48:57 +00:00
Richard Cohen
6470319c88 Warn about deprecated gtk, glib
- G_DISABLE_DEPRECATED no longer exists (as of glib 2.61.2)
- Turn off aqbanking global deprecation

Spoilers:

- gtk
 - (3.22) gdk_screen_width
 - (3.22) gdk_screen_height

- glib
 - (2.68) g_binding_get_target -> g_binding_dup_target

- aqbanking
 - AB_Banking_LoadSharedConfig
2023-02-21 12:59:42 +00:00
Richard Cohen
bddb4468fa Import GLIB2 as a target, and use it to simplify the CMakeLists 2023-02-21 12:59:42 +00:00
Richard Cohen
e3515185d3 Make the cmake command lowercase 2023-01-31 16:25:12 +00:00
Richard Cohen
351990cf47 Remove unused GNOME cmake flags
There are no longer any Gnome dependencies
2023-01-31 16:25:03 +00:00
Richard Cohen
dbdb5cb9d1 Remove unused GNUCASH_LATEST_STABLE_SERIES 2023-01-31 16:16:48 +00:00
Richard Cohen
1cec0cb3f3 Use internal extern "C" { ... } for C++
- removes warnings compiling swig engine
...
[ 10%] Generating swig-engine.cpp
.../libgnucash/engine/engine-helpers.h:31: Warning 313: Unrecognized extern type "C++".
.../libgnucash/engine/gnc-date.h:83: Warning 313: Unrecognized extern type "C++".
.../libgnucash/engine/qofquery.h:90: Warning 302: Identifier 'QofQuery' redefined (ignored),
.../libgnucash/engine/gnc-option.hpp:55: Warning 302: previous definition of 'QofQuery'.
.../libgnucash/engine/gnc-commodity.h:56: Warning 313: Unrecognized extern type "C++".
.../libgnucash/engine/gncBusiness.h:40: Warning 313: Unrecognized extern type "C++".
.../libgnucash/engine/gncEntry.h:37: Warning 313: Unrecognized extern type "C++".
2023-01-23 18:40:01 +00:00
Geert Janssens
470afc918f Relocate resource to /org/gnucash/GnuCash prefix
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.
2023-01-01 17:23:17 +01:00
Geert Janssens
b3fa876da3 Drop ui path specifier from resources paths
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.
2023-01-01 16:34:29 +01:00
Geert Janssens
a543143689 Generate the gresource xml file based on a list of resources
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.
2023-01-01 15:06:42 +01:00
John Ralls
939a77407c Merge branch 'price-quotes-cpp' 2022-10-14 11:25:14 -07:00
Mike Alexander
3c306eae65 Merge branch 'maint' 2022-10-09 22:27:55 -04:00
Mike Alexander
2d3e80ea08 Compatibility with XCode's "new build system"
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.
2022-10-09 01:10:06 -04:00
John Ralls
4dd3922871 [price-quotes] Make wiggle test conditional on F::Q being installed. 2022-10-02 11:50:26 -07:00
John Ralls
cf2870b71a [options] Change RelativeDate and Multichoice index type to uint16_t.
From size_t because clang thinks that std::is_same_v<size_t, time64> is
true and we need to differentiate the handling of the two.
2022-08-06 16:25:42 -07:00
John Ralls
95487eb4a0 Merge branch 'maint'
# Conflicts:
#	gnucash/gnome/window-reconcile2.c
#	libgnucash/app-utils/options.scm
#	libgnucash/engine/gnc-numeric.cpp
2022-04-14 18:02:17 -07:00
luz paz
8adedc2248 Fix various typos
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`
2022-04-08 14:12:50 -04:00
Mike Alexander
3161df6fb8 Delete Register2 code, it can be retrieved from Git if needed. 2022-02-21 18:54:17 -05:00
John Ralls
c1c75e8f81 Revert "Revert "Merge Stefan Bayer's 'SepaInternalTransfer' into maint.""
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.
2022-01-08 15:10:53 -08:00
John Ralls
5c7967c4a5 Revert "Merge Stefan Bayer's 'SepaInternalTransfer' into maint."
This reverts commit 17a3f7fef2, reversing
changes made to b8458d0732.
2021-12-03 13:58:07 -08:00
Geert Janssens
e64bcfe620 Merge branch 'maint' 2021-10-01 14:51:04 +02:00
Geert Janssens
2a7566cc40 Win32 - drop conditional code never reached
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.
2021-09-26 22:58:08 +02:00
John Ralls
67191203ae Merge branch 'maint' 2021-09-26 10:46:06 -07:00
Geert Janssens
6674b1bb6b Cleanup - minimal glib=2.56.1 - drop all conditionals on older versions 2021-09-21 17:10:55 +02:00
Christopher Lam
d28ff20ff7 Merge branch 'maint' 2021-03-29 17:29:19 +08:00