Commit 54e90ae
committed
Fix __int128_t redefinition in int128.h !CONFIG_INT128 fallback on Clang/GCC
The struct-based fallback aliases the reserved builtin name __int128_t to
`struct Int128` so fallback code can name the type. That is only valid on
compilers that do NOT provide __int128_t as a builtin; on GCC/Clang it is a
"typedef redefinition with different types ('Int128' vs '__int128')" error
whenever a build reaches this fallback. It bit real Clang builds — Apple clang
on arm64, and the Rust `unicorn-engine-sys` crate's vendored build.
PR #2251 guarded this only for clang-cl (`_MSC_VER && __clang__`). Gate instead
on `!defined(__SIZEOF_INT128__)` — the standard macro that is defined iff the
compiler provides the 128-bit builtin — which correctly skips the alias for all
GCC/Clang (including clang-cl) and keeps emitting it for MSVC, subsuming #2251.
Add tests/regress/int128_redefinition.c reproducing the exact fallback construct
(fails to compile with the old guard on any __int128-capable compiler, compiles
with the fix), and a CI workflow compiling it on macos-14 (Apple Silicon, arm64
clang), macos-13 (Intel) and Linux. Existing CI never covers this: the C build
on macos-14 uses cmake with CONFIG_INT128 defined (native path, fallback not
compiled), and the Rust-crate CI does not run on Apple Silicon.1 parent 7c5db94 commit 54e90ae
3 files changed
Lines changed: 96 additions & 1 deletion
File tree
- .github/workflows
- qemu/include/qemu
- tests/regress
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
150 | 161 | | |
151 | 162 | | |
152 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
0 commit comments