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

Create switch for disabling callback logging #604

Merged
merged 1 commit into from
Mar 16, 2024

Conversation

ispeters
Copy link
Contributor

We're seeing reports of folks running into ODR issues when linking together TUs built with and without NDEBUG defined. The reason is that unifex::inplace_stop_callback_base's size and layout depend on whether NDEBUG is defined, leading to incompatible ABIs between the two build modes.

This change introduces a new preprocessor macro,
UNIFEX_LOG_DANGLING_STOP_CALLBACKS that controls whether inplace_stop_callback_base knows a stringified typename of the deriving class and whether inplace_stop_source uses that knowledge to log the names of dangling stop callbacks in its destructor. I've also updated config.hpp.in to retain existing behaviour: the default state for UNIFEX_LOG_DANGLING_STOP_CALLBACKS is on when NDEBUG is not defined and off when NDEBUG is defined. The defaults can be overridden.

There's also a drive-by fix for a TSAN error that pops up if you ever actually log dangling callbacks.

We're seeing reports of folks running into ODR issues when linking
together TUs built with and without `NDEBUG` defined. The reason is that
`unifex::inplace_stop_callback_base`'s size and layout depend on whether
`NDEBUG` is defined, leading to incompatible ABIs between the two build
modes.

This change introduces a new preprocessor macro,
`UNIFEX_LOG_DANGLING_STOP_CALLBACKS` that controls whether
`inplace_stop_callback_base` knows a stringified typename of the
deriving class and wheter `inplace_stop_source` uses that knowledge to
log the names of dangling stop callbacks in its destructor. I've also
updated `config.hpp.in` to retain existing behaviour: the default state
for `UNIFEX_LOG_DANGLING_STOP_CALLBACKS` is on when `NDEBUG` is not
defined an off when `NDEBUG` is defined. The defaults can be overridden.
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 15, 2024
@jesswong jesswong merged commit 8a8486d into main Mar 16, 2024
93 checks passed
@ispeters ispeters deleted the disable_callback_printouts_by_default branch March 18, 2024 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants