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

pcre2_convert: refactor asserts away #2

Merged
merged 3 commits into from
Sep 25, 2024
Merged

pcre2_convert: refactor asserts away #2

merged 3 commits into from
Sep 25, 2024

Conversation

carenas
Copy link
Owner

@carenas carenas commented Sep 25, 2024

The API requires reporting an error to the user, but when a fatal error was encountered, the offset wasn't set.

Correct that and while at it, remove the need for UNREACHABLE assertions.

The original asserts weren't very useful in debug mode as they
were lacking information on where they were being triggered and
were also unreliable and dangerous as they could result in
important code being removed and trigger crashes (even in non
debug mode).

Instead of implementing one generic assert for both modes, build
a more useful one for each one, so PCRE2_UNREACHABLE() could be
also used in non debug builds to help with optimization.

Reinstate all original assertions to use the new versions, which
will have the sideeffect of fixing indentation issues introduced
in the original, and include additional asserts that were provided
as the original ones were being checked.

While at it, update the cmake and CI to help with testing.
The API requires reporting an error to the user, but when a fatal
error was encountered, the offset wasn't set.

Correct that and while at it, remove the need for UNREACHABLE
assertions.
@carenas carenas merged commit 18e0b79 into debugass Sep 25, 2024
8 checks passed
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.

1 participant