mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
Remove numerous things deprecated during the 0.14 release cycle
Basically everything that has a direct replacement or no uses left. Notable omissions: - std.ArrayHashMap: Too much fallout, needs a separate cleanup. - std.debug.runtime_safety: Too much fallout. - std.heap.GeneralPurposeAllocator: Lots of references to it remain, not a simple find and replace as "debug allocator" is not equivalent to "general purpose allocator". - std.io.Reader: Is being reworked at the moment. - std.unicode.utf8Decode(): No replacement, needs a new API first. - Manifest backwards compat options: Removal would break test data used by TestFetchBuilder. - panic handler needs to be a namespace: Many tests still rely on it being a function, needs a separate cleanup.
This commit is contained in:
committed by
Andrew Kelley
parent
d83b95cbf4
commit
eb37552536
+7
-314
@@ -692,6 +692,7 @@ pub fn addOptions(b: *Build) *Step.Options {
|
||||
|
||||
pub const ExecutableOptions = struct {
|
||||
name: []const u8,
|
||||
root_module: *Module,
|
||||
version: ?std.SemanticVersion = null,
|
||||
linkage: ?std.builtin.LinkMode = null,
|
||||
max_rss: usize = 0,
|
||||
@@ -704,58 +705,12 @@ pub const ExecutableOptions = struct {
|
||||
/// Can be set regardless of target. The `.manifest` file will be ignored
|
||||
/// if the target object format does not support embedded manifests.
|
||||
win32_manifest: ?LazyPath = null,
|
||||
|
||||
/// Prefer populating this field (using e.g. `createModule`) instead of populating
|
||||
/// the following fields (`root_source_file` etc). In a future release, those fields
|
||||
/// will be removed, and this field will become non-optional.
|
||||
root_module: ?*Module = null,
|
||||
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
root_source_file: ?LazyPath = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
target: ?ResolvedTarget = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
optimize: std.builtin.OptimizeMode = .Debug,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
code_model: std.builtin.CodeModel = .default,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
link_libc: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
single_threaded: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
pic: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
strip: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
unwind_tables: ?std.builtin.UnwindTables = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
omit_frame_pointer: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
sanitize_thread: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
error_tracing: ?bool = null,
|
||||
};
|
||||
|
||||
pub fn addExecutable(b: *Build, options: ExecutableOptions) *Step.Compile {
|
||||
if (options.root_module != null and options.target != null) {
|
||||
@panic("`root_module` and `target` cannot both be populated");
|
||||
}
|
||||
return .create(b, .{
|
||||
.name = options.name,
|
||||
.root_module = options.root_module orelse b.createModule(.{
|
||||
.root_source_file = options.root_source_file,
|
||||
.target = options.target orelse @panic("`root_module` and `target` cannot both be null"),
|
||||
.optimize = options.optimize,
|
||||
.link_libc = options.link_libc,
|
||||
.single_threaded = options.single_threaded,
|
||||
.pic = options.pic,
|
||||
.strip = options.strip,
|
||||
.unwind_tables = options.unwind_tables,
|
||||
.omit_frame_pointer = options.omit_frame_pointer,
|
||||
.sanitize_thread = options.sanitize_thread,
|
||||
.error_tracing = options.error_tracing,
|
||||
.code_model = options.code_model,
|
||||
}),
|
||||
.root_module = options.root_module,
|
||||
.version = options.version,
|
||||
.kind = .exe,
|
||||
.linkage = options.linkage,
|
||||
@@ -769,62 +724,17 @@ pub fn addExecutable(b: *Build, options: ExecutableOptions) *Step.Compile {
|
||||
|
||||
pub const ObjectOptions = struct {
|
||||
name: []const u8,
|
||||
root_module: *Module,
|
||||
max_rss: usize = 0,
|
||||
use_llvm: ?bool = null,
|
||||
use_lld: ?bool = null,
|
||||
zig_lib_dir: ?LazyPath = null,
|
||||
|
||||
/// Prefer populating this field (using e.g. `createModule`) instead of populating
|
||||
/// the following fields (`root_source_file` etc). In a future release, those fields
|
||||
/// will be removed, and this field will become non-optional.
|
||||
root_module: ?*Module = null,
|
||||
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
root_source_file: ?LazyPath = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
target: ?ResolvedTarget = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
optimize: std.builtin.OptimizeMode = .Debug,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
code_model: std.builtin.CodeModel = .default,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
link_libc: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
single_threaded: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
pic: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
strip: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
unwind_tables: ?std.builtin.UnwindTables = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
omit_frame_pointer: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
sanitize_thread: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
error_tracing: ?bool = null,
|
||||
};
|
||||
|
||||
pub fn addObject(b: *Build, options: ObjectOptions) *Step.Compile {
|
||||
if (options.root_module != null and options.target != null) {
|
||||
@panic("`root_module` and `target` cannot both be populated");
|
||||
}
|
||||
return .create(b, .{
|
||||
.name = options.name,
|
||||
.root_module = options.root_module orelse b.createModule(.{
|
||||
.root_source_file = options.root_source_file,
|
||||
.target = options.target orelse @panic("`root_module` and `target` cannot both be null"),
|
||||
.optimize = options.optimize,
|
||||
.link_libc = options.link_libc,
|
||||
.single_threaded = options.single_threaded,
|
||||
.pic = options.pic,
|
||||
.strip = options.strip,
|
||||
.unwind_tables = options.unwind_tables,
|
||||
.omit_frame_pointer = options.omit_frame_pointer,
|
||||
.sanitize_thread = options.sanitize_thread,
|
||||
.error_tracing = options.error_tracing,
|
||||
.code_model = options.code_model,
|
||||
}),
|
||||
.root_module = options.root_module,
|
||||
.kind = .obj,
|
||||
.max_rss = options.max_rss,
|
||||
.use_llvm = options.use_llvm,
|
||||
@@ -833,153 +743,6 @@ pub fn addObject(b: *Build, options: ObjectOptions) *Step.Compile {
|
||||
});
|
||||
}
|
||||
|
||||
pub const SharedLibraryOptions = struct {
|
||||
name: []const u8,
|
||||
version: ?std.SemanticVersion = null,
|
||||
max_rss: usize = 0,
|
||||
use_llvm: ?bool = null,
|
||||
use_lld: ?bool = null,
|
||||
zig_lib_dir: ?LazyPath = null,
|
||||
/// Embed a `.manifest` file in the compilation if the object format supports it.
|
||||
/// https://learn.microsoft.com/en-us/windows/win32/sbscs/manifest-files-reference
|
||||
/// Manifest files must have the extension `.manifest`.
|
||||
/// Can be set regardless of target. The `.manifest` file will be ignored
|
||||
/// if the target object format does not support embedded manifests.
|
||||
win32_manifest: ?LazyPath = null,
|
||||
|
||||
/// Prefer populating this field (using e.g. `createModule`) instead of populating
|
||||
/// the following fields (`root_source_file` etc). In a future release, those fields
|
||||
/// will be removed, and this field will become non-optional.
|
||||
root_module: ?*Module = null,
|
||||
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
root_source_file: ?LazyPath = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
target: ?ResolvedTarget = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
optimize: std.builtin.OptimizeMode = .Debug,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
code_model: std.builtin.CodeModel = .default,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
link_libc: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
single_threaded: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
pic: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
strip: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
unwind_tables: ?std.builtin.UnwindTables = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
omit_frame_pointer: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
sanitize_thread: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
error_tracing: ?bool = null,
|
||||
};
|
||||
|
||||
/// Deprecated: use `b.addLibrary(.{ ..., .linkage = .dynamic })` instead.
|
||||
pub fn addSharedLibrary(b: *Build, options: SharedLibraryOptions) *Step.Compile {
|
||||
if (options.root_module != null and options.target != null) {
|
||||
@panic("`root_module` and `target` cannot both be populated");
|
||||
}
|
||||
return .create(b, .{
|
||||
.name = options.name,
|
||||
.root_module = options.root_module orelse b.createModule(.{
|
||||
.target = options.target orelse @panic("`root_module` and `target` cannot both be null"),
|
||||
.optimize = options.optimize,
|
||||
.root_source_file = options.root_source_file,
|
||||
.link_libc = options.link_libc,
|
||||
.single_threaded = options.single_threaded,
|
||||
.pic = options.pic,
|
||||
.strip = options.strip,
|
||||
.unwind_tables = options.unwind_tables,
|
||||
.omit_frame_pointer = options.omit_frame_pointer,
|
||||
.sanitize_thread = options.sanitize_thread,
|
||||
.error_tracing = options.error_tracing,
|
||||
.code_model = options.code_model,
|
||||
}),
|
||||
.kind = .lib,
|
||||
.linkage = .dynamic,
|
||||
.version = options.version,
|
||||
.max_rss = options.max_rss,
|
||||
.use_llvm = options.use_llvm,
|
||||
.use_lld = options.use_lld,
|
||||
.zig_lib_dir = options.zig_lib_dir,
|
||||
.win32_manifest = options.win32_manifest,
|
||||
});
|
||||
}
|
||||
|
||||
pub const StaticLibraryOptions = struct {
|
||||
name: []const u8,
|
||||
version: ?std.SemanticVersion = null,
|
||||
max_rss: usize = 0,
|
||||
use_llvm: ?bool = null,
|
||||
use_lld: ?bool = null,
|
||||
zig_lib_dir: ?LazyPath = null,
|
||||
|
||||
/// Prefer populating this field (using e.g. `createModule`) instead of populating
|
||||
/// the following fields (`root_source_file` etc). In a future release, those fields
|
||||
/// will be removed, and this field will become non-optional.
|
||||
root_module: ?*Module = null,
|
||||
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
root_source_file: ?LazyPath = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
target: ?ResolvedTarget = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
optimize: std.builtin.OptimizeMode = .Debug,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
code_model: std.builtin.CodeModel = .default,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
link_libc: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
single_threaded: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
pic: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
strip: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
unwind_tables: ?std.builtin.UnwindTables = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
omit_frame_pointer: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
sanitize_thread: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
error_tracing: ?bool = null,
|
||||
};
|
||||
|
||||
/// Deprecated: use `b.addLibrary(.{ ..., .linkage = .static })` instead.
|
||||
pub fn addStaticLibrary(b: *Build, options: StaticLibraryOptions) *Step.Compile {
|
||||
if (options.root_module != null and options.target != null) {
|
||||
@panic("`root_module` and `target` cannot both be populated");
|
||||
}
|
||||
return .create(b, .{
|
||||
.name = options.name,
|
||||
.root_module = options.root_module orelse b.createModule(.{
|
||||
.target = options.target orelse @panic("`root_module` and `target` cannot both be null"),
|
||||
.optimize = options.optimize,
|
||||
.root_source_file = options.root_source_file,
|
||||
.link_libc = options.link_libc,
|
||||
.single_threaded = options.single_threaded,
|
||||
.pic = options.pic,
|
||||
.strip = options.strip,
|
||||
.unwind_tables = options.unwind_tables,
|
||||
.omit_frame_pointer = options.omit_frame_pointer,
|
||||
.sanitize_thread = options.sanitize_thread,
|
||||
.error_tracing = options.error_tracing,
|
||||
.code_model = options.code_model,
|
||||
}),
|
||||
.kind = .lib,
|
||||
.linkage = .static,
|
||||
.version = options.version,
|
||||
.max_rss = options.max_rss,
|
||||
.use_llvm = options.use_llvm,
|
||||
.use_lld = options.use_lld,
|
||||
.zig_lib_dir = options.zig_lib_dir,
|
||||
});
|
||||
}
|
||||
|
||||
pub const LibraryOptions = struct {
|
||||
linkage: std.builtin.LinkMode = .static,
|
||||
name: []const u8,
|
||||
@@ -1014,9 +777,8 @@ pub fn addLibrary(b: *Build, options: LibraryOptions) *Step.Compile {
|
||||
|
||||
pub const TestOptions = struct {
|
||||
name: []const u8 = "test",
|
||||
root_module: *Module,
|
||||
max_rss: usize = 0,
|
||||
/// Deprecated; use `.filters = &.{filter}` instead of `.filter = filter`.
|
||||
filter: ?[]const u8 = null,
|
||||
filters: []const []const u8 = &.{},
|
||||
test_runner: ?Step.Compile.TestRunner = null,
|
||||
use_llvm: ?bool = null,
|
||||
@@ -1026,38 +788,6 @@ pub const TestOptions = struct {
|
||||
/// The object must be linked separately.
|
||||
/// Usually used in conjunction with a custom `test_runner`.
|
||||
emit_object: bool = false,
|
||||
|
||||
/// Prefer populating this field (using e.g. `createModule`) instead of populating
|
||||
/// the following fields (`root_source_file` etc). In a future release, those fields
|
||||
/// will be removed, and this field will become non-optional.
|
||||
root_module: ?*Module = null,
|
||||
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
root_source_file: ?LazyPath = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
target: ?ResolvedTarget = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
optimize: std.builtin.OptimizeMode = .Debug,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
version: ?std.SemanticVersion = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
link_libc: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
link_libcpp: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
single_threaded: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
pic: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
strip: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
unwind_tables: ?std.builtin.UnwindTables = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
omit_frame_pointer: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
sanitize_thread: ?bool = null,
|
||||
/// Deprecated; prefer populating `root_module`.
|
||||
error_tracing: ?bool = null,
|
||||
};
|
||||
|
||||
/// Creates an executable containing unit tests.
|
||||
@@ -1069,33 +799,12 @@ pub const TestOptions = struct {
|
||||
/// two steps are separated because they are independently configured and
|
||||
/// cached.
|
||||
pub fn addTest(b: *Build, options: TestOptions) *Step.Compile {
|
||||
if (options.root_module != null and options.root_source_file != null) {
|
||||
@panic("`root_module` and `root_source_file` cannot both be populated");
|
||||
}
|
||||
return .create(b, .{
|
||||
.name = options.name,
|
||||
.kind = if (options.emit_object) .test_obj else .@"test",
|
||||
.root_module = options.root_module orelse b.createModule(.{
|
||||
.root_source_file = options.root_source_file orelse @panic("`root_module` and `root_source_file` cannot both be null"),
|
||||
.target = options.target orelse b.graph.host,
|
||||
.optimize = options.optimize,
|
||||
.link_libc = options.link_libc,
|
||||
.link_libcpp = options.link_libcpp,
|
||||
.single_threaded = options.single_threaded,
|
||||
.pic = options.pic,
|
||||
.strip = options.strip,
|
||||
.unwind_tables = options.unwind_tables,
|
||||
.omit_frame_pointer = options.omit_frame_pointer,
|
||||
.sanitize_thread = options.sanitize_thread,
|
||||
.error_tracing = options.error_tracing,
|
||||
}),
|
||||
.root_module = options.root_module,
|
||||
.max_rss = options.max_rss,
|
||||
.filters = if (options.filter != null and options.filters.len > 0) filters: {
|
||||
const filters = b.allocator.alloc([]const u8, 1 + options.filters.len) catch @panic("OOM");
|
||||
filters[0] = b.dupe(options.filter.?);
|
||||
for (filters[1..], options.filters) |*dest, source| dest.* = b.dupe(source);
|
||||
break :filters filters;
|
||||
} else b.dupeStrings(if (options.filter) |filter| &.{filter} else options.filters),
|
||||
.filters = b.dupeStrings(options.filters),
|
||||
.test_runner = options.test_runner,
|
||||
.use_llvm = options.use_llvm,
|
||||
.use_lld = options.use_lld,
|
||||
@@ -1114,22 +823,6 @@ pub const AssemblyOptions = struct {
|
||||
zig_lib_dir: ?LazyPath = null,
|
||||
};
|
||||
|
||||
/// Deprecated; prefer using `addObject` where the `root_module` has an empty
|
||||
/// `root_source_file` and contains an assembly file via `Module.addAssemblyFile`.
|
||||
pub fn addAssembly(b: *Build, options: AssemblyOptions) *Step.Compile {
|
||||
const root_module = b.createModule(.{
|
||||
.target = options.target,
|
||||
.optimize = options.optimize,
|
||||
});
|
||||
root_module.addAssemblyFile(options.source_file);
|
||||
return b.addObject(.{
|
||||
.name = options.name,
|
||||
.max_rss = options.max_rss,
|
||||
.zig_lib_dir = options.zig_lib_dir,
|
||||
.root_module = root_module,
|
||||
});
|
||||
}
|
||||
|
||||
/// This function creates a module and adds it to the package's module set, making
|
||||
/// it available to other packages which depend on this one.
|
||||
/// `createModule` can be used instead to create a private module.
|
||||
|
||||
Reference in New Issue
Block a user