Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 45e5187

Browse files
huglovefandlang-bot
authored andcommitted
fix Issue 23065: importC: __builtin_expect should use c_long
since it's a C function documented as taking "long"
1 parent 1abbe19 commit 45e5187

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/__builtins.di

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,13 @@ version (DigitalMars)
8383
return core.bitop.bswap(value);
8484
}
8585

86+
// Lazily imported on first use
87+
private alias c_long = imported!"core.stdc.config".c_long;
88+
8689
// Stub these out to no-ops
87-
int __builtin_constant_p(T)(T exp) { return 0; } // should be something like __traits(compiles, enum X = expr)
88-
long __builtin_expect()(long exp, long c) { return exp; }
89-
void* __builtin_assume_aligned()(const void* p, size_t align_, ...) { return cast(void*)p; }
90+
int __builtin_constant_p(T)(T exp) { return 0; } // should be something like __traits(compiles, enum X = expr)
91+
c_long __builtin_expect()(c_long exp, c_long c) { return exp; }
92+
void* __builtin_assume_aligned()(const void* p, size_t align_, ...) { return cast(void*)p; }
9093

9194
// https://releases.llvm.org/13.0.0/tools/clang/docs/LanguageExtensions.html#builtin-assume
9295
void __builtin_assume(T)(lazy T arg) { }

0 commit comments

Comments
 (0)