gnucash future: Set C and C++ standards to 23.

John Ralls jralls at code.gnucash.org
Tue Jun 23 17:50:50 EDT 2026


Updated	 via  https://github.com/Gnucash/gnucash/commit/2b93466c (commit)
	from  https://github.com/Gnucash/gnucash/commit/122cb6dc (commit)



commit 2b93466c213b082bb2d382ee377a936bd695122f
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Jun 22 19:37:33 2026 -0700

    Set C and C++ standards to 23.
    
    This required some adjustments:
    * New warnings character-conversion and deprecated-volatile are
    disabled for the reasons indicated in the adjacent comments.
    * C23 is a lot stricter about function pointer signatures so some
    callbacks in gnc-frequency.c and dialog-sx-editor had to be cast using
    the long-available GLib macros.
    * C++23 is stricter about a reference (foo&) parameter taking an
    lvalue only; a lambda used in several csv-importer files was trying to
    pass an rvalue so the parameter had to be changed to perfect
    forward (foo&&).
    * C++23 doesn't allow oring together enum values from different enum
    types, even anonymous ones, so the two gnc_numeric enums for rounding
    and denominators are combined into a single enum GncNumericRoundDenom.
    * C++20's new automatic generation of comparison functions combined
    with its stricter automatic conversion rules caused trouble with
    operator==() and operator!=() for gnc::GUID and GncGUID, complaining
    about ambiguity or not being able to find operator==(const GncGuid&,
    const GncGuid&). The fix has two parts: Changing operator!=(const
    gnc::GUID&, const gnc::GUID&) to operator==(const gnc::GUID&, const
    gnc::GUID&) to resolve the conversion problem and changing the call
    forwarding operator==(const GncGuid&, const GncGuid&) to only cast the
    first argument to gnc::GUID so that it could work unambiguously with
    operator==(const gnc::GUID&, const GncGuid&).
    * python sqlite3test: C23 apparently makes AppleClang a lot pickier
    about includes.



Summary of changes:
 .github/workflows/mac-tests.yaml                   |  9 ++++----
 CMakeLists.txt                                     | 18 +++++++++++----
 bindings/python/sqlite3test.c                      |  4 +++-
 gnucash/gnome-utils/gnc-frequency.c                | 24 ++++++++++----------
 gnucash/gnome/dialog-sx-editor.c                   | 26 +++++++++++-----------
 .../csv-imp/assistant-csv-trans-import.cpp         |  4 ++--
 gnucash/import-export/csv-imp/gnc-imp-props-tx.cpp |  7 ++++--
 .../import-export/csv-imp/gnc-imp-settings-csv.cpp |  1 -
 gnucash/import-export/csv-imp/gnc-import-tx.cpp    |  2 +-
 gnucash/register/ledger-core/split-register.c      |  2 +-
 libgnucash/engine/Account.cpp                      |  1 -
 libgnucash/engine/gnc-numeric.h                    |  8 ++-----
 libgnucash/engine/guid.cpp                         |  6 ++---
 libgnucash/engine/guid.hpp                         |  4 ++--
 14 files changed, 63 insertions(+), 53 deletions(-)



More information about the gnucash-patches mailing list