Commit Graph

5 Commits

Author SHA1 Message Date
Pekka Paalanen cd622900ee shared: add weston_assert_false()
Complement to weston_assert_true(), to avoid having to use !.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-05-06 10:39:42 +00:00
Pekka Paalanen c310516d1d shared: add weston_assert_legal_bits()
Helper to assert that a value does not have any bit set outside of the
mask. To be used with "all bits mask" of enum types that enumerate bits.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-05-06 10:39:42 +00:00
Leandro Ribeiro 80d97db856 color-lcms: changes to the parameters of translate_curve_element()
Not a behavior change, but this allow us to decide what function pointer
to use within this function (instead of forcing callers to decide that).

In the following commits this will be helpful. We'll add more curves
besides 3x1D LUT's and, depending on the curve, the function pointer
signature may differ.

Also, we now pass the xform directly to the function, and it can select
the curves depending if it is being called for a pre or a post curve.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-03-26 11:23:26 +00:00
Pekka Paalanen bdea44919b shared: add weston_assert_bit_is_set()
Will be used in the next patch.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-02-23 16:46:39 +02:00
Pekka Paalanen d2b70d2fa9 shared: add weston-assert
Add yet another flavor of assertion macros.

Unlike libc assert.h assert(), these cannot be easily disabled by the
build. They also print both the implied expression and the compared
values.

Unlike ZUC macros, there is much less framework code and it can handle
also floating-point types.

The function custom_assert_fail_ can be redefined, meaning that
different compilation units can do different things on failure.

Also the 'compositor' parameter was added to the new macros because we
plan to use these asserts in our log infrastructure, and we want to
print the "failure" messages in the right log scopes. Having the
compositor already in the macros will avoid double work.

Another future possibility is to write specific asserts for the test
suite. So we would be able to write a test suite failure function that
just print what "failed" without aborting.

There is also limited support for custom types.

These are actually pretty similar to libinput's litest macros.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-09-28 06:52:24 +00:00