-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Some portability improvements and cleanups in zig.h
#22130
Conversation
Perhaps #if guards for inline assembly can be summarized to something like |
… check. The former is supported by most compilers while the latter is Clang-only.
tcc doesn't have __has_attribute and __has_builtin, so we need to manually check for tcc in these preprocessor paths.
The old spellings from C11 are deprecated in C23.
There's only one spot in the header where we want to handle GCC but not Clang, so just add an extra check there.
It seems like only Clang supports this in MinGW mode, and Clang will already take the __builtin_debugtrap() path anyway.
Just use inline assembly instead, which is what that header does. Also make sure we have a dummy implementation when inline assembly is unavailable.
We already do this for C99 only later in the file.
If present, these headers are usable even when compiling for older C language versions. Most notably, this enables zig.h atomics to work with slimcc and TinyCC in C99 mode (and earlier).
fbb97d8
to
c27488a
Compare
Will the changes carry over to |
They will on the next |
So I couldn't wait and swapped
|
Will merge this soon-ish if no one has any other review comments. |
I recommend reviewing each commit individually.
Closes #22114. There's still more work to do in
bootstrap.c
for non-GCC/Clang compilers, but I'll do that in #22054.