aboutsummaryrefslogtreecommitdiff
path: root/src/Package/Module.zig
diff options
context:
space:
mode:
authorLoris Cro <kappaloris@gmail.com>2025-02-13 20:05:00 +0100
committerAndrew Kelley <andrew@ziglang.org>2025-02-26 14:41:33 -0500
commitfff8eff2bd0cc36b192d0ab43b522161227c3c2d (patch)
tree13980a602ac4a993da81002010ef6e6fa65a2eea /src/Package/Module.zig
parent8957b2707464a4dc7f0572bfc08fd104408bc8a3 (diff)
downloadzig-fff8eff2bd0cc36b192d0ab43b522161227c3c2d.tar.gz
zig-fff8eff2bd0cc36b192d0ab43b522161227c3c2d.zip
initial implementation of `@deprecated`
Diffstat (limited to 'src/Package/Module.zig')
-rw-r--r--src/Package/Module.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Package/Module.zig b/src/Package/Module.zig
index 0dec7bde76..6bd33dffa1 100644
--- a/src/Package/Module.zig
+++ b/src/Package/Module.zig
@@ -27,6 +27,7 @@ red_zone: bool,
sanitize_c: bool,
sanitize_thread: bool,
fuzz: bool,
+allow_deprecated: bool,
unwind_tables: std.builtin.UnwindTables,
cc_argv: []const []const u8,
/// (SPIR-V) whether to generate a structured control flow graph or not
@@ -95,6 +96,7 @@ pub const CreateOptions = struct {
sanitize_c: ?bool = null,
sanitize_thread: ?bool = null,
fuzz: ?bool = null,
+ allow_deprecated: ?bool = null,
structured_cfg: ?bool = null,
no_builtin: ?bool = null,
};
@@ -234,6 +236,12 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module {
break :b false;
};
+ const allow_deprecated = b: {
+ if (options.inherited.allow_deprecated) |x| break :b x;
+ if (options.parent) |p| break :b p.allow_deprecated;
+ break :b false;
+ };
+
const code_model = b: {
if (options.inherited.code_model) |x| break :b x;
if (options.parent) |p| break :b p.code_model;
@@ -380,6 +388,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module {
.sanitize_c = sanitize_c,
.sanitize_thread = sanitize_thread,
.fuzz = fuzz,
+ .allow_deprecated = allow_deprecated,
.unwind_tables = unwind_tables,
.cc_argv = options.cc_argv,
.structured_cfg = structured_cfg,
@@ -474,6 +483,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module {
.sanitize_c = sanitize_c,
.sanitize_thread = sanitize_thread,
.fuzz = fuzz,
+ .allow_deprecated = allow_deprecated,
.unwind_tables = unwind_tables,
.cc_argv = &.{},
.structured_cfg = structured_cfg,
@@ -532,6 +542,7 @@ pub fn createLimited(gpa: Allocator, options: LimitedOptions) Allocator.Error!*P
.sanitize_c = undefined,
.sanitize_thread = undefined,
.fuzz = undefined,
+ .allow_deprecated = undefined,
.unwind_tables = undefined,
.cc_argv = undefined,
.structured_cfg = undefined,