Skip to content

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

Merged
HannesWell merged 1 commit intoeclipse-platform:masterfrom
HannesWell:copilot/fix-deprecation-warnings-osatomicincrement32
Apr 13, 2026
Merged

[Cocoa] Replace deprecated OSAtomicIncrement32/OSAtomicDecrement32 in callback.c#3213
HannesWell merged 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  + 1    170 suites  +1   28m 54s ⏱️ + 1m 57s
4 692 tests +57  4 671 ✅ +55   21 💤 +3  0 ❌  - 1 
6 670 runs  +57  6 515 ✅ +55  155 💤 +3  0 ❌  - 1 

Results for commit de5f483. ± Comparison against base commit 58b6d88.

♻️ 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
@HannesWell HannesWell force-pushed the copilot/fix-deprecation-warnings-osatomicincrement32 branch from cb1b2be to de5f483 Compare April 13, 2026 16:47
@HannesWell HannesWell merged commit 1fe6169 into eclipse-platform:master Apr 13, 2026
24 checks passed
@HannesWell HannesWell deleted the copilot/fix-deprecation-warnings-osatomicincrement32 branch April 13, 2026 20:36
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