mirror of
https://github.com/ziglang/zig.git
synced 2026-01-11 01:45:12 +00:00
translate-c: add missing builtins used by CRuby
This commit is contained in:
parent
ad5770eba4
commit
d62b1c932e
@ -573,6 +573,7 @@ set(ZIG_STAGE2_SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/zig.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/zig/Ast.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/zig/CrossTarget.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/zig/c_builtins.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/zig/parse.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/zig/render.zig"
|
||||
"${CMAKE_SOURCE_DIR}/lib/std/zig/string_literal.zig"
|
||||
|
||||
@ -228,6 +228,27 @@ pub inline fn __builtin_isinf_sign(x: anytype) c_int {
|
||||
return if (std.math.isPositiveInf(x)) 1 else -1;
|
||||
}
|
||||
|
||||
pub inline fn __has_builtin(func: anytype) c_int {
|
||||
_ = func;
|
||||
return @boolToInt(true);
|
||||
}
|
||||
|
||||
pub inline fn __builtin_assume(cond: bool) void {
|
||||
if (!cond) unreachable;
|
||||
}
|
||||
|
||||
pub inline fn __builtin_unreachable() noreturn {
|
||||
unreachable;
|
||||
}
|
||||
|
||||
pub inline fn __builtin_constant_p(expr: anytype) c_int {
|
||||
_ = expr;
|
||||
return @boolToInt(false);
|
||||
}
|
||||
pub fn __builtin_mul_overflow(a: anytype, b: anytype, result: *@TypeOf(a, b)) c_int {
|
||||
return @boolToInt(@mulWithOverflow(@TypeOf(a, b), a, b, result));
|
||||
}
|
||||
|
||||
// __builtin_alloca_with_align is not currently implemented.
|
||||
// It is used in a run-translated-c test and a test-translate-c test to ensure that non-implemented
|
||||
// builtins are correctly demoted. If you implement __builtin_alloca_with_align, please update the
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user