[Cocoa] Replace deprecated OSAtomicIncrement32/OSAtomicDecrement32 in callback.c#3213
Open
HannesWell wants to merge 1 commit intoeclipse-platform:masterfrom
Conversation
18 tasks
Contributor
Instead use the methods from stdatomic.h introduced in the C11 standard: - https://en.cppreference.com/w/c/atomic/atomic_fetch_add - https://en.cppreference.com/w/c/atomic/atomic_fetch_sub - https://en.cppreference.com/w/c/language/atomic.html - https://en.cppreference.com/w/c/atomic/memory_order Contributes to - eclipse-platform#3186 Co-authored-by: HannesWell <wellmann.hannes1@gmx.net>
1048ed6 to
cb1b2be
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instead use the methods from stdatomic.h introduced in the C11 standard:
To fix the current warning during compilation of the macOS native SWT binaries:
Contributes to
The Copilot agent initially suggested to use the 'Clang/GCC built-ins
__sync_fetch_and_addand__sync_fetch_and_sub' instead since they don't require any import and the declaration ofcallbackEntryCountas_Atomic int.But I believe it's better to stick to the recommendation from the deprecation warning. Unfortunately I didn't find any official documentation from Apple online regarding that deprecation.
Instead of
memory_order_relaxedwe could also use another memory_order if suitable. But I'm not sure what's exactly required here.