zig/test/standalone/extern/build.zig
mlugg c93e0d8618 Sema: @extern fixes
* There was an edge case where the arena could be destroyed twice on
  error: once from the arena itself and once from the decl destruction.

* The type of the created decl was incorrect (it should have been the
  pointer child type), but it's not required anyway, so it's now just
  initialized to anyopaque (which more accurately reflects what's
  actually at that memory, since e.g. [*]T may correspond to nothing).

* A runtime bitcast of the pointer was performed, meaning @extern didn't
  work at comptime. This is unnecessary: the decl_ref can just be
  initialized with the correct pointer type.
2023-03-12 18:55:23 +02:00

21 lines
526 B
Zig

const std = @import("std");
pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
const obj = b.addObject(.{
.name = "exports",
.root_source_file = .{ .path = "exports.zig" },
.target = .{},
.optimize = optimize,
});
const main = b.addTest(.{
.root_source_file = .{ .path = "main.zig" },
.optimize = optimize,
});
main.addObject(obj);
const test_step = b.step("test", "Test it");
test_step.dependOn(&main.step);
}