Skip to content

Fix the atomicity of cy_atomic_int #230

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

ptrrsn
Copy link

@ptrrsn ptrrsn commented Jul 20, 2025

When building sage, meson.build incorrectly sets all CYSIGNALS_* macros to 0 because of lacks of main function, which leads to a non-atomic declaration of cy_atomic_int.

Moreover, the cy_atomic_int typedefs in struct_signals.h was structured in a way that when it is compiled by a C++ compiler in an environment with a C compiler that supports _Atomic, it would never use std::atomic, which is incorrect and might cause compilation problem when the C++ compiler does not support _Atomic. This problem was hidden by the incorrect configuration of meson.build above but got surfaced after the meson.build fix.

As a context: LLewark/khoca#3

@orlitzky
Copy link

int main(void) please, for consistency across the various C standards

@ptrrsn
Copy link
Author

ptrrsn commented Jul 21, 2025

Thank you for the review. I changed int main() to int main(void) for the C atomicity checks.

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.

2 participants