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

Review the use of assert() in the GPAC codebase #2705

Closed
rbouqueau opened this issue Dec 20, 2023 · 1 comment
Closed

Review the use of assert() in the GPAC codebase #2705

rbouqueau opened this issue Dec 20, 2023 · 1 comment

Comments

@rbouqueau
Copy link
Member

The behaviour of assert() is inconsistent. It depends on compilers e.g. assert()s may be ignored by msvc in Release mode.

This is an issue if we plan to use assert() as a way to stop when something go wrong.

At the same time some assert()s were inserted by developers. They are deemed useful when developing or unit testing.

We need to check the assert() calls and make sure we don't use it in the first case.

jeanlf added a commit that referenced this issue Dec 21, 2023
- use gf_assert and gf_fatal_assert (will always kill the program)
- added -fatal-assert option to configure to force all asserts to be fatal
- added GPAC_ENABLE_DEBUG and GPAC_ASSERT_FATAL macros
- cleanup of several asserts in the process
@jeanlf
Copy link
Member

jeanlf commented Dec 21, 2023

a first pass was made, and we now have two macros for dev vs "something wrong" asserts.
There's also a configure option (-fatal-assert) to force all asserts to be fatal ones for the paranoiac ones out there :)

@jeanlf jeanlf closed this as completed Dec 21, 2023
rbouqueau pushed a commit that referenced this issue Feb 1, 2024
- use gf_assert and gf_fatal_assert (will always kill the program)
- added -fatal-assert option to configure to force all asserts to be fatal
- added GPAC_ENABLE_DEBUG and GPAC_ASSERT_FATAL macros
- cleanup of several asserts in the process
gorinje pushed a commit to Bevara/Access-open that referenced this issue Mar 20, 2024
- use gf_assert and gf_fatal_assert (will always kill the program)
- added -fatal-assert option to configure to force all asserts to be fatal
- added GPAC_ENABLE_DEBUG and GPAC_ASSERT_FATAL macros
- cleanup of several asserts in the process
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

No branches or pull requests

2 participants