Skip to content
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

Fixes for building with clang-cl on Windows #104

Merged
merged 3 commits into from
Jan 21, 2025
Merged

Conversation

sgraham
Copy link
Contributor

@sgraham sgraham commented Jan 21, 2025

The first two commits are just minor incompatibilities in the compiler, but the ntzl one caused incorrect behaviour in ir_bitqueue_pop().

When compiling with clang-cl:

.../ir_emit.c(275,8): error: unused variable 'handle' [-Werror,-Wunused-variable]
  275 |         void *handle = NULL;
      |               ^~~~~~
clang-cl defines this on Windows, resulting in an error.

.../ir.h(32,10): error: '__ORDER_LITTLE_ENDIAN__' macro redefined [-Werror,-Wmacro-redefined]
   32 | # define __ORDER_LITTLE_ENDIAN__ 1
      |          ^
<built-in>(39,9): note: previous definition is here
   39 | #define __ORDER_LITTLE_ENDIAN__ 1234
When compiling on Windows with clang-cl, __has_builtin(__builtin_ctzl)
will evaluate to true, but a long on Windows is only 32 bits, resulting
in an incorrect implementation. Move the _WIN64 block ahead of the
general block so that it gets the 64 bit version.

Fixes dstogov#101.
@dstogov dstogov merged commit 04022a5 into dstogov:master Jan 21, 2025
14 checks passed
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