dispatch: fix compilation with XXH_INLINE_ALL #1134

Merged
Cyan4973 merged 1 commit from fix/inline-all-dispatch into dev 2026-09-16 09:26:38 -05:00
Cyan4973 commented 2026-09-16 09:07:34 -05:00 (Migrated from github.com)

XXH_INLINE_ALL redefines XXH_PUBLIC_API as static, but the dispatch entry points are necessarily provided by a separate unit (xxh_x86dispatch.c).
MSVC rejects it (C2129, issue #1071), gcc & clang warn.

Declare them with a dedicated XXH_DISPATCH_API marker instead, which keeps external linkage, whatever the including unit requests.

Added tests/inlineDispatch.c, which combines XXH_INLINE_ALL with the dispatcher, and checks that single-shot and streaming variants still generate correct hashes.
Test compiled with -Werror to convert the warning into a hard error.

fix #1071

`XXH_INLINE_ALL` redefines `XXH_PUBLIC_API` as `static`, but the dispatch entry points are necessarily provided by a separate unit (`xxh_x86dispatch.c`). MSVC rejects it (`C2129`, issue #1071), gcc & clang warn. Declare them with a dedicated `XXH_DISPATCH_API` marker instead, which keeps external linkage, whatever the including unit requests. Added `tests/inlineDispatch.c`, which combines `XXH_INLINE_ALL` with the dispatcher, and checks that single-shot and streaming variants still generate correct hashes. Test compiled with `-Werror` to convert the warning into a hard error. fix #1071
Sign in to join this conversation.
No description provided.