Skip to content

-fallow-deprecated not respected when compiling the build.zig runner executable #23024

Closed
@castholm

Description

@castholm

Zig Version

0.14.0-dev.3430+a2ab2fc98

Steps to Reproduce and Observed Behavior

The -f[no-]allow-deprecated command line options are not respected when compiling the build runner. This problem also extends to dependencies, which should have their respective build.zig modules inherit the selected option, or default to -fallow-deprecated when unspecified.

mkdir foo
cd foo
zig init
@@ -4,6 +4,7 @@ const std = @import("std");
 // declaratively construct a build graph that will be executed by an external
 // runner.
 pub fn build(b: *std.Build) void {
+    @deprecated();
     // Standard target options allows the person running `zig build` to choose
     // what target to build for. Here we do not override the defaults, which
     // means any target is allowed, and the default is native. Other options
zig build run -fallow-deprecated
C:\Projects\foo\build.zig:7:5: error: reached deprecated code     
    @deprecated();
    ^~~~~~~~~~~~~
referenced by:
    runBuild__anon_27536: C:\Projects\zig\lib\std\Build.zig:2429:33       
    main: C:\Projects\zig\lib\compiler\build_runner.zig:345:29
    4 reference(s) hidden; use '-freference-trace=6' to see all references

Expected Behavior

No compile error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorzig build systemstd.Build, the build runner, `zig build` subcommand, package management

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions