Skip to content

[Cocoa] Replace deprecated OSAtomicIncrement32/OSAtomicDecrement32 in callback.c#3213

Open
HannesWell wants to merge 1 commit intoeclipse-platform:masterfrom
HannesWell:copilot/fix-deprecation-warnings-osatomicincrement32
Open

[Cocoa] Replace deprecated OSAtomicIncrement32/OSAtomicDecrement32 in callback.c#3213
HannesWell wants to merge 1 commit intoeclipse-platform:masterfrom
HannesWell:copilot/fix-deprecation-warnings-osatomicincrement32

Conversation

@HannesWell
Copy link
Copy Markdown
Member

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:

callback.c:1968:2: warning: 'OSAtomicIncrement32' is deprecated: first deprecated in macOS 10.12
- Use atomic_fetch_add_explicit(memory_order_relaxed) from <stdatomic.h> instead [-Wdeprecated-declarations]

Contributes to

The Copilot agent initially suggested to use the 'Clang/GCC built-ins __sync_fetch_and_add and __sync_fetch_and_sub' instead since they don't require any import and the declaration of callbackEntryCount as _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_relaxed we could also use another memory_order if suitable. But I'm not sure what's exactly required here.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Test Results

  170 files  ±0    170 suites  ±0   25m 46s ⏱️ - 1m 26s
4 679 tests ±0  4 658 ✅ ±0   21 💤 ±0  0 ❌ ±0 
6 592 runs  ±0  6 437 ✅ ±0  155 💤 ±0  0 ❌ ±0 

Results for commit cb1b2be. ± Comparison against base commit 16e501f.

♻️ This comment has been updated with latest results.

@HannesWell HannesWell force-pushed the copilot/fix-deprecation-warnings-osatomicincrement32 branch from 1048ed6 to cb1b2be Compare April 10, 2026 19:37
@HannesWell HannesWell changed the title Replace deprecated OSAtomicIncrement32/OSAtomicDecrement32 in callback.c for macOS [Cocoa] Replace deprecated OSAtomicIncrement/Decrement32 in callback.c Apr 10, 2026
@HannesWell HannesWell changed the title [Cocoa] Replace deprecated OSAtomicIncrement/Decrement32 in callback.c [Cocoa] Replace deprecated OSAtomicIncrement32/OSAtomicDecrement32 in callback.c Apr 10, 2026
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