delete @cImport from the language

closes #20630
This commit is contained in:
Andrew Kelley
2026-04-15 17:35:01 -07:00
parent 0dd99c37cc
commit 67a5b6e5e8
47 changed files with 67 additions and 844 deletions
+1 -14
View File
@@ -185,10 +185,6 @@ fn printOutput(
try shell_out.print("-fno-llvm", .{});
}
}
if (code.verbose_cimport) {
try build_args.append("--verbose-cimport");
try shell_out.print("--verbose-cimport ", .{});
}
for (code.additional_options) |option| {
try build_args.append(option);
try shell_out.print("{s} ", .{option});
@@ -223,11 +219,7 @@ fn printOutput(
}
const exec_result = run(arena, io, environ_map, tmp_dir_path, build_args.items) catch
fatal("example failed to compile", .{});
if (code.verbose_cimport) {
const escaped_build_stderr = try escapeHtml(arena, exec_result.stderr);
try shell_out.writeAll(escaped_build_stderr);
}
_ = exec_result;
if (code.target_str) |triple| {
if (mem.startsWith(u8, triple, "wasm32") or
@@ -853,7 +845,6 @@ const Code = struct {
link_libc: bool,
link_mode: ?std.builtin.LinkMode,
disable_cache: bool,
verbose_cimport: bool,
just_check_syntax: bool,
additional_options: []const []const u8,
use_llvm: ?bool,
@@ -915,7 +906,6 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code {
var target_str: ?[]const u8 = null;
var link_libc = false;
var disable_cache = false;
var verbose_cimport = false;
var use_llvm: ?bool = null;
while (it.next()) |prefixed_line| {
@@ -940,8 +930,6 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code {
link_libc = true;
} else if (mem.eql(u8, line, "disable_cache")) {
disable_cache = true;
} else if (mem.eql(u8, line, "verbose_cimport")) {
verbose_cimport = true;
} else {
fatal("unrecognized manifest line: {s}", .{line});
}
@@ -956,7 +944,6 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code {
.link_libc = link_libc,
.link_mode = link_mode,
.disable_cache = disable_cache,
.verbose_cimport = verbose_cimport,
.just_check_syntax = just_check_syntax,
.use_llvm = use_llvm,
};
-5
View File
@@ -249,7 +249,6 @@ const Code = struct {
link_libc: bool,
link_mode: ?std.builtin.LinkMode,
disable_cache: bool,
verbose_cimport: bool,
additional_options: []const []const u8,
const Id = union(enum) {
@@ -326,7 +325,6 @@ fn walk(arena: Allocator, io: Io, tokenizer: *Tokenizer, out_dir: Dir, w: anytyp
var link_libc = false;
var link_mode: ?std.builtin.LinkMode = null;
var disable_cache = false;
var verbose_cimport = false;
var additional_options = std.array_list.Managed([]const u8).init(arena);
const source_token = while (true) {
@@ -340,8 +338,6 @@ fn walk(arena: Allocator, io: Io, tokenizer: *Tokenizer, out_dir: Dir, w: anytyp
mode = .ReleaseSafe;
} else if (mem.eql(u8, end_tag_name, "code_disable_cache")) {
disable_cache = true;
} else if (mem.eql(u8, end_tag_name, "code_verbose_cimport")) {
verbose_cimport = true;
} else if (mem.eql(u8, end_tag_name, "code_link_object")) {
_ = try eatToken(tokenizer, .separator);
const obj_tok = try eatToken(tokenizer, .tag_content);
@@ -419,7 +415,6 @@ fn walk(arena: Allocator, io: Io, tokenizer: *Tokenizer, out_dir: Dir, w: anytyp
if (link_libc) try code.print("// link_libc\n", .{});
if (disable_cache) try code.print("// disable_cache\n", .{});
if (verbose_cimport) try code.print("// verbose_cimport\n", .{});
if (link_mode) |m|
try code.print("// link_mode={s}\n", .{@tagName(m)});