Skip to content

Fix x86 ClangCL and GCC/Clang -std=c## compiles - #769

Open
p0lymeric wants to merge 1 commit into
libtom:developfrom
p0lymeric:develop
Open

Fix x86 ClangCL and GCC/Clang -std=c## compiles#769
p0lymeric wants to merge 1 commit into
libtom:developfrom
p0lymeric:develop

Conversation

@p0lymeric

Copy link
Copy Markdown

Checklist

  • if this fixes something: added a Fixes: tag to the commit message

Fixes compile for some x86 compiler configurations, including ClangCL on Windows, and GCC/Clang in Standard C mode (-std=c##).

Fixes #767

Notes:

@karel-m

karel-m commented Jul 11, 2026

Copy link
Copy Markdown
Member

there already exists a similar patch e9a7e94 in #755

@p0lymeric

Copy link
Copy Markdown
Author

I agree, e9a7e94 covers the -std=c## case. Thank you, did not see that patch.

This PR also has a fix for ClangCL compilation. A previous cleanup commit (ec3804c) removed the && !defined(__clang__) factor from the #if defined(_MSC_VER) check, in the function that became s_x86_cpuid.

@karel-m

karel-m commented Jul 30, 2026

Copy link
Copy Markdown
Member

@p0lymeric FYI the __asm__ part is now fixed in develop

I am not sure about the ugly hack #if defined(_MSC_VER) && !defined(__clang__) ...

Isn't it about missing #include <intrin.h> ?

I am not using ClangCL but if it tries to pretend to be GNUC and MSVC at once then this might be a problem:

#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
#pragma GCC diagnostic ignored "-Wdeclaration-after-statement"
#pragma GCC diagnostic ignored "-Wuninitialized"
#pragma GCC diagnostic ignored "-Wunused-function"
#elif defined(_MSC_VER)
#include <intrin.h>
#endif

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.

x86 CPUID compile errors on Windows with Clang and GCC compilers

2 participants