authorgravatar for 2119212+jsoref@users.noreply.github.comJosh Soref <2119212+jsoref@users.noreply.github.com> 2021-09-24 13:39:20-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2021-09-24 13:39:20-04:00
log664941bf14cad3e62b453f83153ca4b65606707b
tree776a9f1b32a06e6cc71be4dd77f72f80be01e1b2
parentef7fa76001f873824b0f64dfc2172ed2f304c348
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Spelling corrections (#9833)

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>

38 files changed, 97 insertions(+), 97 deletions(-)

ci/azure/windows_msvc_script.bat+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1@echo on1@echo on
2SET "SRCROOT=%cd%"2SET "SRCROOT=%cd%"
3SET "PREVPATH=%PATH%"3SET "PREVPATH=%PATH%"
4SET "PREVMSYSEM=%MSYSTEM%"4SET "PREVMSYSTEM=%MSYSTEM%"
55
6set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem"6set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem"
7SET "MSYSTEM=MINGW64"7SET "MSYSTEM=MINGW64"
doc/langref.html.in+12-12
...@@ -2125,7 +2125,7 @@ fn dump(args: anytype) !void {...@@ -2125,7 +2125,7 @@ fn dump(args: anytype) !void {
21252125
2126 {#header_open|Multidimensional Arrays#}2126 {#header_open|Multidimensional Arrays#}
2127 <p>2127 <p>
2128 Mutlidimensional arrays can be created by nesting arrays:2128 Multidimensional arrays can be created by nesting arrays:
2129 </p>2129 </p>
2130 {#code_begin|test|multidimensional#}2130 {#code_begin|test|multidimensional#}
2131const std = @import("std");2131const std = @import("std");
...@@ -2898,7 +2898,7 @@ fn bar(x: *const u3) u3 {...@@ -2898,7 +2898,7 @@ fn bar(x: *const u3) u3 {
2898}2898}
2899 {#code_end#}2899 {#code_end#}
2900 <p>2900 <p>
2901 In this case, the function {#syntax#}bar{#endsyntax#} cannot be called becuse the pointer2901 In this case, the function {#syntax#}bar{#endsyntax#} cannot be called because the pointer
2902 to the non-ABI-aligned field mentions the bit offset, but the function expects an ABI-aligned pointer.2902 to the non-ABI-aligned field mentions the bit offset, but the function expects an ABI-aligned pointer.
2903 </p>2903 </p>
2904 <p>2904 <p>
...@@ -5549,7 +5549,7 @@ test "coerce to optionals" {...@@ -5549,7 +5549,7 @@ test "coerce to optionals" {
5549}5549}
5550 {#code_end#}5550 {#code_end#}
5551 <p>It works nested inside the {#link|Error Union Type#}, too:</p>5551 <p>It works nested inside the {#link|Error Union Type#}, too:</p>
5552 {#code_begin|test|test_corerce_optional_wrapped_error_union#}5552 {#code_begin|test|test_coerce_optional_wrapped_error_union#}
5553const std = @import("std");5553const std = @import("std");
5554const expect = std.testing.expect;5554const expect = std.testing.expect;
55555555
...@@ -7669,7 +7669,7 @@ test "main" {...@@ -7669,7 +7669,7 @@ test "main" {
7669}7669}
7670 {#code_end#}7670 {#code_end#}
7671 <p>7671 <p>
7672 will ouput:7672 will output:
7673 </p>7673 </p>
7674 <p>7674 <p>
7675 If all {#syntax#}@compileLog{#endsyntax#} calls are removed or7675 If all {#syntax#}@compileLog{#endsyntax#} calls are removed or
...@@ -7786,7 +7786,7 @@ test "main" {...@@ -7786,7 +7786,7 @@ test "main" {
7786 the tag value is used as the enumeration value.7786 the tag value is used as the enumeration value.
7787 </p>7787 </p>
7788 <p>7788 <p>
7789 If there is only one possible enum value, the resut is a {#syntax#}comptime_int{#endsyntax#}7789 If there is only one possible enum value, the result is a {#syntax#}comptime_int{#endsyntax#}
7790 known at {#link|comptime#}.7790 known at {#link|comptime#}.
7791 </p>7791 </p>
7792 {#see_also|@intToEnum#}7792 {#see_also|@intToEnum#}
...@@ -8736,7 +8736,7 @@ fn doTheTest() !void {...@@ -8736,7 +8736,7 @@ fn doTheTest() !void {
8736 {#header_open|@sin#}8736 {#header_open|@sin#}
8737 <pre>{#syntax#}@sin(value: anytype) @TypeOf(value){#endsyntax#}</pre>8737 <pre>{#syntax#}@sin(value: anytype) @TypeOf(value){#endsyntax#}</pre>
8738 <p>8738 <p>
8739 Sine trigometric function on a floating point number. Uses a dedicated hardware instruction8739 Sine trigonometric function on a floating point number. Uses a dedicated hardware instruction
8740 when available.8740 when available.
8741 </p>8741 </p>
8742 <p>8742 <p>
...@@ -8747,7 +8747,7 @@ fn doTheTest() !void {...@@ -8747,7 +8747,7 @@ fn doTheTest() !void {
8747 {#header_open|@cos#}8747 {#header_open|@cos#}
8748 <pre>{#syntax#}@cos(value: anytype) @TypeOf(value){#endsyntax#}</pre>8748 <pre>{#syntax#}@cos(value: anytype) @TypeOf(value){#endsyntax#}</pre>
8749 <p>8749 <p>
8750 Cosine trigometric function on a floating point number. Uses a dedicated hardware instruction8750 Cosine trigonometric function on a floating point number. Uses a dedicated hardware instruction
8751 when available.8751 when available.
8752 </p>8752 </p>
8753 <p>8753 <p>
...@@ -10325,7 +10325,7 @@ pub fn main() void {...@@ -10325,7 +10325,7 @@ pub fn main() void {
10325 <p>10325 <p>
10326 Some C constructs cannot be translated to Zig - for example, <em>goto</em>,10326 Some C constructs cannot be translated to Zig - for example, <em>goto</em>,
10327 structs with bitfields, and token-pasting macros. Zig employs <em>demotion</em> to allow translation10327 structs with bitfields, and token-pasting macros. Zig employs <em>demotion</em> to allow translation
10328 to continue in the face of non-translateable entities.10328 to continue in the face of non-translatable entities.
10329 </p>10329 </p>
10330 <p>10330 <p>
10331 Demotion comes in three varieties - {#link|opaque#}, <em>extern</em>, and10331 Demotion comes in three varieties - {#link|opaque#}, <em>extern</em>, and
...@@ -10335,13 +10335,13 @@ pub fn main() void {...@@ -10335,13 +10335,13 @@ pub fn main() void {
10335 Functions that contain opaque types or code constructs that cannot be translated will be demoted10335 Functions that contain opaque types or code constructs that cannot be translated will be demoted
10336 to {#syntax#}extern{#endsyntax#} declarations.10336 to {#syntax#}extern{#endsyntax#} declarations.
1033710337
10338 Thus, non-translateable types can still be used as pointers, and non-translateable functions10338 Thus, non-translatable types can still be used as pointers, and non-translatable functions
10339 can be called so long as the linker is aware of the compiled function.10339 can be called so long as the linker is aware of the compiled function.
10340 </p>10340 </p>
10341 <p>10341 <p>
10342 {#syntax#}@compileError{#endsyntax#} is used when top-level definitions (global variables,10342 {#syntax#}@compileError{#endsyntax#} is used when top-level definitions (global variables,
10343 function prototypes, macros) cannot be translated or demoted. Since Zig uses lazy analysis for10343 function prototypes, macros) cannot be translated or demoted. Since Zig uses lazy analysis for
10344 top-level declarations, untranslateable entities will not cause a compile error in your code unless10344 top-level declarations, untranslatable entities will not cause a compile error in your code unless
10345 you actually use them.10345 you actually use them.
10346 </p>10346 </p>
10347 {#see_also|opaque|extern|@compileError#}10347 {#see_also|opaque|extern|@compileError#}
...@@ -10353,7 +10353,7 @@ pub fn main() void {...@@ -10353,7 +10353,7 @@ pub fn main() void {
10353 can be translated to Zig. Macros that cannot be translated will be be demoted to10353 can be translated to Zig. Macros that cannot be translated will be be demoted to
10354 {#syntax#}@compileError{#endsyntax#}. Note that C code which <em>uses</em> macros will be10354 {#syntax#}@compileError{#endsyntax#}. Note that C code which <em>uses</em> macros will be
10355 translated without any additional issues (since Zig operates on the pre-processed source10355 translated without any additional issues (since Zig operates on the pre-processed source
10356 with macros expanded). It is merely the macros themselves which may not be translateable to10356 with macros expanded). It is merely the macros themselves which may not be translatable to
10357 Zig.10357 Zig.
10358 </p>10358 </p>
10359 <p>Consider the following example:</p>10359 <p>Consider the following example:</p>
...@@ -10373,7 +10373,7 @@ pub export fn foo() c_int {...@@ -10373,7 +10373,7 @@ pub export fn foo() c_int {
10373}10373}
10374pub const MAKELOCAL = @compileError("unable to translate C expr: unexpected token .Equal"); // macro.c:1:910374pub const MAKELOCAL = @compileError("unable to translate C expr: unexpected token .Equal"); // macro.c:1:9
10375 {#code_end#}10375 {#code_end#}
10376 <p>Note that {#syntax#}foo{#endsyntax#} was translated correctly despite using a non-translateable10376 <p>Note that {#syntax#}foo{#endsyntax#} was translated correctly despite using a non-translatable
10377 macro. {#syntax#}MAKELOCAL{#endsyntax#} was demoted to {#syntax#}@compileError{#endsyntax#} since10377 macro. {#syntax#}MAKELOCAL{#endsyntax#} was demoted to {#syntax#}@compileError{#endsyntax#} since
10378 it cannot be expressed as a Zig function; this simply means that you cannot directly use10378 it cannot be expressed as a Zig function; this simply means that you cannot directly use
10379 {#syntax#}MAKELOCAL{#endsyntax#} from Zig.10379 {#syntax#}MAKELOCAL{#endsyntax#} from Zig.
src/AstGen.zig+2-2
...@@ -197,7 +197,7 @@ pub const ResultLoc = union(enum) {...@@ -197,7 +197,7 @@ pub const ResultLoc = union(enum) {
197 none_or_ref,197 none_or_ref,
198 /// The expression will be coerced into this type, but it will be evaluated as an rvalue.198 /// The expression will be coerced into this type, but it will be evaluated as an rvalue.
199 ty: Zir.Inst.Ref,199 ty: Zir.Inst.Ref,
200 /// Same as `ty` but it is guaranteed that Sema will additionall perform the coercion,200 /// Same as `ty` but it is guaranteed that Sema will additionally perform the coercion,
201 /// so no `as` instruction needs to be emitted.201 /// so no `as` instruction needs to be emitted.
202 coerced_ty: Zir.Inst.Ref,202 coerced_ty: Zir.Inst.Ref,
203 /// The expression must store its result into this typed pointer. The result instruction203 /// The expression must store its result into this typed pointer. The result instruction
...@@ -479,7 +479,7 @@ fn lvalExpr(gz: *GenZir, scope: *Scope, node: Ast.Node.Index) InnerError!Zir.Ins...@@ -479,7 +479,7 @@ fn lvalExpr(gz: *GenZir, scope: *Scope, node: Ast.Node.Index) InnerError!Zir.Ins
479 return expr(gz, scope, .ref, node);479 return expr(gz, scope, .ref, node);
480}480}
481481
482/// Turn Zig AST into untyped ZIR istructions.482/// Turn Zig AST into untyped ZIR instructions.
483/// When `rl` is discard, ptr, inferred_ptr, or inferred_ptr, the483/// When `rl` is discard, ptr, inferred_ptr, or inferred_ptr, the
484/// result instruction can be used to inspect whether it is isNoReturn() but that is it,484/// result instruction can be used to inspect whether it is isNoReturn() but that is it,
485/// it must otherwise not be used.485/// it must otherwise not be used.
src/Compilation.zig+1-1
...@@ -812,7 +812,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {...@@ -812,7 +812,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
812812
813 const needs_c_symbols = !options.skip_linker_dependencies and is_exe_or_dyn_lib;813 const needs_c_symbols = !options.skip_linker_dependencies and is_exe_or_dyn_lib;
814814
815 // WASI-only. Resolve the optinal exec-model option, defaults to command.815 // WASI-only. Resolve the optional exec-model option, defaults to command.
816 const wasi_exec_model = if (options.target.os.tag != .wasi) undefined else options.wasi_exec_model orelse .command;816 const wasi_exec_model = if (options.target.os.tag != .wasi) undefined else options.wasi_exec_model orelse .command;
817817
818 const comp: *Compilation = comp: {818 const comp: *Compilation = comp: {
src/Liveness.zig+1-1
...@@ -30,7 +30,7 @@ tomb_bits: []usize,...@@ -30,7 +30,7 @@ tomb_bits: []usize,
30/// The main tomb bits are still used and the extra ones are starting with the lsb of the30/// The main tomb bits are still used and the extra ones are starting with the lsb of the
31/// value here.31/// value here.
32special: std.AutoHashMapUnmanaged(Air.Inst.Index, u32),32special: std.AutoHashMapUnmanaged(Air.Inst.Index, u32),
33/// Auxilliary data. The way this data is interpreted is determined contextually.33/// Auxiliary data. The way this data is interpreted is determined contextually.
34extra: []const u32,34extra: []const u32,
3535
36/// Trailing is the set of instructions whose lifetimes end at the start of the then branch,36/// Trailing is the set of instructions whose lifetimes end at the start of the then branch,
src/Module.zig+7-7
...@@ -2188,39 +2188,39 @@ pub const LazySrcLoc = union(enum) {...@@ -2188,39 +2188,39 @@ pub const LazySrcLoc = union(enum) {
2188 node_offset_bin_op: i32,2188 node_offset_bin_op: i32,
2189 /// The source location points to the LHS of a binary expression, found2189 /// The source location points to the LHS of a binary expression, found
2190 /// by taking this AST node index offset from the containing Decl AST node,2190 /// by taking this AST node index offset from the containing Decl AST node,
2191 /// which points to a binary expression AST node. Next, nagivate to the LHS.2191 /// which points to a binary expression AST node. Next, navigate to the LHS.
2192 /// The Decl is determined contextually.2192 /// The Decl is determined contextually.
2193 node_offset_bin_lhs: i32,2193 node_offset_bin_lhs: i32,
2194 /// The source location points to the RHS of a binary expression, found2194 /// The source location points to the RHS of a binary expression, found
2195 /// by taking this AST node index offset from the containing Decl AST node,2195 /// by taking this AST node index offset from the containing Decl AST node,
2196 /// which points to a binary expression AST node. Next, nagivate to the RHS.2196 /// which points to a binary expression AST node. Next, navigate to the RHS.
2197 /// The Decl is determined contextually.2197 /// The Decl is determined contextually.
2198 node_offset_bin_rhs: i32,2198 node_offset_bin_rhs: i32,
2199 /// The source location points to the operand of a switch expression, found2199 /// The source location points to the operand of a switch expression, found
2200 /// by taking this AST node index offset from the containing Decl AST node,2200 /// by taking this AST node index offset from the containing Decl AST node,
2201 /// which points to a switch expression AST node. Next, nagivate to the operand.2201 /// which points to a switch expression AST node. Next, navigate to the operand.
2202 /// The Decl is determined contextually.2202 /// The Decl is determined contextually.
2203 node_offset_switch_operand: i32,2203 node_offset_switch_operand: i32,
2204 /// The source location points to the else/`_` prong of a switch expression, found2204 /// The source location points to the else/`_` prong of a switch expression, found
2205 /// by taking this AST node index offset from the containing Decl AST node,2205 /// by taking this AST node index offset from the containing Decl AST node,
2206 /// which points to a switch expression AST node. Next, nagivate to the else/`_` prong.2206 /// which points to a switch expression AST node. Next, navigate to the else/`_` prong.
2207 /// The Decl is determined contextually.2207 /// The Decl is determined contextually.
2208 node_offset_switch_special_prong: i32,2208 node_offset_switch_special_prong: i32,
2209 /// The source location points to all the ranges of a switch expression, found2209 /// The source location points to all the ranges of a switch expression, found
2210 /// by taking this AST node index offset from the containing Decl AST node,2210 /// by taking this AST node index offset from the containing Decl AST node,
2211 /// which points to a switch expression AST node. Next, nagivate to any of the2211 /// which points to a switch expression AST node. Next, navigate to any of the
2212 /// range nodes. The error applies to all of them.2212 /// range nodes. The error applies to all of them.
2213 /// The Decl is determined contextually.2213 /// The Decl is determined contextually.
2214 node_offset_switch_range: i32,2214 node_offset_switch_range: i32,
2215 /// The source location points to the calling convention of a function type2215 /// The source location points to the calling convention of a function type
2216 /// expression, found by taking this AST node index offset from the containing2216 /// expression, found by taking this AST node index offset from the containing
2217 /// Decl AST node, which points to a function type AST node. Next, nagivate to2217 /// Decl AST node, which points to a function type AST node. Next, navigate to
2218 /// the calling convention node.2218 /// the calling convention node.
2219 /// The Decl is determined contextually.2219 /// The Decl is determined contextually.
2220 node_offset_fn_type_cc: i32,2220 node_offset_fn_type_cc: i32,
2221 /// The source location points to the return type of a function type2221 /// The source location points to the return type of a function type
2222 /// expression, found by taking this AST node index offset from the containing2222 /// expression, found by taking this AST node index offset from the containing
2223 /// Decl AST node, which points to a function type AST node. Next, nagivate to2223 /// Decl AST node, which points to a function type AST node. Next, navigate to
2224 /// the return type node.2224 /// the return type node.
2225 /// The Decl is determined contextually.2225 /// The Decl is determined contextually.
2226 node_offset_fn_type_ret_ty: i32,2226 node_offset_fn_type_ret_ty: i32,
src/Sema.zig+3-3
...@@ -11164,7 +11164,7 @@ fn getBuiltinType(...@@ -11164,7 +11164,7 @@ fn getBuiltinType(
11164}11164}
1116511165
11166/// There is another implementation of this in `Type.onePossibleValue`. This one11166/// There is another implementation of this in `Type.onePossibleValue`. This one
11167/// in `Sema` is for calling during semantic analysis, and peforms field resolution11167/// in `Sema` is for calling during semantic analysis, and performs field resolution
11168/// to get the answer. The one in `Type` is for calling during codegen and asserts11168/// to get the answer. The one in `Type` is for calling during codegen and asserts
11169/// that the types are already resolved.11169/// that the types are already resolved.
11170fn typeHasOnePossibleValue(11170fn typeHasOnePossibleValue(
...@@ -11541,7 +11541,7 @@ fn analyzeComptimeAlloc(...@@ -11541,7 +11541,7 @@ fn analyzeComptimeAlloc(
1154111541
11542/// The places where a user can specify an address space attribute11542/// The places where a user can specify an address space attribute
11543pub const AddressSpaceContext = enum {11543pub const AddressSpaceContext = enum {
11544 /// A function is specificed to be placed in a certain address space.11544 /// A function is specified to be placed in a certain address space.
11545 function,11545 function,
1154611546
11547 /// A (global) variable is specified to be placed in a certain address space.11547 /// A (global) variable is specified to be placed in a certain address space.
...@@ -11553,7 +11553,7 @@ pub const AddressSpaceContext = enum {...@@ -11553,7 +11553,7 @@ pub const AddressSpaceContext = enum {
11553 /// In contrast to .variable, values placed in this address space are not required to be mutable.11553 /// In contrast to .variable, values placed in this address space are not required to be mutable.
11554 constant,11554 constant,
1155511555
11556 /// A pointer is ascripted to point into a certian address space.11556 /// A pointer is ascripted to point into a certain address space.
11557 pointer,11557 pointer,
11558};11558};
1155911559
src/codegen.zig+7-7
...@@ -985,7 +985,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {...@@ -985,7 +985,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
985 // increasing the pc985 // increasing the pc
986 const d_pc_p9 = @intCast(i64, delta_pc) - quant;986 const d_pc_p9 = @intCast(i64, delta_pc) - quant;
987 if (d_pc_p9 > 0) {987 if (d_pc_p9 > 0) {
988 // minus one becaue if its the last one, we want to leave space to change the line which is one quanta988 // minus one because if its the last one, we want to leave space to change the line which is one quanta
989 try dbg_out.dbg_line.append(@intCast(u8, @divExact(d_pc_p9, quant) + 128) - quant);989 try dbg_out.dbg_line.append(@intCast(u8, @divExact(d_pc_p9, quant) + 128) - quant);
990 if (dbg_out.pcop_change_index.*) |pci|990 if (dbg_out.pcop_change_index.*) |pci|
991 dbg_out.dbg_line.items[pci] += 1;991 dbg_out.dbg_line.items[pci] += 1;
...@@ -1919,15 +1919,15 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {...@@ -1919,15 +1919,15 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
1919 },1919 },
1920 .shl => {1920 .shl => {
1921 assert(!swap_lhs_and_rhs);1921 assert(!swap_lhs_and_rhs);
1922 const shift_amout = switch (operand) {1922 const shift_amount = switch (operand) {
1923 .Register => |reg_op| Instruction.ShiftAmount.reg(@intToEnum(Register, reg_op.rm)),1923 .Register => |reg_op| Instruction.ShiftAmount.reg(@intToEnum(Register, reg_op.rm)),
1924 .Immediate => |imm_op| Instruction.ShiftAmount.imm(@intCast(u5, imm_op.imm)),1924 .Immediate => |imm_op| Instruction.ShiftAmount.imm(@intCast(u5, imm_op.imm)),
1925 };1925 };
1926 writeInt(u32, try self.code.addManyAsArray(4), Instruction.lsl(.al, dst_reg, op1, shift_amout).toU32());1926 writeInt(u32, try self.code.addManyAsArray(4), Instruction.lsl(.al, dst_reg, op1, shift_amount).toU32());
1927 },1927 },
1928 .shr => {1928 .shr => {
1929 assert(!swap_lhs_and_rhs);1929 assert(!swap_lhs_and_rhs);
1930 const shift_amout = switch (operand) {1930 const shift_amount = switch (operand) {
1931 .Register => |reg_op| Instruction.ShiftAmount.reg(@intToEnum(Register, reg_op.rm)),1931 .Register => |reg_op| Instruction.ShiftAmount.reg(@intToEnum(Register, reg_op.rm)),
1932 .Immediate => |imm_op| Instruction.ShiftAmount.imm(@intCast(u5, imm_op.imm)),1932 .Immediate => |imm_op| Instruction.ShiftAmount.imm(@intCast(u5, imm_op.imm)),
1933 };1933 };
...@@ -1936,7 +1936,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {...@@ -1936,7 +1936,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
1936 .signed => Instruction.asr,1936 .signed => Instruction.asr,
1937 .unsigned => Instruction.lsr,1937 .unsigned => Instruction.lsr,
1938 };1938 };
1939 writeInt(u32, try self.code.addManyAsArray(4), shr(.al, dst_reg, op1, shift_amout).toU32());1939 writeInt(u32, try self.code.addManyAsArray(4), shr(.al, dst_reg, op1, shift_amount).toU32());
1940 },1940 },
1941 else => unreachable, // not a binary instruction1941 else => unreachable, // not a binary instruction
1942 }1942 }
...@@ -3618,7 +3618,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {...@@ -3618,7 +3618,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
3618 try self.blocks.putNoClobber(self.gpa, inst, .{3618 try self.blocks.putNoClobber(self.gpa, inst, .{
3619 // A block is a setup to be able to jump to the end.3619 // A block is a setup to be able to jump to the end.
3620 .relocs = .{},3620 .relocs = .{},
3621 // It also acts as a receptical for break operands.3621 // It also acts as a receptacle for break operands.
3622 // Here we use `MCValue.none` to represent a null value so that the first3622 // Here we use `MCValue.none` to represent a null value so that the first
3623 // break instruction will choose a MCValue for the block result and overwrite3623 // break instruction will choose a MCValue for the block result and overwrite
3624 // this field. Following break instructions will use that MCValue to put their3624 // this field. Following break instructions will use that MCValue to put their
...@@ -3672,7 +3672,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {...@@ -3672,7 +3672,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
3672 return self.fail("TODO: enable larger branch offset", .{});3672 return self.fail("TODO: enable larger branch offset", .{});
3673 }3673 }
3674 },3674 },
3675 else => unreachable, // attempting to perfrom an ARM relocation on a non-ARM target arch3675 else => unreachable, // attempting to perform an ARM relocation on a non-ARM target arch
3676 }3676 }
3677 },3677 },
3678 }3678 }
src/codegen/arm.zig+1-1
...@@ -2,7 +2,7 @@ const std = @import("std");...@@ -2,7 +2,7 @@ const std = @import("std");
2const DW = std.dwarf;2const DW = std.dwarf;
3const testing = std.testing;3const testing = std.testing;
44
5/// The condition field specifies the flags neccessary for an5/// The condition field specifies the flags necessary for an
6/// Instruction to be executed6/// Instruction to be executed
7pub const Condition = enum(u4) {7pub const Condition = enum(u4) {
8 /// equal8 /// equal
src/codegen/llvm.zig+1-1
...@@ -1161,7 +1161,7 @@ pub const FuncGen = struct {...@@ -1161,7 +1161,7 @@ pub const FuncGen = struct {
1161 /// in other instructions. This table is cleared before every function is generated.1161 /// in other instructions. This table is cleared before every function is generated.
1162 func_inst_table: std.AutoHashMapUnmanaged(Air.Inst.Index, *const llvm.Value),1162 func_inst_table: std.AutoHashMapUnmanaged(Air.Inst.Index, *const llvm.Value),
11631163
1164 /// These fields are used to refer to the LLVM value of the function paramaters1164 /// These fields are used to refer to the LLVM value of the function parameters
1165 /// in an Arg instruction.1165 /// in an Arg instruction.
1166 args: []*const llvm.Value,1166 args: []*const llvm.Value,
1167 arg_index: usize,1167 arg_index: usize,
src/codegen/spirv.zig+2-2
...@@ -260,7 +260,7 @@ pub const DeclGen = struct {...@@ -260,7 +260,7 @@ pub const DeclGen = struct {
260 };260 };
261 }261 }
262262
263 /// Generate the code for `decl`. If a reportable error occured during code generation,263 /// Generate the code for `decl`. If a reportable error occurred during code generation,
264 /// a message is returned by this function. Callee owns the memory. If this function264 /// a message is returned by this function. Callee owns the memory. If this function
265 /// returns such a reportable error, it is valid to be called again for a different decl.265 /// returns such a reportable error, it is valid to be called again for a different decl.
266 pub fn gen(self: *DeclGen, decl: *Decl, air: Air, liveness: Liveness) !?*Module.ErrorMsg {266 pub fn gen(self: *DeclGen, decl: *Decl, air: Air, liveness: Liveness) !?*Module.ErrorMsg {
...@@ -565,7 +565,7 @@ pub const DeclGen = struct {...@@ -565,7 +565,7 @@ pub const DeclGen = struct {
565 }565 }
566 },566 },
567 // When recursively generating a type, we cannot infer the pointer's storage class. See genPointerType.567 // When recursively generating a type, we cannot infer the pointer's storage class. See genPointerType.
568 .Pointer => return self.fail("Cannot create pointer with unkown storage class", .{}),568 .Pointer => return self.fail("Cannot create pointer with unknown storage class", .{}),
569 .Vector => {569 .Vector => {
570 // Although not 100% the same, Zig vectors map quite neatly to SPIR-V vectors (including many integer and float operations570 // Although not 100% the same, Zig vectors map quite neatly to SPIR-V vectors (including many integer and float operations
571 // which work on them), so simply use those.571 // which work on them), so simply use those.
src/codegen/wasm.zig+3-3
...@@ -1005,7 +1005,7 @@ pub const Context = struct {...@@ -1005,7 +1005,7 @@ pub const Context = struct {
1005 const rhs = self.resolveInst(bin_op.rhs);1005 const rhs = self.resolveInst(bin_op.rhs);
10061006
1007 // it's possible for both lhs and/or rhs to return an offset as well,1007 // it's possible for both lhs and/or rhs to return an offset as well,
1008 // in which case we return the first offset occurance we find.1008 // in which case we return the first offset occurrence we find.
1009 const offset = blk: {1009 const offset = blk: {
1010 if (lhs == .code_offset) break :blk lhs.code_offset;1010 if (lhs == .code_offset) break :blk lhs.code_offset;
1011 if (rhs == .code_offset) break :blk rhs.code_offset;1011 if (rhs == .code_offset) break :blk rhs.code_offset;
...@@ -1031,7 +1031,7 @@ pub const Context = struct {...@@ -1031,7 +1031,7 @@ pub const Context = struct {
1031 const rhs = self.resolveInst(bin_op.rhs);1031 const rhs = self.resolveInst(bin_op.rhs);
10321032
1033 // it's possible for both lhs and/or rhs to return an offset as well,1033 // it's possible for both lhs and/or rhs to return an offset as well,
1034 // in which case we return the first offset occurance we find.1034 // in which case we return the first offset occurrence we find.
1035 const offset = blk: {1035 const offset = blk: {
1036 if (lhs == .code_offset) break :blk lhs.code_offset;1036 if (lhs == .code_offset) break :blk lhs.code_offset;
1037 if (rhs == .code_offset) break :blk rhs.code_offset;1037 if (rhs == .code_offset) break :blk rhs.code_offset;
...@@ -1395,7 +1395,7 @@ pub const Context = struct {...@@ -1395,7 +1395,7 @@ pub const Context = struct {
1395 }1395 }
13961396
1397 // We map every block to its block index.1397 // We map every block to its block index.
1398 // We then determine how far we have to jump to it by substracting it from current block depth1398 // We then determine how far we have to jump to it by subtracting it from current block depth
1399 const idx: u32 = self.block_depth - self.blocks.get(br.block_inst).?;1399 const idx: u32 = self.block_depth - self.blocks.get(br.block_inst).?;
1400 const writer = self.code.writer();1400 const writer = self.code.writer();
1401 try writer.writeByte(wasm.opcode(.br));1401 try writer.writeByte(wasm.opcode(.br));
src/link/Coff.zig+3-3
...@@ -50,7 +50,7 @@ last_text_block: ?*TextBlock = null,...@@ -50,7 +50,7 @@ last_text_block: ?*TextBlock = null,
50section_table_offset: u32 = 0,50section_table_offset: u32 = 0,
51/// Section data file pointer.51/// Section data file pointer.
52section_data_offset: u32 = 0,52section_data_offset: u32 = 0,
53/// Optiona header file pointer.53/// Optional header file pointer.
54optional_header_offset: u32 = 0,54optional_header_offset: u32 = 0,
5555
56/// Absolute virtual address of the offset table when the executable is loaded in memory.56/// Absolute virtual address of the offset table when the executable is loaded in memory.
...@@ -602,7 +602,7 @@ fn writeOffsetTableEntry(self: *Coff, index: usize) !void {...@@ -602,7 +602,7 @@ fn writeOffsetTableEntry(self: *Coff, index: usize) !void {
602 const current_virtual_size = mem.alignForwardGeneric(u32, self.offset_table_size, section_alignment);602 const current_virtual_size = mem.alignForwardGeneric(u32, self.offset_table_size, section_alignment);
603 const new_virtual_size = mem.alignForwardGeneric(u32, new_raw_size, section_alignment);603 const new_virtual_size = mem.alignForwardGeneric(u32, new_raw_size, section_alignment);
604 // If we had to move in the virtual address space, we need to fix the VAs in the offset table, as well as the virtual address of the `.text` section604 // If we had to move in the virtual address space, we need to fix the VAs in the offset table, as well as the virtual address of the `.text` section
605 // and the virutal size of the `.got` section605 // and the virtual size of the `.got` section
606606
607 if (new_virtual_size != current_virtual_size) {607 if (new_virtual_size != current_virtual_size) {
608 log.debug("growing offset table from virtual size {} to {}\n", .{ current_virtual_size, new_virtual_size });608 log.debug("growing offset table from virtual size {} to {}\n", .{ current_virtual_size, new_virtual_size });
...@@ -980,7 +980,7 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void {...@@ -980,7 +980,7 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void {
980 const full_out_path = try directory.join(arena, &[_][]const u8{self.base.options.emit.?.sub_path});980 const full_out_path = try directory.join(arena, &[_][]const u8{self.base.options.emit.?.sub_path});
981981
982 if (self.base.options.output_mode == .Obj) {982 if (self.base.options.output_mode == .Obj) {
983 // LLD's COFF driver does not support the equvialent of `-r` so we do a simple file copy983 // LLD's COFF driver does not support the equivalent of `-r` so we do a simple file copy
984 // here. TODO: think carefully about how we can avoid this redundant operation when doing984 // here. TODO: think carefully about how we can avoid this redundant operation when doing
985 // build-obj. See also the corresponding TODO in linkAsArchive.985 // build-obj. See also the corresponding TODO in linkAsArchive.
986 const the_object_path = blk: {986 const the_object_path = blk: {
src/link/MachO.zig+4-4
...@@ -213,7 +213,7 @@ decls: std.AutoArrayHashMapUnmanaged(*Module.Decl, void) = .{},...@@ -213,7 +213,7 @@ decls: std.AutoArrayHashMapUnmanaged(*Module.Decl, void) = .{},
213213
214/// Currently active Module.Decl.214/// Currently active Module.Decl.
215/// TODO this might not be necessary if we figure out how to pass Module.Decl instance215/// TODO this might not be necessary if we figure out how to pass Module.Decl instance
216/// to codegen.genSetReg() or alterntively move PIE displacement for MCValue{ .memory = x }216/// to codegen.genSetReg() or alternatively move PIE displacement for MCValue{ .memory = x }
217/// somewhere else in the codegen.217/// somewhere else in the codegen.
218active_decl: ?*Module.Decl = null,218active_decl: ?*Module.Decl = null,
219219
...@@ -512,7 +512,7 @@ pub fn flush(self: *MachO, comp: *Compilation) !void {...@@ -512,7 +512,7 @@ pub fn flush(self: *MachO, comp: *Compilation) !void {
512 const full_out_path = try directory.join(arena, &[_][]const u8{self.base.options.emit.?.sub_path});512 const full_out_path = try directory.join(arena, &[_][]const u8{self.base.options.emit.?.sub_path});
513513
514 if (self.base.options.output_mode == .Obj) {514 if (self.base.options.output_mode == .Obj) {
515 // LLD's MachO driver does not support the equvialent of `-r` so we do a simple file copy515 // LLD's MachO driver does not support the equivalent of `-r` so we do a simple file copy
516 // here. TODO: think carefully about how we can avoid this redundant operation when doing516 // here. TODO: think carefully about how we can avoid this redundant operation when doing
517 // build-obj. See also the corresponding TODO in linkAsArchive.517 // build-obj. See also the corresponding TODO in linkAsArchive.
518 const the_object_path = blk: {518 const the_object_path = blk: {
...@@ -2245,7 +2245,7 @@ pub fn createStubAtom(self: *MachO, laptr_sym_index: u32) !*Atom {...@@ -2245,7 +2245,7 @@ pub fn createStubAtom(self: *MachO, laptr_sym_index: u32) !*Atom {
2245fn createTentativeDefAtoms(self: *MachO) !void {2245fn createTentativeDefAtoms(self: *MachO) !void {
2246 if (self.tentatives.count() == 0) return;2246 if (self.tentatives.count() == 0) return;
2247 // Convert any tentative definition into a regular symbol and allocate2247 // Convert any tentative definition into a regular symbol and allocate
2248 // text blocks for each tentative defintion.2248 // text blocks for each tentative definition.
2249 while (self.tentatives.popOrNull()) |entry| {2249 while (self.tentatives.popOrNull()) |entry| {
2250 const match = MatchingSection{2250 const match = MatchingSection{
2251 .seg = self.data_segment_cmd_index.?,2251 .seg = self.data_segment_cmd_index.?,
...@@ -4609,7 +4609,7 @@ fn populateLazyBindOffsetsInStubHelper(self: *MachO, buffer: []const u8) !void {...@@ -4609,7 +4609,7 @@ fn populateLazyBindOffsetsInStubHelper(self: *MachO, buffer: []const u8) !void {
46094609
4610 // Because we insert lazy binding opcodes in reverse order (from last to the first atom),4610 // Because we insert lazy binding opcodes in reverse order (from last to the first atom),
4611 // we need reverse the order of atom traversal here as well.4611 // we need reverse the order of atom traversal here as well.
4612 // TODO figure out a less error prone mechanims for this!4612 // TODO figure out a less error prone mechanisms for this!
4613 var atom = last_atom;4613 var atom = last_atom;
4614 while (atom.prev) |prev| {4614 while (atom.prev) |prev| {
4615 atom = prev;4615 atom = prev;
src/link/MachO/Atom.zig+1-1
...@@ -41,7 +41,7 @@ code: std.ArrayListUnmanaged(u8) = .{},...@@ -41,7 +41,7 @@ code: std.ArrayListUnmanaged(u8) = .{},
41size: u64,41size: u64,
4242
43/// Alignment of this atom as a power of 2.43/// Alignment of this atom as a power of 2.
44/// For instance, aligmment of 0 should be read as 2^0 = 1 byte aligned.44/// For instance, alignment of 0 should be read as 2^0 = 1 byte aligned.
45alignment: u32,45alignment: u32,
4646
47/// List of relocations belonging to this atom.47/// List of relocations belonging to this atom.
src/link/MachO/Trie.zig+1-1
...@@ -506,7 +506,7 @@ test "write Trie to a byte stream" {...@@ -506,7 +506,7 @@ test "write Trie to a byte stream" {
506 });506 });
507507
508 try trie.finalize(gpa);508 try trie.finalize(gpa);
509 try trie.finalize(gpa); // Finalizing mulitple times is a nop subsequently unless we add new nodes.509 try trie.finalize(gpa); // Finalizing multiple times is a nop subsequently unless we add new nodes.
510510
511 const exp_buffer = [_]u8{511 const exp_buffer = [_]u8{
512 0x0, 0x1, // node root512 0x0, 0x1, // node root
src/link/Plan9/aout.zig+1-1
...@@ -16,7 +16,7 @@ pub const ExecHdr = extern struct {...@@ -16,7 +16,7 @@ pub const ExecHdr = extern struct {
16 comptime {16 comptime {
17 assert(@sizeOf(@This()) == 32);17 assert(@sizeOf(@This()) == 32);
18 }18 }
19 /// It is up to the caller to disgard the last 8 bytes if the header is not fat.19 /// It is up to the caller to discard the last 8 bytes if the header is not fat.
20 pub fn toU8s(self: *@This()) [40]u8 {20 pub fn toU8s(self: *@This()) [40]u8 {
21 var buf: [40]u8 = undefined;21 var buf: [40]u8 = undefined;
22 var i: u8 = 0;22 var i: u8 = 0;
src/link/SpirV.zig+2-2
...@@ -12,7 +12,7 @@...@@ -12,7 +12,7 @@
12//! - OpName and OpMemberName instructions.12//! - OpName and OpMemberName instructions.
13//! - OpModuleProcessed instructions.13//! - OpModuleProcessed instructions.
14//! All annotation (decoration) instructions.14//! All annotation (decoration) instructions.
15//! All type declaration instructions, constant instructions, global variable declarations, (preferrably) OpUndef instructions.15//! All type declaration instructions, constant instructions, global variable declarations, (preferably) OpUndef instructions.
16//! All function declarations without a body (extern functions presumably).16//! All function declarations without a body (extern functions presumably).
17//! All regular functions.17//! All regular functions.
1818
...@@ -93,7 +93,7 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio...@@ -93,7 +93,7 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio
93 if (options.use_llvm) return error.LLVM_BackendIsTODO_ForSpirV; // TODO: LLVM Doesn't support SpirV at all.93 if (options.use_llvm) return error.LLVM_BackendIsTODO_ForSpirV; // TODO: LLVM Doesn't support SpirV at all.
94 if (options.use_lld) return error.LLD_LinkingIsTODO_ForSpirV; // TODO: LLD Doesn't support SpirV at all.94 if (options.use_lld) return error.LLD_LinkingIsTODO_ForSpirV; // TODO: LLD Doesn't support SpirV at all.
9595
96 // TODO: read the file and keep vaild parts instead of truncating96 // TODO: read the file and keep valid parts instead of truncating
97 const file = try options.emit.?.directory.handle.createFile(sub_path, .{ .truncate = true, .read = true });97 const file = try options.emit.?.directory.handle.createFile(sub_path, .{ .truncate = true, .read = true });
98 errdefer file.close();98 errdefer file.close();
9999
src/link/Wasm.zig+3-3
...@@ -35,7 +35,7 @@ llvm_object: ?*LlvmObject = null,...@@ -35,7 +35,7 @@ llvm_object: ?*LlvmObject = null,
35/// TODO: can/should we access some data structure in Module directly?35/// TODO: can/should we access some data structure in Module directly?
36funcs: std.ArrayListUnmanaged(*Module.Decl) = .{},36funcs: std.ArrayListUnmanaged(*Module.Decl) = .{},
37/// List of all extern function Decls to be written to the `import` section of the37/// List of all extern function Decls to be written to the `import` section of the
38/// wasm binary. The positin in the list defines the function index38/// wasm binary. The position in the list defines the function index
39ext_funcs: std.ArrayListUnmanaged(*Module.Decl) = .{},39ext_funcs: std.ArrayListUnmanaged(*Module.Decl) = .{},
40/// When importing objects from the host environment, a name must be supplied.40/// When importing objects from the host environment, a name must be supplied.
41/// LLVM uses "env" by default when none is given. This would be a good default for Zig41/// LLVM uses "env" by default when none is given. This would be a good default for Zig
...@@ -714,7 +714,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void {...@@ -714,7 +714,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void {
714 const full_out_path = try directory.join(arena, &[_][]const u8{self.base.options.emit.?.sub_path});714 const full_out_path = try directory.join(arena, &[_][]const u8{self.base.options.emit.?.sub_path});
715715
716 if (self.base.options.output_mode == .Obj) {716 if (self.base.options.output_mode == .Obj) {
717 // LLD's WASM driver does not support the equvialent of `-r` so we do a simple file copy717 // LLD's WASM driver does not support the equivalent of `-r` so we do a simple file copy
718 // here. TODO: think carefully about how we can avoid this redundant operation when doing718 // here. TODO: think carefully about how we can avoid this redundant operation when doing
719 // build-obj. See also the corresponding TODO in linkAsArchive.719 // build-obj. See also the corresponding TODO in linkAsArchive.
720 const the_object_path = blk: {720 const the_object_path = blk: {
...@@ -756,7 +756,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void {...@@ -756,7 +756,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void {
756756
757 if (self.base.options.output_mode == .Exe) {757 if (self.base.options.output_mode == .Exe) {
758 // Increase the default stack size to a more reasonable value of 1MB instead of758 // Increase the default stack size to a more reasonable value of 1MB instead of
759 // the default of 1 Wasm page being 64KB, unless overriden by the user.759 // the default of 1 Wasm page being 64KB, unless overridden by the user.
760 try argv.append("-z");760 try argv.append("-z");
761 const stack_size = self.base.options.stack_size_override orelse 1048576;761 const stack_size = self.base.options.stack_size_override orelse 1048576;
762 const arg = try std.fmt.allocPrint(arena, "stack-size={d}", .{stack_size});762 const arg = try std.fmt.allocPrint(arena, "stack-size={d}", .{stack_size});
src/stage1/analyze.cpp+1-1
...@@ -6804,7 +6804,7 @@ static Error resolve_async_frame(CodeGen *g, ZigType *frame_type) {...@@ -6804,7 +6804,7 @@ static Error resolve_async_frame(CodeGen *g, ZigType *frame_type) {
6804 // Since this frame is async, an await might represent a suspend point, and6804 // Since this frame is async, an await might represent a suspend point, and
6805 // therefore need to spill. It also needs to mark expr scopes as having to spill.6805 // therefore need to spill. It also needs to mark expr scopes as having to spill.
6806 // For example: foo() + await z6806 // For example: foo() + await z
6807 // The funtion call result of foo() must be spilled.6807 // The function call result of foo() must be spilled.
6808 for (size_t i = 0; i < fn->await_list.length; i += 1) {6808 for (size_t i = 0; i < fn->await_list.length; i += 1) {
6809 Stage1AirInstAwait *await = fn->await_list.at(i);6809 Stage1AirInstAwait *await = fn->await_list.at(i);
6810 if (await->is_nosuspend) {6810 if (await->is_nosuspend) {
src/stage1/ir.cpp+3-3
...@@ -6374,7 +6374,7 @@ static Stage1AirInst *ir_analyze_enum_to_union(IrAnalyze *ira, Scope *scope, Ast...@@ -6374,7 +6374,7 @@ static Stage1AirInst *ir_analyze_enum_to_union(IrAnalyze *ira, Scope *scope, Ast
63746374
6375 if (target->value->type->data.enumeration.non_exhaustive) {6375 if (target->value->type->data.enumeration.non_exhaustive) {
6376 ir_add_error_node(ira, source_node,6376 ir_add_error_node(ira, source_node,
6377 buf_sprintf("runtime cast to union '%s' from non-exhustive enum",6377 buf_sprintf("runtime cast to union '%s' from non-exhaustive enum",
6378 buf_ptr(&wanted_type->name)));6378 buf_ptr(&wanted_type->name)));
6379 return ira->codegen->invalid_inst_gen;6379 return ira->codegen->invalid_inst_gen;
6380 }6380 }
...@@ -15189,7 +15189,7 @@ static Stage1AirInst *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_...@@ -15189,7 +15189,7 @@ static Stage1AirInst *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_
15189 return ir_analyze_inferred_field_ptr(ira, field_name, scope, source_node, container_ptr, bare_type);15189 return ir_analyze_inferred_field_ptr(ira, field_name, scope, source_node, container_ptr, bare_type);
15190 }15190 }
1519115191
15192 // Tracks wether we should return an undefined value of the correct type.15192 // Tracks whether we should return an undefined value of the correct type.
15193 // We do this if the container pointer is undefined and we are in a TypeOf call.15193 // We do this if the container pointer is undefined and we are in a TypeOf call.
15194 bool return_undef = container_ptr->value->special == ConstValSpecialUndef && \15194 bool return_undef = container_ptr->value->special == ConstValSpecialUndef && \
15195 get_scope_typeof(scope) != nullptr;15195 get_scope_typeof(scope) != nullptr;
...@@ -15248,7 +15248,7 @@ static Stage1AirInst *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_...@@ -15248,7 +15248,7 @@ static Stage1AirInst *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_
15248 if (type_is_invalid(union_val->type))15248 if (type_is_invalid(union_val->type))
15249 return ira->codegen->invalid_inst_gen;15249 return ira->codegen->invalid_inst_gen;
1525015250
15251 // Reject undefined values unless we're intializing the union:15251 // Reject undefined values unless we're initializing the union:
15252 // a undefined union means also the tag is undefined, accessing15252 // a undefined union means also the tag is undefined, accessing
15253 // its payload slot is UB.15253 // its payload slot is UB.
15254 const UndefAllowed allow_undef = initializing ? UndefOk : UndefBad;15254 const UndefAllowed allow_undef = initializing ? UndefOk : UndefBad;
src/stage1/ir_print.cpp+2-2
...@@ -558,7 +558,7 @@ const char* ir_inst_gen_type_str(Stage1AirInstId id) {...@@ -558,7 +558,7 @@ const char* ir_inst_gen_type_str(Stage1AirInstId id) {
558 case Stage1AirInstIdWasmMemoryGrow:558 case Stage1AirInstIdWasmMemoryGrow:
559 return "GenWasmMemoryGrow";559 return "GenWasmMemoryGrow";
560 case Stage1AirInstIdExtern:560 case Stage1AirInstIdExtern:
561 return "GenExtrern";561 return "GenExtern";
562 }562 }
563 zig_unreachable();563 zig_unreachable();
564}564}
...@@ -829,7 +829,7 @@ static const char *cast_op_str(CastOp op) {...@@ -829,7 +829,7 @@ static const char *cast_op_str(CastOp op) {
829 case CastOpIntToFloat: return "IntToFloat";829 case CastOpIntToFloat: return "IntToFloat";
830 case CastOpFloatToInt: return "FloatToInt";830 case CastOpFloatToInt: return "FloatToInt";
831 case CastOpBoolToInt: return "BoolToInt";831 case CastOpBoolToInt: return "BoolToInt";
832 case CastOpNumLitToConcrete: return "NumLitToConcrate";832 case CastOpNumLitToConcrete: return "NumLitToConcrete";
833 case CastOpErrSet: return "ErrSet";833 case CastOpErrSet: return "ErrSet";
834 case CastOpBitCast: return "BitCast";834 case CastOpBitCast: return "BitCast";
835 }835 }
src/stage1/parser.cpp+1-1
...@@ -2073,7 +2073,7 @@ static AstNode *ast_parse_field_init(ParseContext *pc) {...@@ -2073,7 +2073,7 @@ static AstNode *ast_parse_field_init(ParseContext *pc) {
2073 return nullptr;2073 return nullptr;
2074 }2074 }
2075 if (eat_token_if(pc, TokenIdEq) == 0) {2075 if (eat_token_if(pc, TokenIdEq) == 0) {
2076 // Because ".Name" can also be intepreted as an enum literal, we should put back2076 // Because ".Name" can also be interpreted as an enum literal, we should put back
2077 // those two tokens again so that the parser can try to parse them as the enum2077 // those two tokens again so that the parser can try to parse them as the enum
2078 // literal later.2078 // literal later.
2079 put_back_token(pc);2079 put_back_token(pc);
src/type.zig+1-1
...@@ -3419,7 +3419,7 @@ pub const Type = extern union {...@@ -3419,7 +3419,7 @@ pub const Type = extern union {
3419 anyerror_void_error_union,3419 anyerror_void_error_union,
3420 generic_poison,3420 generic_poison,
3421 /// This is a special type for variadic parameters of a function call.3421 /// This is a special type for variadic parameters of a function call.
3422 /// Casts to it will validate that the type can be passed to a c calling convetion function.3422 /// Casts to it will validate that the type can be passed to a c calling convention function.
3423 var_args_param,3423 var_args_param,
3424 /// Same as `empty_struct` except it has an empty namespace.3424 /// Same as `empty_struct` except it has an empty namespace.
3425 empty_struct_literal,3425 empty_struct_literal,
src/windows_com.hpp+1-1
...@@ -352,7 +352,7 @@ extern "C" {...@@ -352,7 +352,7 @@ extern "C" {
352 /// <summary> 352 /// <summary>
353 /// Gets product-specific properties. 353 /// Gets product-specific properties.
354 /// </summary> 354 /// </summary>
355 /// <param name="ppPropeties">A pointer to an instance of <see cref="ISetupPropertyStore"/>. This may be NULL if no properties are defined.</param> 355 /// <param name="ppProperties">A pointer to an instance of <see cref="ISetupPropertyStore"/>. This may be NULL if no properties are defined.</param>
356 /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns> 356 /// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
357 STDMETHOD(GetProperties)( 357 STDMETHOD(GetProperties)(
358 _Outptr_result_maybenull_ ISetupPropertyStore** ppProperties 358 _Outptr_result_maybenull_ ISetupPropertyStore** ppProperties
src/zig_clang.cpp+4-4
...@@ -1537,10 +1537,10 @@ void ZigClang_detect_enum_ConstantExprKind(clang::Expr::ConstantExprKind x) {...@@ -1537,10 +1537,10 @@ void ZigClang_detect_enum_ConstantExprKind(clang::Expr::ConstantExprKind x) {
1537 break;1537 break;
1538 }1538 }
1539}1539}
1540static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ContantExprKind_Normal == clang::Expr::ConstantExprKind::Normal, "");1540static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ConstantExprKind_Normal == clang::Expr::ConstantExprKind::Normal, "");
1541static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ContantExprKind_NonClassTemplateArgument == clang::Expr::ConstantExprKind::NonClassTemplateArgument, "");1541static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ConstantExprKind_NonClassTemplateArgument == clang::Expr::ConstantExprKind::NonClassTemplateArgument, "");
1542static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ContantExprKind_ClassTemplateArgument == clang::Expr::ConstantExprKind::ClassTemplateArgument, "");1542static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ConstantExprKind_ClassTemplateArgument == clang::Expr::ConstantExprKind::ClassTemplateArgument, "");
1543static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ContantExprKind_ImmediateInvocation == clang::Expr::ConstantExprKind::ImmediateInvocation, "");1543static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ConstantExprKind_ImmediateInvocation == clang::Expr::ConstantExprKind::ImmediateInvocation, "");
15441544
15451545
1546static_assert(sizeof(ZigClangAPValue) == sizeof(clang::APValue), "");1546static_assert(sizeof(ZigClangAPValue) == sizeof(clang::APValue), "");
src/zig_clang.h+4-4
...@@ -934,10 +934,10 @@ enum ZigClangPreprocessedEntity_EntityKind {...@@ -934,10 +934,10 @@ enum ZigClangPreprocessedEntity_EntityKind {
934};934};
935935
936enum ZigClangExpr_ConstantExprKind {936enum ZigClangExpr_ConstantExprKind {
937 ZigClangExpr_ContantExprKind_Normal,937 ZigClangExpr_ConstantExprKind_Normal,
938 ZigClangExpr_ContantExprKind_NonClassTemplateArgument,938 ZigClangExpr_ConstantExprKind_NonClassTemplateArgument,
939 ZigClangExpr_ContantExprKind_ClassTemplateArgument,939 ZigClangExpr_ConstantExprKind_ClassTemplateArgument,
940 ZigClangExpr_ContantExprKind_ImmediateInvocation,940 ZigClangExpr_ConstantExprKind_ImmediateInvocation,
941};941};
942942
943enum ZigClangUnaryExprOrTypeTrait_Kind {943enum ZigClangUnaryExprOrTypeTrait_Kind {
src/zig_llvm-ar.cpp+1-1
...@@ -492,7 +492,7 @@ static std::string ArchiveName;...@@ -492,7 +492,7 @@ static std::string ArchiveName;
492static std::vector<std::unique_ptr<MemoryBuffer>> ArchiveBuffers;492static std::vector<std::unique_ptr<MemoryBuffer>> ArchiveBuffers;
493static std::vector<std::unique_ptr<object::Archive>> Archives;493static std::vector<std::unique_ptr<object::Archive>> Archives;
494494
495// This variable holds the list of member files to proecess, as given495// This variable holds the list of member files to process, as given
496// on the command line.496// on the command line.
497static std::vector<StringRef> Members;497static std::vector<StringRef> Members;
498498
test/behavior/array_stage1.zig+1-1
...@@ -140,7 +140,7 @@ fn testArrayByValAtComptime(b: [2]u8) u8 {...@@ -140,7 +140,7 @@ fn testArrayByValAtComptime(b: [2]u8) u8 {
140 return b[0];140 return b[0];
141}141}
142142
143test "comptime evalutating function that takes array by value" {143test "comptime evaluating function that takes array by value" {
144 const arr = [_]u8{ 0, 1 };144 const arr = [_]u8{ 0, 1 };
145 _ = comptime testArrayByValAtComptime(arr);145 _ = comptime testArrayByValAtComptime(arr);
146 _ = comptime testArrayByValAtComptime(arr);146 _ = comptime testArrayByValAtComptime(arr);
test/behavior/bugs/1735.zig+1-1
...@@ -40,7 +40,7 @@ const a = struct {...@@ -40,7 +40,7 @@ const a = struct {
40 }40 }
41};41};
4242
43test "intialization" {43test "initialization" {
44 var t = a.init();44 var t = a.init();
45 try std.testing.expect(t.foo.len == 0);45 try std.testing.expect(t.foo.len == 0);
46}46}
test/behavior/eval_stage1.zig+1-1
...@@ -88,7 +88,7 @@ var st_init_str_foo = StInitStrFoo{...@@ -88,7 +88,7 @@ var st_init_str_foo = StInitStrFoo{
88 .y = true,88 .y = true,
89};89};
9090
91test "statically initalized array literal" {91test "statically initialized array literal" {
92 const y: [4]u8 = st_init_arr_lit_x;92 const y: [4]u8 = st_init_arr_lit_x;
93 try expect(y[3] == 4);93 try expect(y[3] == 4);
94}94}
test/behavior/switch.zig+7-7
...@@ -65,18 +65,18 @@ fn nonConstSwitchOnEnum(fruit: Fruit) void {...@@ -65,18 +65,18 @@ fn nonConstSwitchOnEnum(fruit: Fruit) void {
65}65}
6666
67test "switch statement" {67test "switch statement" {
68 try nonConstSwitch(SwitchStatmentFoo.C);68 try nonConstSwitch(SwitchStatementFoo.C);
69}69}
70fn nonConstSwitch(foo: SwitchStatmentFoo) !void {70fn nonConstSwitch(foo: SwitchStatementFoo) !void {
71 const val = switch (foo) {71 const val = switch (foo) {
72 SwitchStatmentFoo.A => @as(i32, 1),72 SwitchStatementFoo.A => @as(i32, 1),
73 SwitchStatmentFoo.B => 2,73 SwitchStatementFoo.B => 2,
74 SwitchStatmentFoo.C => 3,74 SwitchStatementFoo.C => 3,
75 SwitchStatmentFoo.D => 4,75 SwitchStatementFoo.D => 4,
76 };76 };
77 try expect(val == 3);77 try expect(val == 3);
78}78}
79const SwitchStatmentFoo = enum {79const SwitchStatementFoo = enum {
80 A,80 A,
81 B,81 B,
82 C,82 C,
test/behavior/vector.zig+1-1
...@@ -116,7 +116,7 @@ test "array to vector" {...@@ -116,7 +116,7 @@ test "array to vector" {
116 _ = vec;116 _ = vec;
117}117}
118118
119test "vector casts of sizes not divisable by 8" {119test "vector casts of sizes not divisible by 8" {
120 const S = struct {120 const S = struct {
121 fn doTheTest() !void {121 fn doTheTest() !void {
122 {122 {
test/compile_errors.zig+6-6
...@@ -683,7 +683,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -683,7 +683,7 @@ pub fn addCases(ctx: *TestContext) !void {
683 \\ _ = u;683 \\ _ = u;
684 \\}684 \\}
685 , &[_][]const u8{685 , &[_][]const u8{
686 "tmp.zig:12:16: error: runtime cast to union 'U' from non-exhustive enum",686 "tmp.zig:12:16: error: runtime cast to union 'U' from non-exhaustive enum",
687 "tmp.zig:17:16: error: no tag by value 15",687 "tmp.zig:17:16: error: no tag by value 15",
688 });688 });
689689
...@@ -6145,9 +6145,9 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -6145,9 +6145,9 @@ pub fn addCases(ctx: *TestContext) !void {
6145 });6145 });
61466146
6147 ctx.objErrStage1("endless loop in function evaluation",6147 ctx.objErrStage1("endless loop in function evaluation",
6148 \\const seventh_fib_number = fibbonaci(7);6148 \\const seventh_fib_number = fibonacci(7);
6149 \\fn fibbonaci(x: i32) i32 {6149 \\fn fibonacci(x: i32) i32 {
6150 \\ return fibbonaci(x - 1) + fibbonaci(x - 2);6150 \\ return fibonacci(x - 1) + fibonacci(x - 2);
6151 \\}6151 \\}
6152 \\6152 \\
6153 \\export fn entry() usize { return @sizeOf(@TypeOf(seventh_fib_number)); }6153 \\export fn entry() usize { return @sizeOf(@TypeOf(seventh_fib_number)); }
...@@ -6775,7 +6775,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -6775,7 +6775,7 @@ pub fn addCases(ctx: *TestContext) !void {
6775 "tmp.zig:2:5: error: expression value is ignored",6775 "tmp.zig:2:5: error: expression value is ignored",
6776 });6776 });
67776777
6778 ctx.objErrStage1("ignored defered statement value",6778 ctx.objErrStage1("ignored deferred statement value",
6779 \\export fn foo() void {6779 \\export fn foo() void {
6780 \\ defer {1;}6780 \\ defer {1;}
6781 \\}6781 \\}
...@@ -6783,7 +6783,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -6783,7 +6783,7 @@ pub fn addCases(ctx: *TestContext) !void {
6783 "tmp.zig:2:12: error: expression value is ignored",6783 "tmp.zig:2:12: error: expression value is ignored",
6784 });6784 });
67856785
6786 ctx.objErrStage1("ignored defered function call",6786 ctx.objErrStage1("ignored deferred function call",
6787 \\export fn foo() void {6787 \\export fn foo() void {
6788 \\ defer bar();6788 \\ defer bar();
6789 \\}6789 \\}
test/run_translated_c.zig+2-2
...@@ -24,7 +24,7 @@ pub fn addCases(cases: *tests.RunTranslatedCContext) void {...@@ -24,7 +24,7 @@ pub fn addCases(cases: *tests.RunTranslatedCContext) void {
24 \\}24 \\}
25 , "DEG2RAD is: 0.017453" ++ nl);25 , "DEG2RAD is: 0.017453" ++ nl);
2626
27 cases.add("use global scope for record/enum/typedef type transalation if needed",27 cases.add("use global scope for record/enum/typedef type translation if needed",
28 \\void bar(void);28 \\void bar(void);
29 \\void baz(void);29 \\void baz(void);
30 \\struct foo { int x; };30 \\struct foo { int x; };
...@@ -394,7 +394,7 @@ pub fn addCases(cases: *tests.RunTranslatedCContext) void {...@@ -394,7 +394,7 @@ pub fn addCases(cases: *tests.RunTranslatedCContext) void {
394 \\}394 \\}
395 , "");395 , "");
396396
397 cases.add("ensure array casts outisde +=",397 cases.add("ensure array casts outside +=",
398 \\#include <stdlib.h>398 \\#include <stdlib.h>
399 \\static int hash_binary(int k)399 \\static int hash_binary(int k)
400 \\{400 \\{
test/stage2/darwin.zig+1-1
...@@ -118,7 +118,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -118,7 +118,7 @@ pub fn addCases(ctx: *TestContext) !void {
118 {118 {
119 var case = ctx.exe("corner case - update existing, singular TextBlock", target);119 var case = ctx.exe("corner case - update existing, singular TextBlock", target);
120120
121 // This test case also covers an infrequent scenarion where the string table *may* be relocated121 // This test case also covers an infrequent scenario where the string table *may* be relocated
122 // into the position preceeding the symbol table which results in a dyld error.122 // into the position preceeding the symbol table which results in a dyld error.
123 case.addCompareOutput(123 case.addCompareOutput(
124 \\extern fn exit(usize) noreturn;124 \\extern fn exit(usize) noreturn;
test/tests.zig+1-1
...@@ -455,7 +455,7 @@ pub fn addTranslateCTests(b: *build.Builder, test_filter: ?[]const u8) *build.St...@@ -455,7 +455,7 @@ pub fn addTranslateCTests(b: *build.Builder, test_filter: ?[]const u8) *build.St
455 const cases = b.allocator.create(TranslateCContext) catch unreachable;455 const cases = b.allocator.create(TranslateCContext) catch unreachable;
456 cases.* = TranslateCContext{456 cases.* = TranslateCContext{
457 .b = b,457 .b = b,
458 .step = b.step("test-translate-c", "Run the C transation tests"),458 .step = b.step("test-translate-c", "Run the C translation tests"),
459 .test_index = 0,459 .test_index = 0,
460 .test_filter = test_filter,460 .test_filter = test_filter,
461 };461 };
test/translate_c.zig+2-2
...@@ -3188,7 +3188,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {...@@ -3188,7 +3188,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
3188 \\}3188 \\}
3189 });3189 });
31903190
3191 cases.add("macro comparisions",3191 cases.add("macro comparisons",
3192 \\#define MIN(a, b) ((b) < (a) ? (b) : (a))3192 \\#define MIN(a, b) ((b) < (a) ? (b) : (a))
3193 \\#define MAX(a, b) ((b) > (a) ? (b) : (a))3193 \\#define MAX(a, b) ((b) > (a) ? (b) : (a))
3194 , &[_][]const u8{3194 , &[_][]const u8{
...@@ -3443,7 +3443,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {...@@ -3443,7 +3443,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
3443 });3443 });
3444 }3444 }
34453445
3446 cases.add("unnamed fields have predictabile names",3446 cases.add("unnamed fields have predictable names",
3447 \\struct a {3447 \\struct a {
3448 \\ struct {};3448 \\ struct {};
3449 \\};3449 \\};