Skip to content

assert: compare std::function objects with nullptr explicitly - #21

Merged
igagis-bot merged 1 commit into
cppfw:mainfrom
igagis-bot:fix/assert-explicit-std-function
Nov 23, 2026
Merged

igagis-bot merged 1 commit into
cppfw:mainfrom
igagis-bot:fix/assert-explicit-std-function

Conversation

@igagis-bot

Copy link
Copy Markdown
Contributor

Depends on cppfw/utki#34 (assert: replace std::function-based overloads with a constrained template).

utki::assert() no longer provides std::function-based overloads; call
sites asserting a std::function object for non-emptiness now compare
with nullptr explicitly. Behavior is unchanged: an empty handler is
still an assert failure, a loaded handler passes. Full monorepo build
and test run are green with this change combined with utki#34.

utki::assert() no longer provides std::function-based overloads;
call sites asserting a std::function object for non-emptiness must
compare with nullptr explicitly.
igagis-bot pushed a commit to igagis-bot/monorepo that referenced this pull request Nov 23, 2026
… nullptr comparison

utki::assert() checker overloads replaced with a constrained template (cppfw/utki#34); the std::function-based overloads are removed, so call sites asserting a std::function object for non-emptiness compare with nullptr explicitly (cppfw/clargs#21, cppfw/tst#27, cppfw/cssom#9, cppfw/ruis#195).
@codecov

codecov Bot commented Nov 23, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

igagis-bot pushed a commit to igagis-bot/utki that referenced this pull request Nov 23, 2026
The harness builds clargs and tst against this branch's utki headers;
the std::function-based assert() overloads are removed, so the harness
copies need the matching '!= nullptr' call-site fixes
(cppfw/clargs#21, cppfw/tst#27).
igagis-bot pushed a commit to igagis-bot/utki that referenced this pull request Nov 23, 2026
The checkout action's 'remote_recursive' default (and the conan
recipe's '--remote' flag) track the tips of the submodule branches
instead of the pinned commits, so the harness clargs/tst copies did not
pick up the nullptr-comparison fixes this branch requires. Use
'submodules: true' (pinned SHAs) everywhere and drop '--remote' from
the conan recipe. The pinned SHAs are fetchable from the upstream
repos while the corresponding PRs (cppfw/clargs#21, cppfw/tst#27)
are open, as GitHub serves pull-request head commits.
@igagis-bot
igagis-bot merged commit 6bdcb94 into cppfw:main Nov 23, 2026
22 checks passed
igagis added a commit to cppfw/utki that referenced this pull request Nov 23, 2026
…late (#34)

* assert: replace std::function-based overloads with a constrained template

The 'std::function<bool()>' checker overloads are ambiguous with
'assert(bool)' in Objective-C++ where blocks are enabled: lambdas
returning bool become implicitly convertible to a block pointer, which
is in turn implicitly convertible to bool.

Replace both 'std::function<bool()>' checker overloads with a single
constrained template that accepts anything invocable as 'bool', and
remove the generic 'std::function<func_type>' non-emptiness overloads:
call sites asserting a std::function object for non-emptiness now
compare with 'nullptr' explicitly.

Blocks are neither required nor supported with assert(); this change
simply makes overloading well-defined in all translation unit flavors.

* assert: use a C++20 concept for the checker constraint when available

Per review: guard the constraint with '#if CFG_CPP >= 20' and use a
'requires' clause (project-local concept 'assert_checker') in C++20,
keeping the SFINAE form for C++17, following the pattern established
in span.hpp.

* ci: bump harness clargs/tst submodules to the nullptr-comparison fixes

The harness builds clargs and tst against this branch's utki headers;
the std::function-based assert() overloads are removed, so the harness
copies need the matching '!= nullptr' call-site fixes
(cppfw/clargs#21, cppfw/tst#27).

* ci: check out pinned submodule commits instead of remote branch tips

The checkout action's 'remote_recursive' default (and the conan
recipe's '--remote' flag) track the tips of the submodule branches
instead of the pinned commits, so the harness clargs/tst copies did not
pick up the nullptr-comparison fixes this branch requires. Use
'submodules: true' (pinned SHAs) everywhere and drop '--remote' from
the conan recipe. The pinned SHAs are fetchable from the upstream
repos while the corresponding PRs (cppfw/clargs#21, cppfw/tst#27)
are open, as GitHub serves pull-request head commits.

* tests: fix clang-format violation in debug test

---------

Co-authored-by: Ivan Gagis's Bot <igagis@gmail.com>
igagis added a commit to cppfw/monorepo that referenced this pull request Nov 23, 2026
* fix CI builds: install bison, enable vulkan WSI, bump submodules

- ci: install bison on all platforms:
    - linux: add bison to the apt build tools (pre-installed, made explicit)
    - macos/ios: brew install bison (the pre-installed bison is too old and
      does not understand the %language directive used by tml.y)
    - windows: install bison from the pre-installed MSYS2 and add its bin
      directory to the PATH (bison is not pre-installed at all)
- vcpkg: enable the xlib and wayland features of vulkan-loader on linux, so
  that the vcpkg-provided loader exports vkCreateXlibSurfaceKHR and
  vkCreateWaylandSurfaceKHR (they are needed to link the gtk-4/xorg/wayland
  applications against the loader)
- ci: add the libx11-dev, libwayland-dev and libxkbcommon-dev packages to
  the linux build deps (needed to build vulkan-loader with the WSI features)
- repos/utki: bump to fix utki::assert() ambiguity for lambdas in
  Objective-C++ (broke the ios build)
- repos/ruis-render-vulkan: bump to fix C4244 narrowing conversion
  warnings on 32-bit (Win32) targets (broke the windows win32 build)

* fix macos/ios ci: force-link brew bison (keg-only, shadowed by /usr/bin/bison 2.3)

Homebrew installs bison keg-only because macOS already ships
/usr/bin/bison (2.3 from 2006, which does not support the %language
directive used by tml.y). Installing the bottle therefore did not
put a modern bison on the PATH and the tml-bnf generation failed.
Force-link the keg so that /opt/homebrew/bin/bison shadows the
system one.

* bump tml (skip tml-bnf on ios, fix bison 3.x yynerrs_ warning), drop bison from ios ci

tml-bnf is now ios-excluded (it is a development / testing aid), so the
ios job no longer needs bison. the tml bump also fixes the
-Wunused-but-set-variable error that bison 3.x generated code hits under
warnings-as-errors on the other platforms.

* fix vcpkg manifest: keep vulkan on all platforms

the previous commit mistakenly constrained the vulkan dependency to
'osx | ios', which removed it from the windows and linux vcpkg plans
(vulkan was intentionally unconstrained: 'needed on all platforms').
windows and linux get vulkan again; the linux-only vulkan-loader entry
merges its xlib / wayland features into the same loader build (verified:
vcpkg resolves vulkan-loader[core,xlib,wayland]).

* bump utki: scalar assert conditions (windows C2665 regression)

* ci: add 60-minute job timeout

a hung runner (observed on macos-latest, where a job stayed in_progress
for more than 3 hours) otherwise blocks the pull request indefinitely.

* ci: raise macos job timeout to 90 minutes

the full build on a macos runner takes about 55 minutes (plus configure),
which is too close to the 60-minute timeout: even healthy runs got
cancelled at the timeout.

* ci(linux): cap build parallelism at 4 jobs

The build presets use 'jobs: 0', which makes CMake invoke 'gmake -j'
(unlimited parallel jobs). On the 4-vCPU/15Gi linux runners this spawns
dozens of concurrent cc1plus processes (each ~300-700MB), exhausting
RAM+swap; the OOM killer kills the runner VM mid-build ('The runner has
received a shutdown signal' + 'Killed signal terminated program cc1plus').

Pass an explicit --parallel 4 (matching the runner's vCPU count) to the
build and test steps. This takes precedence over the preset's jobs
property and keeps peak build memory well within the runner's RAM.

* ci: per review - nproc parallelism, libvulkan-dev on linux, no bison on macos/windows

- linux: --parallel $(nproc) instead of a hardcoded number (a bare
  --parallel is equivalent to the preset's jobs: 0, which makes CMake
  pass a bare -j to gmake = unlimited jobs = OOM on the runner;
  verified with CMake 4.2.3)
- linux: use the system libvulkan-dev (its loader exports the WSI
  surface entry points) instead of the vcpkg vulkan-loader[xlib,wayland]
  hack; the vcpkg vulkan dependency is now !linux so find_package(Vulkan)
  falls back to the system loader. macos / ios keep the vcpkg vulkan
  port (runtime ICD is MoltenVK on those runners).
- macos / windows: no bison installation anymore - the tml-bnf build is
  gated to linux only (see tml PR cppfw/tml#49); once that PR is merged,
  the tml submodule pointer in this PR will be updated.

* bump tml: gate tml-bnf build to linux only (cppfw/tml#49, 4bd61fd)

* bump tml: 6ce0bd5 (LINUX platform variable for the tml-bnf gate)

* bump tml: 9fc2a9c (read yynerrs_ instead of pragma)

* bump tml to cppfw/tml main: tml-bnf linux-only gate + bison 3.x fixes (cppfw/tml#49 merged)

* bump tml to cppfw/tml main (a6925df, includes #50), ruis-render-vulkan to merged #4 (e6b74bc)

* bump utki, clargs, tst, cssom, ruis: assert std::function objects via nullptr comparison

utki::assert() checker overloads replaced with a constrained template (cppfw/utki#34); the std::function-based overloads are removed, so call sites asserting a std::function object for non-emptiness compare with nullptr explicitly (cppfw/clargs#21, cppfw/tst#27, cppfw/cssom#9, cppfw/ruis#195).

* bump utki: concepts guard + harness submodule fixes

Follow-up to cppfw/utki#34 (review: C++20 concept constraint;
CI harness clargs/tst bumps).

* bump utki to cppfw/utki#34 head (fbc9d0b)

* ci: bound macosx/ios build parallelism to hw.ncpu (preset jobs:0 = unlimited -> swap thrash on 16Gi runners)

* ci: bound windows build parallelism to NUMBER_OF_PROCESSORS (same jobs:0 unbounded issue)

* bump utki/clargs/tst/cssom/ruis to merged heads (assert fix series merged: utki#34 ec1c167, clargs#21, tst#27, cssom#9, ruis#195)

---------

Co-authored-by: Ivan Gagis's Bot <igagis@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants