aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-10-23 18:43:24 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-10-23 19:09:49 -0400
commit17eb24a7e4b2bc5740dc15996acc4736833cb2a0 (patch)
tree7568873daeb3667768cee4a083a49acac2b53149 /lib/std/os
parentef62452363de75240b21299e9f80b4851433faaa (diff)
downloadzig-17eb24a7e4b2bc5740dc15996acc4736833cb2a0.tar.gz
zig-17eb24a7e4b2bc5740dc15996acc4736833cb2a0.zip
move types from builtin to std
* All the data types from `@import("builtin")` are moved to `@import("std").builtin`. The target-related types are moved to `std.Target`. This allows the data types to have methods, such as `std.Target.current.isDarwin()`. * `std.os.windows.subsystem` is moved to `std.Target.current.subsystem`. * Remove the concept of the panic package from the compiler implementation. Instead, `std.builtin.panic` is always the panic function. It checks for `@hasDecl(@import("root"), "panic")`, or else provides a default implementation. This is an important step for multibuilds (#3028). Without this change, the types inside the builtin namespace look like different types, when trying to merge builds with different target settings. With this change, Zig can figure out that, e.g., `std.builtin.Os` (the enum type) from one compilation and `std.builtin.Os` from another compilation are the same type, even if the target OS value differs.
Diffstat (limited to 'lib/std/os')
-rw-r--r--lib/std/os/windows.zig26
1 files changed, 0 insertions, 26 deletions
diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig
index 6c4aeb4cef..f9753dc2a4 100644
--- a/lib/std/os/windows.zig
+++ b/lib/std/os/windows.zig
@@ -22,32 +22,6 @@ pub usingnamespace @import("windows/bits.zig");
pub const self_process_handle = @intToPtr(HANDLE, maxInt(usize));
-/// `builtin` is missing `subsystem` when the subsystem is automatically detected,
-/// so Zig standard library has the subsystem detection logic here. This should generally be
-/// used rather than `builtin.subsystem`.
-/// On non-windows targets, this is `null`.
-pub const subsystem: ?builtin.SubSystem = blk: {
- if (@hasDecl(builtin, "subsystem")) break :blk builtin.subsystem;
- switch (builtin.os) {
- .windows => {
- if (builtin.is_test) {
- break :blk builtin.SubSystem.Console;
- }
- const root = @import("root");
- if (@hasDecl(root, "WinMain") or
- @hasDecl(root, "wWinMain") or
- @hasDecl(root, "WinMainCRTStartup") or
- @hasDecl(root, "wWinMainCRTStartup"))
- {
- break :blk builtin.SubSystem.Windows;
- } else {
- break :blk builtin.SubSystem.Console;
- }
- },
- else => break :blk null,
- }
-};
-
pub const CreateFileError = error{
SharingViolation,
PathAlreadyExists,