8000 Added preprocessor checks for Clang on Windows by Razakhel · Pull Request #1370 · lz4/lz4 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Added preprocessor checks for Clang on Windows #1370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2024

Conversation

Razakhel
Copy link
Contributor
@Razakhel Razakhel commented Feb 22, 2024

MSVC-specific code is used in some places (__forceinline in lz4.c and xxhash.c) and compiled only if _MSC_VER is set; however, Clang under Windows also defines this, which reports errors on this non-standard code if the -pedantic-errors compiler flag is set:

lz4/lib/xxhash.c:234:1: error: extension used [-Werror,-Wlanguage-extension-token]
FORCE_INLINE U32 XXH_readLE32_align(const void* ptr, XXH_endianess endian, XXH_alignment align)
^
lz4/lib/xxhash.c:125:31: note: expanded from macro 'FORCE_INLINE'
#  define FORCE_INLINE static __forceinline
                              ^
lz4/lib/lz4.c:461:1: error: extension used [-Werror,-Wlanguage-extension-token]
LZ4_FORCE_INLINE
^
lz4/lib/lz4.c:131:37: note: expanded from macro 'LZ4_FORCE_INLINE'
#    define LZ4_FORCE_INLINE static __forceinline
                                    ^

I've also added -pedantic-errors as a compiler flag in the CMake script's "GCC-style" flag section, which is also used for Clang; I can absolutely discard it if needed (or add it in the Makefiles too, which I totally overlooked).


Related to wolfpld/tracy#733.

- MSVC-specific code is used in some places and compiled only if _MSC_VER is set; however, Clang under Windows also defines this, which reports errors on this non-standard code if the -pedantic-errors compiler flag is set
@Cyan4973 Cyan4973 self-assigned this Feb 22, 2024
@Cyan4973 Cyan4973 merged commit 610c94f into lz4:dev Feb 25, 2024
@Razakhel Razakhel deleted the fix-clang-pedantic-windows branch February 25, 2024 09:17
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
0