Skip to content

[libc] Clean up obsolete definitions in musl atomic_arch.h - #28217

Merged
sbc100 merged 1 commit into
emscripten-core:mainfrom
sbc100:musl-atomic-cleanup
Nov 10, 2026
Merged

sbc100 merged 1 commit into
emscripten-core:mainfrom
sbc100:musl-atomic-cleanup

Conversation

@sbc100

@sbc100 sbc100 commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator
  • Remove a_store_l and a_cas_l, which have been unused since the musl 1.1.15 update (Update musl to 1.1.15 #4813).
  • Replace a_clz_l and a_ctz_l with a_clz_32 and a_ctz_32 to match the arch hooks expected by musl's src/internal/atomic.h since the musl 1.2.2 update (Update musl to v1.2.2 #13006). Previously, #define a_ctz_l __builtin_ctz caused atomic.h to macro-expand its a_ctz_l wrapper definition into static inline int __builtin_ctz(unsigned long x) and fall back to the software debruijn32 lookup table for a_ctz_32.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the atomic architecture definitions in system/lib/libc/musl/arch/emscripten/atomic_arch.h by renaming the a_clz_l and a_ctz_l macros to a_clz_32 and a_ctz_32 respectively. Additionally, it removes the unused a_store_l and a_cas_l inline functions and their associated macro definitions. There are no review comments, and we have no feedback to provide.

@sbc100
sbc100 force-pushed the musl-atomic-cleanup branch from 6dacd55 to 9aa5e5a Compare November 10, 2026 17:22
@sbc100

sbc100 commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator Author

I included a cleanup of atomic.h to remove all the default/fallback (so it obvious we don't use/need them)

@tlively

tlively commented Nov 10, 2026

Copy link
Copy Markdown
Member

Makes sense, LGTM.

- Remove `a_store_l` and `a_cas_l`, which have been unused since the
  musl 1.1.15 update (emscripten-core#4813).
- Replace `a_clz_l` and `a_ctz_l` with `a_clz_32` and `a_ctz_32` to
  match the arch hooks expected by musl's `src/internal/atomic.h` since
  the musl 1.2.2 update (emscripten-core#13006). Previously, `#define a_ctz_l
  __builtin_ctz` caused `atomic.h` to macro-expand its `a_ctz_l` wrapper
  definition into `static inline int __builtin_ctz(unsigned long x)` and
  fall back to the software `debruijn32` lookup table for `a_ctz_32`.
@sbc100
sbc100 force-pushed the musl-atomic-cleanup branch from 9aa5e5a to a07462c Compare November 10, 2026 17:31
@sbc100
sbc100 merged commit 7c43e6a into emscripten-core:main Nov 10, 2026
15 of 25 checks passed
@sbc100
sbc100 deleted the musl-atomic-cleanup branch November 10, 2026 17:33
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