Fix GCC/libstdc++ compilation (unblock Linux builds) + tests & CI - #10
Open
sqr00t wants to merge 11 commits into
Open
Fix GCC/libstdc++ compilation (unblock Linux builds) + tests & CI#10sqr00t wants to merge 11 commits into
sqr00t wants to merge 11 commits into
Conversation
sqr00t
force-pushed
the
fix/gcc-cpp-compat
branch
from
July 9, 2026 11:53
7a75b6c to
a931e2f
Compare
Contributor
Author
|
✅ CI green on the fix (run):
|
This was referenced Aug 18, 2026
cppcheck reported uninitMemberVarNoCtor for ColProxy::col in both NumericMatrix and StringMatrix. Both are only ever built via aggregate initialisation, so col was in fact always set, but the diagnostic blocked the cpp job before cppcheck's remaining checks could run.
Google style with Allman braces and a 120-column limit, chosen to match the
code as written rather than rewrite it: raw Google style reported 299
violations in shim.hpp against 38 for this config.
Only src/shim.hpp and src/bindings.cpp are formatted. adult_weight.{h,cpp}
and energy_build.cpp stay byte-identical to upstream INSP-RH/bw.
… blocking The cpp job failed on every run: it ran clang-format over all of src/ with --style=Google, which the byte-identical upstream sources will never satisfy. continue-on-error kept it from blocking the merge but left a permanent red X, and the failure meant cppcheck never ran at all. Now: clang-format runs pinned at 22.1.8 via uvx over src/shim.hpp and src/bindings.cpp only, and is blocking. cppcheck still covers all of src/ but is advisory at step level until its version is pinned too. Adds a matching pre-commit hook so this is caught before push.
sqr00t
force-pushed
the
fix/gcc-cpp-compat
branch
from
August 18, 2026 17:00
c504b9d to
85a398c
Compare
This was referenced Aug 18, 2026
ci(format): make the cpp job work — pin clang-format, scope it to owned sources, unblock cppcheck
The apt install wedged for over an hour on three separate runs. It had no timeout and no continue-on-error, so a stuck mirror hung the whole cpp job and took the blocking clang-format result with it — despite cppcheck itself being advisory by design. Both cppcheck steps now carry continue-on-error and timeout-minutes: 5, and the install drops recommends. clang-format already runs first, so the check that gates the merge no longer depends on apt at all.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7
What this PR does
Fixes the C++ extension so it compiles under GCC/libstdc++ (Linux), and adds test + lint CI.
The fix (
src/shim.hpp)NumericVectorboth inheritedstd::vector<double>'s constructors (using) and redeclaredNumericVector(size_t)/NumericVector(size_t, double). A call likeNumericVector(cols, 0.0)(with anint) was then ambiguous between the inherited fill ctor and the redeclared one — GCC rejects it, Clang tolerates it, so the package built on macOS but not on Linux.Removed the two redeclared constructors and kept the inherited ones (
using std::vector<double>::vector;). Behaviour is identical —vector(n)value-initialises to0.0andvector(n, v)fills withv— verified compiling on bothclang++(libc++) andg++-16(libstdc++), with initializer-list and all existing call sites intact.Tests (
tests/)test_unit.py) — API contracts: output keys/shapes, scalar↔list equivalence, all sixenergy_buildinterpolations, input-validation errors, andresults_to_polarslong-format output.test_regression.py) — pinned model behaviour that must survive the C++ change: weight maintenance with no intake change, a golden weight-loss value for a −250 kcal/day deficit,adult_weightdeterminism, analyticenergy_buildLinear values, and Brownian seed reproducibility. Physical quantities use a loose relative tolerance to absorb cross-platform FP differences while still catching real regressions.20 tests, passing locally on macOS.
CI (
.github/workflows/ci.yml)ruff check+ruff format --check, pinned to0.14.10(matches.pre-commit-config.yaml).Follow-up
Once merged, the publish matrix (#9 / PR #8) can drop
continue-on-errorfrom its Linux legs and move them to cibuildwheel/manylinux.