Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
castholm opened this issue Feb 27, 2025 · 3 comments
Closed
Labels
bug Observed behavior contradicts documented or intended behavior zig build system std.Build, the build runner, `zig build` subcommand, package management
Milestone

Comments

@castholm
Copy link
Contributor

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.

@castholm castholm added the bug Observed behavior contradicts documented or intended behavior label Feb 27, 2025
@castholm
Copy link
Contributor Author

I am looking into fixing this as part of #22587.

@alexrp alexrp added the zig build system std.Build, the build runner, `zig build` subcommand, package management label Feb 27, 2025
@alexrp alexrp added this to the 0.14.0 milestone Feb 27, 2025
@castholm
Copy link
Contributor Author

@deprecated was reverted so this bug report is no longer relevant. However, the problems described should probably be addressed when #22822 is revived.

@andrewrk
Copy link
Member

Thanks for doing the prompt investigation - it would have taken me a while to get around to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior zig build system std.Build, the build runner, `zig build` subcommand, package management
Projects
None yet
Development

No branches or pull requests

3 participants