authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-02-27 14:41:44-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-02-28 14:51:55-05:00
log662b5f7c6045ba857d0d9abd72350a82f0b7ddf3
tree028405b54b4d73a6fee4b8692f2dd6e94941f67c
parentf89a1844bfc97f2023fc9961cdf12900ccb77cf8
signature Commit is signed but in an unrecognized format.

update docs to latest Target API


2 files changed, 18 insertions(+), 18 deletions(-)

doc/docgen.zig+3-3
......@@ -1146,10 +1146,10 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
11461146 return parseError(tokenizer, code.source_token, "example failed to compile", .{});
11471147
11481148 if (code.target_str) |triple| {
1149 if ((mem.startsWith(u8, triple, "wasm32") or
1149 if (mem.startsWith(u8, triple, "wasm32") or
11501150 mem.startsWith(u8, triple, "riscv64-linux") or
1151 mem.startsWith(u8, triple, "x86_64-linux")) and
1152 (std.Target.current.os.tag != .linux or std.Target.current.cpu.arch != .x86_64))
1151 (mem.startsWith(u8, triple, "x86_64-linux") and
1152 std.Target.current.os.tag != .linux or std.Target.current.cpu.arch != .x86_64))
11531153 {
11541154 // skip execution
11551155 try out.print("</code></pre>\n", .{});
doc/langref.html.in+15-15
......@@ -965,7 +965,8 @@ const nan = std.math.nan(f128);
965965 but you can switch to {#syntax#}Optimized{#endsyntax#} mode on a per-block basis:</p>
966966 {#code_begin|obj|foo#}
967967 {#code_release_fast#}
968const builtin = @import("builtin");
968const std = @import("std");
969const builtin = std.builtin;
969970const big = @as(f64, 1 << 40);
970971
971972export fn foo_strict(x: f64) f64 {
......@@ -2063,15 +2064,15 @@ test "pointer child type" {
20632064 alignment of the underlying type, it can be omitted from the type:
20642065 </p>
20652066 {#code_begin|test#}
2066const assert = @import("std").debug.assert;
2067const builtin = @import("builtin");
2067const std = @import("std");
2068const assert = std.debug.assert;
20682069
20692070test "variable alignment" {
20702071 var x: i32 = 1234;
20712072 const align_of_i32 = @alignOf(@TypeOf(x));
20722073 assert(@TypeOf(&x) == *i32);
20732074 assert(*i32 == *align(align_of_i32) i32);
2074 if (builtin.arch == builtin.Arch.x86_64) {
2075 if (std.Target.current.cpu.arch == .x86_64) {
20752076 assert((*i32).alignment == 4);
20762077 }
20772078}
......@@ -2474,7 +2475,7 @@ test "default struct initialization fields" {
24742475 </p>
24752476 {#code_begin|test#}
24762477const std = @import("std");
2477const builtin = @import("builtin");
2478const builtin = std.builtin;
24782479const assert = std.debug.assert;
24792480
24802481const Full = packed struct {
......@@ -3204,8 +3205,8 @@ test "separate scopes" {
32043205
32053206 {#header_open|switch#}
32063207 {#code_begin|test|switch#}
3207const assert = @import("std").debug.assert;
3208const builtin = @import("builtin");
3208const std = @import("std");
3209const assert = std.debug.assert;
32093210
32103211test "switch simple" {
32113212 const a: u64 = 10;
......@@ -3249,16 +3250,16 @@ test "switch simple" {
32493250}
32503251
32513252// Switch expressions can be used outside a function:
3252const os_msg = switch (builtin.os) {
3253 builtin.Os.linux => "we found a linux user",
3253const os_msg = switch (std.Target.current.os.tag) {
3254 .linux => "we found a linux user",
32543255 else => "not a linux user",
32553256};
32563257
32573258// Inside a function, switch statements implicitly are compile-time
32583259// evaluated if the target expression is compile-time known.
32593260test "switch inside function" {
3260 switch (builtin.os) {
3261 builtin.Os.fuchsia => {
3261 switch (std.Target.current.os.tag) {
3262 .fuchsia => {
32623263 // On an OS other than fuchsia, block is not even analyzed,
32633264 // so this compile error is not triggered.
32643265 // On fuchsia this compile error would be triggered.
......@@ -7364,8 +7365,6 @@ test "main" {
73647365 the {#syntax#}export{#endsyntax#} keyword used on a function:
73657366 </p>
73667367 {#code_begin|obj#}
7367const builtin = @import("builtin");
7368
73697368comptime {
73707369 @export(internalName, .{ .name = "foo", .linkage = .Strong });
73717370}
......@@ -9397,7 +9396,7 @@ const separator = if (builtin.os == builtin.Os.windows) '\\' else '/';
93979396 </p>
93989397 {#code_begin|test|detect_test#}
93999398const std = @import("std");
9400const builtin = @import("builtin");
9399const builtin = std.builtin;
94019400const assert = std.debug.assert;
94029401
94039402test "builtin.is_test" {
......@@ -9715,7 +9714,8 @@ WebAssembly.instantiate(typedArray, {
97159714 <pre><code>$ node test.js
97169715The result is 3</code></pre>
97179716 {#header_open|WASI#}
9718 <p>Zig's support for WebAssembly System Interface (WASI) is under active development. Example of using the standard library and reading command line arguments:</p>
9717 <p>Zig's support for WebAssembly System Interface (WASI) is under active development.
9718 Example of using the standard library and reading command line arguments:</p>
97199719 {#code_begin|exe|wasi#}
97209720 {#target_wasi#}
97219721const std = @import("std");