master
 1//! This is Zig's multi-target implementation of libc.
 2//!
 3//! When `builtin.link_libc` is true, we need to export all the functions and
 4//! provide a libc API compatible with the target (e.g. musl, wasi-libc, ...).
 5
 6const builtin = @import("builtin");
 7const std = @import("std");
 8
 9// Avoid dragging in the runtime safety mechanisms into this .o file, unless
10// we're trying to test zigc.
11pub const panic = if (builtin.is_test)
12    std.debug.FullPanic(std.debug.defaultPanic)
13else
14    std.debug.no_panic;
15
16comptime {
17    _ = @import("c/inttypes.zig");
18    _ = @import("c/stdlib.zig");
19    _ = @import("c/math.zig");
20
21    if (builtin.target.isMuslLibC() or builtin.target.isWasiLibC()) {
22        // Files specific to musl and wasi-libc.
23        _ = @import("c/string.zig");
24        _ = @import("c/strings.zig");
25    }
26
27    if (builtin.target.isMuslLibC()) {
28        // Files specific to musl.
29    }
30
31    if (builtin.target.isWasiLibC()) {
32        // Files specific to wasi-libc.
33    }
34
35    if (builtin.target.isMinGW()) {
36        // Files specific to MinGW-w64.
37    }
38}