Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rethink and properly handle assert() #255

Open
evelikov opened this issue Nov 20, 2024 · 0 comments
Open

Rethink and properly handle assert() #255

evelikov opened this issue Nov 20, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@evelikov
Copy link
Collaborator

As inspired by #239 (review) and related reply, we currently have a handful of asserts across the code-base - libkmod, shared, testsuite, tools.

From a library POV asserts are not wanted, since it would lead to crashes. From a test POV, the crash (or crash-like) behaviour is exactly what we want. In addition meson (since v0.50 or thereabouts) sets -DNDEBUG for --buildtype=release, thus the asserts get removed.

Seemingly we have two conflicting needs... Ideally we'll nuke all the asserts and/or replace them with something more suitable. As an alternative we could build the assert containing code twice - normal + one for our code/test coverage (always undefine NDEBUG)

Rough list of ideas/tasks:

  • list all asserts and their use-case - test, oh-shit-we-might-break-it-in-the-future, other
  • remove any genuinely unwanted asserts
  • check/augment the tests so the oh-shit-we-might-break-it-in-the-future cases are covered
  • add wrapper for each use-case and/or build assert containing code twice, other
@evelikov evelikov added the enhancement New feature or request label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant