From 664941bf14cad3e62b453f83153ca4b65606707b Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Fri, 24 Sep 2021 13:39:20 -0400 Subject: [PATCH] Spelling corrections (#9833) Signed-off-by: Josh Soref Co-authored-by: Josh Soref --- ci/azure/windows_msvc_script.bat | 2 +- doc/langref.html.in | 24 ++++++++++++------------ src/AstGen.zig | 4 ++-- src/Compilation.zig | 2 +- src/Liveness.zig | 2 +- src/Module.zig | 14 +++++++------- src/Sema.zig | 6 +++--- src/codegen.zig | 14 +++++++------- src/codegen/arm.zig | 2 +- src/codegen/llvm.zig | 2 +- src/codegen/spirv.zig | 4 ++-- src/codegen/wasm.zig | 6 +++--- src/link/Coff.zig | 6 +++--- src/link/MachO.zig | 8 ++++---- src/link/MachO/Atom.zig | 2 +- src/link/MachO/Trie.zig | 2 +- src/link/Plan9/aout.zig | 2 +- src/link/SpirV.zig | 4 ++-- src/link/Wasm.zig | 6 +++--- src/stage1/analyze.cpp | 2 +- src/stage1/ir.cpp | 6 +++--- src/stage1/ir_print.cpp | 4 ++-- src/stage1/parser.cpp | 2 +- src/type.zig | 2 +- src/windows_com.hpp | 2 +- src/zig_clang.cpp | 8 ++++---- src/zig_clang.h | 8 ++++---- src/zig_llvm-ar.cpp | 2 +- test/behavior/array_stage1.zig | 2 +- test/behavior/bugs/1735.zig | 2 +- test/behavior/eval_stage1.zig | 2 +- test/behavior/switch.zig | 14 +++++++------- test/behavior/vector.zig | 2 +- test/compile_errors.zig | 12 ++++++------ test/run_translated_c.zig | 4 ++-- test/stage2/darwin.zig | 2 +- test/tests.zig | 2 +- test/translate_c.zig | 4 ++-- 38 files changed, 97 insertions(+), 97 deletions(-) diff --git a/ci/azure/windows_msvc_script.bat b/ci/azure/windows_msvc_script.bat index a0736507174e..84b19ef2fac8 100644 --- a/ci/azure/windows_msvc_script.bat +++ b/ci/azure/windows_msvc_script.bat @@ -1,7 +1,7 @@ @echo on SET "SRCROOT=%cd%" SET "PREVPATH=%PATH%" -SET "PREVMSYSEM=%MSYSTEM%" +SET "PREVMSYSTEM=%MSYSTEM%" set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem" SET "MSYSTEM=MINGW64" diff --git a/doc/langref.html.in b/doc/langref.html.in index 97503aed7238..561065bc0d3a 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -2125,7 +2125,7 @@ fn dump(args: anytype) !void { {#header_open|Multidimensional Arrays#}

- Mutlidimensional arrays can be created by nesting arrays: + Multidimensional arrays can be created by nesting arrays:

{#code_begin|test|multidimensional#} const std = @import("std"); @@ -2898,7 +2898,7 @@ fn bar(x: *const u3) u3 { } {#code_end#}

- In this case, the function {#syntax#}bar{#endsyntax#} cannot be called becuse the pointer + In this case, the function {#syntax#}bar{#endsyntax#} cannot be called because the pointer to the non-ABI-aligned field mentions the bit offset, but the function expects an ABI-aligned pointer.

@@ -5549,7 +5549,7 @@ test "coerce to optionals" { } {#code_end#}

It works nested inside the {#link|Error Union Type#}, too:

- {#code_begin|test|test_corerce_optional_wrapped_error_union#} + {#code_begin|test|test_coerce_optional_wrapped_error_union#} const std = @import("std"); const expect = std.testing.expect; @@ -7669,7 +7669,7 @@ test "main" { } {#code_end#}

- will ouput: + will output:

If all {#syntax#}@compileLog{#endsyntax#} calls are removed or @@ -7786,7 +7786,7 @@ test "main" { the tag value is used as the enumeration value.

- If there is only one possible enum value, the resut is a {#syntax#}comptime_int{#endsyntax#} + If there is only one possible enum value, the result is a {#syntax#}comptime_int{#endsyntax#} known at {#link|comptime#}.

{#see_also|@intToEnum#} @@ -8736,7 +8736,7 @@ fn doTheTest() !void { {#header_open|@sin#}
{#syntax#}@sin(value: anytype) @TypeOf(value){#endsyntax#}

- Sine trigometric function on a floating point number. Uses a dedicated hardware instruction + Sine trigonometric function on a floating point number. Uses a dedicated hardware instruction when available.

@@ -8747,7 +8747,7 @@ fn doTheTest() !void { {#header_open|@cos#}

{#syntax#}@cos(value: anytype) @TypeOf(value){#endsyntax#}

- Cosine trigometric function on a floating point number. Uses a dedicated hardware instruction + Cosine trigonometric function on a floating point number. Uses a dedicated hardware instruction when available.

@@ -10325,7 +10325,7 @@ pub fn main() void {

Some C constructs cannot be translated to Zig - for example, goto, structs with bitfields, and token-pasting macros. Zig employs demotion to allow translation - to continue in the face of non-translateable entities. + to continue in the face of non-translatable entities.

Demotion comes in three varieties - {#link|opaque#}, extern, and @@ -10335,13 +10335,13 @@ pub fn main() void { Functions that contain opaque types or code constructs that cannot be translated will be demoted to {#syntax#}extern{#endsyntax#} declarations. - Thus, non-translateable types can still be used as pointers, and non-translateable functions + Thus, non-translatable types can still be used as pointers, and non-translatable functions can be called so long as the linker is aware of the compiled function.

{#syntax#}@compileError{#endsyntax#} is used when top-level definitions (global variables, function prototypes, macros) cannot be translated or demoted. Since Zig uses lazy analysis for - top-level declarations, untranslateable entities will not cause a compile error in your code unless + top-level declarations, untranslatable entities will not cause a compile error in your code unless you actually use them.

{#see_also|opaque|extern|@compileError#} @@ -10353,7 +10353,7 @@ pub fn main() void { can be translated to Zig. Macros that cannot be translated will be be demoted to {#syntax#}@compileError{#endsyntax#}. Note that C code which uses macros will be translated without any additional issues (since Zig operates on the pre-processed source - with macros expanded). It is merely the macros themselves which may not be translateable to + with macros expanded). It is merely the macros themselves which may not be translatable to Zig.

Consider the following example:

@@ -10373,7 +10373,7 @@ pub export fn foo() c_int { } pub const MAKELOCAL = @compileError("unable to translate C expr: unexpected token .Equal"); // macro.c:1:9 {#code_end#} -

Note that {#syntax#}foo{#endsyntax#} was translated correctly despite using a non-translateable +

Note that {#syntax#}foo{#endsyntax#} was translated correctly despite using a non-translatable macro. {#syntax#}MAKELOCAL{#endsyntax#} was demoted to {#syntax#}@compileError{#endsyntax#} since it cannot be expressed as a Zig function; this simply means that you cannot directly use {#syntax#}MAKELOCAL{#endsyntax#} from Zig. diff --git a/src/AstGen.zig b/src/AstGen.zig index 14ad6c94a7eb..416584bee988 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -197,7 +197,7 @@ pub const ResultLoc = union(enum) { none_or_ref, /// The expression will be coerced into this type, but it will be evaluated as an rvalue. ty: Zir.Inst.Ref, - /// Same as `ty` but it is guaranteed that Sema will additionall perform the coercion, + /// Same as `ty` but it is guaranteed that Sema will additionally perform the coercion, /// so no `as` instruction needs to be emitted. coerced_ty: Zir.Inst.Ref, /// 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 return expr(gz, scope, .ref, node); } -/// Turn Zig AST into untyped ZIR istructions. +/// Turn Zig AST into untyped ZIR instructions. /// When `rl` is discard, ptr, inferred_ptr, or inferred_ptr, the /// result instruction can be used to inspect whether it is isNoReturn() but that is it, /// it must otherwise not be used. diff --git a/src/Compilation.zig b/src/Compilation.zig index 00a737c2be66..ef762dae1e2a 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -812,7 +812,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { const needs_c_symbols = !options.skip_linker_dependencies and is_exe_or_dyn_lib; - // WASI-only. Resolve the optinal exec-model option, defaults to command. + // WASI-only. Resolve the optional exec-model option, defaults to command. const wasi_exec_model = if (options.target.os.tag != .wasi) undefined else options.wasi_exec_model orelse .command; const comp: *Compilation = comp: { diff --git a/src/Liveness.zig b/src/Liveness.zig index dd0899e74535..4da5eaa28434 100644 --- a/src/Liveness.zig +++ b/src/Liveness.zig @@ -30,7 +30,7 @@ tomb_bits: []usize, /// The main tomb bits are still used and the extra ones are starting with the lsb of the /// value here. special: std.AutoHashMapUnmanaged(Air.Inst.Index, u32), -/// Auxilliary data. The way this data is interpreted is determined contextually. +/// Auxiliary data. The way this data is interpreted is determined contextually. extra: []const u32, /// Trailing is the set of instructions whose lifetimes end at the start of the then branch, diff --git a/src/Module.zig b/src/Module.zig index a6a9225d758c..33d8f6b715c0 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -2188,39 +2188,39 @@ pub const LazySrcLoc = union(enum) { node_offset_bin_op: i32, /// The source location points to the LHS of a binary expression, found /// by taking this AST node index offset from the containing Decl AST node, - /// which points to a binary expression AST node. Next, nagivate to the LHS. + /// which points to a binary expression AST node. Next, navigate to the LHS. /// The Decl is determined contextually. node_offset_bin_lhs: i32, /// The source location points to the RHS of a binary expression, found /// by taking this AST node index offset from the containing Decl AST node, - /// which points to a binary expression AST node. Next, nagivate to the RHS. + /// which points to a binary expression AST node. Next, navigate to the RHS. /// The Decl is determined contextually. node_offset_bin_rhs: i32, /// The source location points to the operand of a switch expression, found /// by taking this AST node index offset from the containing Decl AST node, - /// which points to a switch expression AST node. Next, nagivate to the operand. + /// which points to a switch expression AST node. Next, navigate to the operand. /// The Decl is determined contextually. node_offset_switch_operand: i32, /// The source location points to the else/`_` prong of a switch expression, found /// by taking this AST node index offset from the containing Decl AST node, - /// which points to a switch expression AST node. Next, nagivate to the else/`_` prong. + /// which points to a switch expression AST node. Next, navigate to the else/`_` prong. /// The Decl is determined contextually. node_offset_switch_special_prong: i32, /// The source location points to all the ranges of a switch expression, found /// by taking this AST node index offset from the containing Decl AST node, - /// which points to a switch expression AST node. Next, nagivate to any of the + /// which points to a switch expression AST node. Next, navigate to any of the /// range nodes. The error applies to all of them. /// The Decl is determined contextually. node_offset_switch_range: i32, /// The source location points to the calling convention of a function type /// expression, found by taking this AST node index offset from the containing - /// Decl AST node, which points to a function type AST node. Next, nagivate to + /// Decl AST node, which points to a function type AST node. Next, navigate to /// the calling convention node. /// The Decl is determined contextually. node_offset_fn_type_cc: i32, /// The source location points to the return type of a function type /// expression, found by taking this AST node index offset from the containing - /// Decl AST node, which points to a function type AST node. Next, nagivate to + /// Decl AST node, which points to a function type AST node. Next, navigate to /// the return type node. /// The Decl is determined contextually. node_offset_fn_type_ret_ty: i32, diff --git a/src/Sema.zig b/src/Sema.zig index cc7a227ca686..2fa12baca629 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -11164,7 +11164,7 @@ fn getBuiltinType( } /// There is another implementation of this in `Type.onePossibleValue`. This one -/// in `Sema` is for calling during semantic analysis, and peforms field resolution +/// in `Sema` is for calling during semantic analysis, and performs field resolution /// to get the answer. The one in `Type` is for calling during codegen and asserts /// that the types are already resolved. fn typeHasOnePossibleValue( @@ -11541,7 +11541,7 @@ fn analyzeComptimeAlloc( /// The places where a user can specify an address space attribute pub const AddressSpaceContext = enum { - /// A function is specificed to be placed in a certain address space. + /// A function is specified to be placed in a certain address space. function, /// A (global) variable is specified to be placed in a certain address space. @@ -11553,7 +11553,7 @@ pub const AddressSpaceContext = enum { /// In contrast to .variable, values placed in this address space are not required to be mutable. constant, - /// A pointer is ascripted to point into a certian address space. + /// A pointer is ascripted to point into a certain address space. pointer, }; diff --git a/src/codegen.zig b/src/codegen.zig index 06b520c9ddd7..56580f91e10c 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -985,7 +985,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { // increasing the pc const d_pc_p9 = @intCast(i64, delta_pc) - quant; if (d_pc_p9 > 0) { - // minus one becaue if its the last one, we want to leave space to change the line which is one quanta + // minus one because if its the last one, we want to leave space to change the line which is one quanta try dbg_out.dbg_line.append(@intCast(u8, @divExact(d_pc_p9, quant) + 128) - quant); if (dbg_out.pcop_change_index.*) |pci| dbg_out.dbg_line.items[pci] += 1; @@ -1919,15 +1919,15 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { }, .shl => { assert(!swap_lhs_and_rhs); - const shift_amout = switch (operand) { + const shift_amount = switch (operand) { .Register => |reg_op| Instruction.ShiftAmount.reg(@intToEnum(Register, reg_op.rm)), .Immediate => |imm_op| Instruction.ShiftAmount.imm(@intCast(u5, imm_op.imm)), }; - writeInt(u32, try self.code.addManyAsArray(4), Instruction.lsl(.al, dst_reg, op1, shift_amout).toU32()); + writeInt(u32, try self.code.addManyAsArray(4), Instruction.lsl(.al, dst_reg, op1, shift_amount).toU32()); }, .shr => { assert(!swap_lhs_and_rhs); - const shift_amout = switch (operand) { + const shift_amount = switch (operand) { .Register => |reg_op| Instruction.ShiftAmount.reg(@intToEnum(Register, reg_op.rm)), .Immediate => |imm_op| Instruction.ShiftAmount.imm(@intCast(u5, imm_op.imm)), }; @@ -1936,7 +1936,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { .signed => Instruction.asr, .unsigned => Instruction.lsr, }; - writeInt(u32, try self.code.addManyAsArray(4), shr(.al, dst_reg, op1, shift_amout).toU32()); + writeInt(u32, try self.code.addManyAsArray(4), shr(.al, dst_reg, op1, shift_amount).toU32()); }, else => unreachable, // not a binary instruction } @@ -3618,7 +3618,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { try self.blocks.putNoClobber(self.gpa, inst, .{ // A block is a setup to be able to jump to the end. .relocs = .{}, - // It also acts as a receptical for break operands. + // It also acts as a receptacle for break operands. // Here we use `MCValue.none` to represent a null value so that the first // break instruction will choose a MCValue for the block result and overwrite // 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 { return self.fail("TODO: enable larger branch offset", .{}); } }, - else => unreachable, // attempting to perfrom an ARM relocation on a non-ARM target arch + else => unreachable, // attempting to perform an ARM relocation on a non-ARM target arch } }, } diff --git a/src/codegen/arm.zig b/src/codegen/arm.zig index ec9152f96b0d..279ce5800523 100644 --- a/src/codegen/arm.zig +++ b/src/codegen/arm.zig @@ -2,7 +2,7 @@ const std = @import("std"); const DW = std.dwarf; const testing = std.testing; -/// The condition field specifies the flags neccessary for an +/// The condition field specifies the flags necessary for an /// Instruction to be executed pub const Condition = enum(u4) { /// equal diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 650628d8c27f..b2b87b97d82a 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -1161,7 +1161,7 @@ pub const FuncGen = struct { /// in other instructions. This table is cleared before every function is generated. func_inst_table: std.AutoHashMapUnmanaged(Air.Inst.Index, *const llvm.Value), - /// These fields are used to refer to the LLVM value of the function paramaters + /// These fields are used to refer to the LLVM value of the function parameters /// in an Arg instruction. args: []*const llvm.Value, arg_index: usize, diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index f5796b06bc88..5826daa5a5ce 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -260,7 +260,7 @@ pub const DeclGen = struct { }; } - /// Generate the code for `decl`. If a reportable error occured during code generation, + /// Generate the code for `decl`. If a reportable error occurred during code generation, /// a message is returned by this function. Callee owns the memory. If this function /// returns such a reportable error, it is valid to be called again for a different decl. pub fn gen(self: *DeclGen, decl: *Decl, air: Air, liveness: Liveness) !?*Module.ErrorMsg { @@ -565,7 +565,7 @@ pub const DeclGen = struct { } }, // When recursively generating a type, we cannot infer the pointer's storage class. See genPointerType. - .Pointer => return self.fail("Cannot create pointer with unkown storage class", .{}), + .Pointer => return self.fail("Cannot create pointer with unknown storage class", .{}), .Vector => { // Although not 100% the same, Zig vectors map quite neatly to SPIR-V vectors (including many integer and float operations // which work on them), so simply use those. diff --git a/src/codegen/wasm.zig b/src/codegen/wasm.zig index bb0556723698..9bd80f7d8479 100644 --- a/src/codegen/wasm.zig +++ b/src/codegen/wasm.zig @@ -1005,7 +1005,7 @@ pub const Context = struct { const rhs = self.resolveInst(bin_op.rhs); // it's possible for both lhs and/or rhs to return an offset as well, - // in which case we return the first offset occurance we find. + // in which case we return the first offset occurrence we find. const offset = blk: { if (lhs == .code_offset) break :blk lhs.code_offset; if (rhs == .code_offset) break :blk rhs.code_offset; @@ -1031,7 +1031,7 @@ pub const Context = struct { const rhs = self.resolveInst(bin_op.rhs); // it's possible for both lhs and/or rhs to return an offset as well, - // in which case we return the first offset occurance we find. + // in which case we return the first offset occurrence we find. const offset = blk: { if (lhs == .code_offset) break :blk lhs.code_offset; if (rhs == .code_offset) break :blk rhs.code_offset; @@ -1395,7 +1395,7 @@ pub const Context = struct { } // We map every block to its block index. - // We then determine how far we have to jump to it by substracting it from current block depth + // We then determine how far we have to jump to it by subtracting it from current block depth const idx: u32 = self.block_depth - self.blocks.get(br.block_inst).?; const writer = self.code.writer(); try writer.writeByte(wasm.opcode(.br)); diff --git a/src/link/Coff.zig b/src/link/Coff.zig index fa234f608b1e..fd009ca9f825 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -50,7 +50,7 @@ last_text_block: ?*TextBlock = null, section_table_offset: u32 = 0, /// Section data file pointer. section_data_offset: u32 = 0, -/// Optiona header file pointer. +/// Optional header file pointer. optional_header_offset: u32 = 0, /// 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 { const current_virtual_size = mem.alignForwardGeneric(u32, self.offset_table_size, section_alignment); const new_virtual_size = mem.alignForwardGeneric(u32, new_raw_size, section_alignment); // 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 - // and the virutal size of the `.got` section + // and the virtual size of the `.got` section if (new_virtual_size != current_virtual_size) { 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 { const full_out_path = try directory.join(arena, &[_][]const u8{self.base.options.emit.?.sub_path}); if (self.base.options.output_mode == .Obj) { - // LLD's COFF driver does not support the equvialent of `-r` so we do a simple file copy + // LLD's COFF driver does not support the equivalent of `-r` so we do a simple file copy // here. TODO: think carefully about how we can avoid this redundant operation when doing // build-obj. See also the corresponding TODO in linkAsArchive. const the_object_path = blk: { diff --git a/src/link/MachO.zig b/src/link/MachO.zig index e69b85ca7f6c..dc44474c0a07 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -213,7 +213,7 @@ decls: std.AutoArrayHashMapUnmanaged(*Module.Decl, void) = .{}, /// Currently active Module.Decl. /// TODO this might not be necessary if we figure out how to pass Module.Decl instance -/// to codegen.genSetReg() or alterntively move PIE displacement for MCValue{ .memory = x } +/// to codegen.genSetReg() or alternatively move PIE displacement for MCValue{ .memory = x } /// somewhere else in the codegen. active_decl: ?*Module.Decl = null, @@ -512,7 +512,7 @@ pub fn flush(self: *MachO, comp: *Compilation) !void { const full_out_path = try directory.join(arena, &[_][]const u8{self.base.options.emit.?.sub_path}); if (self.base.options.output_mode == .Obj) { - // LLD's MachO driver does not support the equvialent of `-r` so we do a simple file copy + // LLD's MachO driver does not support the equivalent of `-r` so we do a simple file copy // here. TODO: think carefully about how we can avoid this redundant operation when doing // build-obj. See also the corresponding TODO in linkAsArchive. const the_object_path = blk: { @@ -2245,7 +2245,7 @@ pub fn createStubAtom(self: *MachO, laptr_sym_index: u32) !*Atom { fn createTentativeDefAtoms(self: *MachO) !void { if (self.tentatives.count() == 0) return; // Convert any tentative definition into a regular symbol and allocate - // text blocks for each tentative defintion. + // text blocks for each tentative definition. while (self.tentatives.popOrNull()) |entry| { const match = MatchingSection{ .seg = self.data_segment_cmd_index.?, @@ -4609,7 +4609,7 @@ fn populateLazyBindOffsetsInStubHelper(self: *MachO, buffer: []const u8) !void { // Because we insert lazy binding opcodes in reverse order (from last to the first atom), // we need reverse the order of atom traversal here as well. - // TODO figure out a less error prone mechanims for this! + // TODO figure out a less error prone mechanisms for this! var atom = last_atom; while (atom.prev) |prev| { atom = prev; diff --git a/src/link/MachO/Atom.zig b/src/link/MachO/Atom.zig index bb6730fe0fac..46e5191ab32f 100644 --- a/src/link/MachO/Atom.zig +++ b/src/link/MachO/Atom.zig @@ -41,7 +41,7 @@ code: std.ArrayListUnmanaged(u8) = .{}, size: u64, /// Alignment of this atom as a power of 2. -/// For instance, aligmment of 0 should be read as 2^0 = 1 byte aligned. +/// For instance, alignment of 0 should be read as 2^0 = 1 byte aligned. alignment: u32, /// List of relocations belonging to this atom. diff --git a/src/link/MachO/Trie.zig b/src/link/MachO/Trie.zig index 7bf451f2c8fa..c166aaf432cb 100644 --- a/src/link/MachO/Trie.zig +++ b/src/link/MachO/Trie.zig @@ -506,7 +506,7 @@ test "write Trie to a byte stream" { }); try trie.finalize(gpa); - try trie.finalize(gpa); // Finalizing mulitple times is a nop subsequently unless we add new nodes. + try trie.finalize(gpa); // Finalizing multiple times is a nop subsequently unless we add new nodes. const exp_buffer = [_]u8{ 0x0, 0x1, // node root diff --git a/src/link/Plan9/aout.zig b/src/link/Plan9/aout.zig index f3570f880ceb..39994516fac6 100644 --- a/src/link/Plan9/aout.zig +++ b/src/link/Plan9/aout.zig @@ -16,7 +16,7 @@ pub const ExecHdr = extern struct { comptime { assert(@sizeOf(@This()) == 32); } - /// It is up to the caller to disgard the last 8 bytes if the header is not fat. + /// It is up to the caller to discard the last 8 bytes if the header is not fat. pub fn toU8s(self: *@This()) [40]u8 { var buf: [40]u8 = undefined; var i: u8 = 0; diff --git a/src/link/SpirV.zig b/src/link/SpirV.zig index 17b656a06c99..f9d3f7a1e65f 100644 --- a/src/link/SpirV.zig +++ b/src/link/SpirV.zig @@ -12,7 +12,7 @@ //! - OpName and OpMemberName instructions. //! - OpModuleProcessed instructions. //! All annotation (decoration) instructions. -//! All type declaration instructions, constant instructions, global variable declarations, (preferrably) OpUndef instructions. +//! All type declaration instructions, constant instructions, global variable declarations, (preferably) OpUndef instructions. //! All function declarations without a body (extern functions presumably). //! All regular functions. @@ -93,7 +93,7 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio if (options.use_llvm) return error.LLVM_BackendIsTODO_ForSpirV; // TODO: LLVM Doesn't support SpirV at all. if (options.use_lld) return error.LLD_LinkingIsTODO_ForSpirV; // TODO: LLD Doesn't support SpirV at all. - // TODO: read the file and keep vaild parts instead of truncating + // TODO: read the file and keep valid parts instead of truncating const file = try options.emit.?.directory.handle.createFile(sub_path, .{ .truncate = true, .read = true }); errdefer file.close(); diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index 3de1fb49cce5..a75ad1b2f7a1 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -35,7 +35,7 @@ llvm_object: ?*LlvmObject = null, /// TODO: can/should we access some data structure in Module directly? funcs: std.ArrayListUnmanaged(*Module.Decl) = .{}, /// List of all extern function Decls to be written to the `import` section of the -/// wasm binary. The positin in the list defines the function index +/// wasm binary. The position in the list defines the function index ext_funcs: std.ArrayListUnmanaged(*Module.Decl) = .{}, /// When importing objects from the host environment, a name must be supplied. /// 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 { const full_out_path = try directory.join(arena, &[_][]const u8{self.base.options.emit.?.sub_path}); if (self.base.options.output_mode == .Obj) { - // LLD's WASM driver does not support the equvialent of `-r` so we do a simple file copy + // LLD's WASM driver does not support the equivalent of `-r` so we do a simple file copy // here. TODO: think carefully about how we can avoid this redundant operation when doing // build-obj. See also the corresponding TODO in linkAsArchive. const the_object_path = blk: { @@ -756,7 +756,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void { if (self.base.options.output_mode == .Exe) { // Increase the default stack size to a more reasonable value of 1MB instead of - // the default of 1 Wasm page being 64KB, unless overriden by the user. + // the default of 1 Wasm page being 64KB, unless overridden by the user. try argv.append("-z"); const stack_size = self.base.options.stack_size_override orelse 1048576; const arg = try std.fmt.allocPrint(arena, "stack-size={d}", .{stack_size}); diff --git a/src/stage1/analyze.cpp b/src/stage1/analyze.cpp index 320d8ff9b207..ec4ff8fc9e62 100644 --- a/src/stage1/analyze.cpp +++ b/src/stage1/analyze.cpp @@ -6804,7 +6804,7 @@ static Error resolve_async_frame(CodeGen *g, ZigType *frame_type) { // Since this frame is async, an await might represent a suspend point, and // therefore need to spill. It also needs to mark expr scopes as having to spill. // For example: foo() + await z - // The funtion call result of foo() must be spilled. + // The function call result of foo() must be spilled. for (size_t i = 0; i < fn->await_list.length; i += 1) { Stage1AirInstAwait *await = fn->await_list.at(i); if (await->is_nosuspend) { diff --git a/src/stage1/ir.cpp b/src/stage1/ir.cpp index 87dfee1bf204..b853961beb72 100644 --- a/src/stage1/ir.cpp +++ b/src/stage1/ir.cpp @@ -6374,7 +6374,7 @@ static Stage1AirInst *ir_analyze_enum_to_union(IrAnalyze *ira, Scope *scope, Ast if (target->value->type->data.enumeration.non_exhaustive) { ir_add_error_node(ira, source_node, - buf_sprintf("runtime cast to union '%s' from non-exhustive enum", + buf_sprintf("runtime cast to union '%s' from non-exhaustive enum", buf_ptr(&wanted_type->name))); return ira->codegen->invalid_inst_gen; } @@ -15189,7 +15189,7 @@ static Stage1AirInst *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_ return ir_analyze_inferred_field_ptr(ira, field_name, scope, source_node, container_ptr, bare_type); } - // Tracks wether we should return an undefined value of the correct type. + // Tracks whether we should return an undefined value of the correct type. // We do this if the container pointer is undefined and we are in a TypeOf call. bool return_undef = container_ptr->value->special == ConstValSpecialUndef && \ get_scope_typeof(scope) != nullptr; @@ -15248,7 +15248,7 @@ static Stage1AirInst *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_ if (type_is_invalid(union_val->type)) return ira->codegen->invalid_inst_gen; - // Reject undefined values unless we're intializing the union: + // Reject undefined values unless we're initializing the union: // a undefined union means also the tag is undefined, accessing // its payload slot is UB. const UndefAllowed allow_undef = initializing ? UndefOk : UndefBad; diff --git a/src/stage1/ir_print.cpp b/src/stage1/ir_print.cpp index 152221926de2..a76d3e4d5afd 100644 --- a/src/stage1/ir_print.cpp +++ b/src/stage1/ir_print.cpp @@ -558,7 +558,7 @@ const char* ir_inst_gen_type_str(Stage1AirInstId id) { case Stage1AirInstIdWasmMemoryGrow: return "GenWasmMemoryGrow"; case Stage1AirInstIdExtern: - return "GenExtrern"; + return "GenExtern"; } zig_unreachable(); } @@ -829,7 +829,7 @@ static const char *cast_op_str(CastOp op) { case CastOpIntToFloat: return "IntToFloat"; case CastOpFloatToInt: return "FloatToInt"; case CastOpBoolToInt: return "BoolToInt"; - case CastOpNumLitToConcrete: return "NumLitToConcrate"; + case CastOpNumLitToConcrete: return "NumLitToConcrete"; case CastOpErrSet: return "ErrSet"; case CastOpBitCast: return "BitCast"; } diff --git a/src/stage1/parser.cpp b/src/stage1/parser.cpp index b06a9441721e..f7061bb23275 100644 --- a/src/stage1/parser.cpp +++ b/src/stage1/parser.cpp @@ -2073,7 +2073,7 @@ static AstNode *ast_parse_field_init(ParseContext *pc) { return nullptr; } if (eat_token_if(pc, TokenIdEq) == 0) { - // Because ".Name" can also be intepreted as an enum literal, we should put back + // Because ".Name" can also be interpreted as an enum literal, we should put back // those two tokens again so that the parser can try to parse them as the enum // literal later. put_back_token(pc); diff --git a/src/type.zig b/src/type.zig index f2fe9e4ccb80..4a0f2a0536a9 100644 --- a/src/type.zig +++ b/src/type.zig @@ -3419,7 +3419,7 @@ pub const Type = extern union { anyerror_void_error_union, generic_poison, /// This is a special type for variadic parameters of a function call. - /// Casts to it will validate that the type can be passed to a c calling convetion function. + /// Casts to it will validate that the type can be passed to a c calling convention function. var_args_param, /// Same as `empty_struct` except it has an empty namespace. empty_struct_literal, diff --git a/src/windows_com.hpp b/src/windows_com.hpp index f9833e091228..5f0f5565f761 100644 --- a/src/windows_com.hpp +++ b/src/windows_com.hpp @@ -352,7 +352,7 @@ extern "C" { ///

/// Gets product-specific properties. /// - /// A pointer to an instance of . This may be NULL if no properties are defined. + /// A pointer to an instance of . This may be NULL if no properties are defined. /// Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist. STDMETHOD(GetProperties)( _Outptr_result_maybenull_ ISetupPropertyStore** ppProperties diff --git a/src/zig_clang.cpp b/src/zig_clang.cpp index 6611585f687c..685ee8bcce5c 100644 --- a/src/zig_clang.cpp +++ b/src/zig_clang.cpp @@ -1537,10 +1537,10 @@ void ZigClang_detect_enum_ConstantExprKind(clang::Expr::ConstantExprKind x) { break; } } -static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ContantExprKind_Normal == clang::Expr::ConstantExprKind::Normal, ""); -static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ContantExprKind_NonClassTemplateArgument == clang::Expr::ConstantExprKind::NonClassTemplateArgument, ""); -static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ContantExprKind_ClassTemplateArgument == clang::Expr::ConstantExprKind::ClassTemplateArgument, ""); -static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ContantExprKind_ImmediateInvocation == clang::Expr::ConstantExprKind::ImmediateInvocation, ""); +static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ConstantExprKind_Normal == clang::Expr::ConstantExprKind::Normal, ""); +static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ConstantExprKind_NonClassTemplateArgument == clang::Expr::ConstantExprKind::NonClassTemplateArgument, ""); +static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ConstantExprKind_ClassTemplateArgument == clang::Expr::ConstantExprKind::ClassTemplateArgument, ""); +static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ConstantExprKind_ImmediateInvocation == clang::Expr::ConstantExprKind::ImmediateInvocation, ""); static_assert(sizeof(ZigClangAPValue) == sizeof(clang::APValue), ""); diff --git a/src/zig_clang.h b/src/zig_clang.h index 0e7a8b299035..26b4b3ca9a51 100644 --- a/src/zig_clang.h +++ b/src/zig_clang.h @@ -934,10 +934,10 @@ enum ZigClangPreprocessedEntity_EntityKind { }; enum ZigClangExpr_ConstantExprKind { - ZigClangExpr_ContantExprKind_Normal, - ZigClangExpr_ContantExprKind_NonClassTemplateArgument, - ZigClangExpr_ContantExprKind_ClassTemplateArgument, - ZigClangExpr_ContantExprKind_ImmediateInvocation, + ZigClangExpr_ConstantExprKind_Normal, + ZigClangExpr_ConstantExprKind_NonClassTemplateArgument, + ZigClangExpr_ConstantExprKind_ClassTemplateArgument, + ZigClangExpr_ConstantExprKind_ImmediateInvocation, }; enum ZigClangUnaryExprOrTypeTrait_Kind { diff --git a/src/zig_llvm-ar.cpp b/src/zig_llvm-ar.cpp index e4c376adbcee..107f500fcbda 100644 --- a/src/zig_llvm-ar.cpp +++ b/src/zig_llvm-ar.cpp @@ -492,7 +492,7 @@ static std::string ArchiveName; static std::vector> ArchiveBuffers; static std::vector> Archives; -// This variable holds the list of member files to proecess, as given +// This variable holds the list of member files to process, as given // on the command line. static std::vector Members; diff --git a/test/behavior/array_stage1.zig b/test/behavior/array_stage1.zig index d3a97665ac7c..c290ef9a08fc 100644 --- a/test/behavior/array_stage1.zig +++ b/test/behavior/array_stage1.zig @@ -140,7 +140,7 @@ fn testArrayByValAtComptime(b: [2]u8) u8 { return b[0]; } -test "comptime evalutating function that takes array by value" { +test "comptime evaluating function that takes array by value" { const arr = [_]u8{ 0, 1 }; _ = comptime testArrayByValAtComptime(arr); _ = comptime testArrayByValAtComptime(arr); diff --git a/test/behavior/bugs/1735.zig b/test/behavior/bugs/1735.zig index f3aa6eb9ec6d..1f6e3c99f49b 100644 --- a/test/behavior/bugs/1735.zig +++ b/test/behavior/bugs/1735.zig @@ -40,7 +40,7 @@ const a = struct { } }; -test "intialization" { +test "initialization" { var t = a.init(); try std.testing.expect(t.foo.len == 0); } diff --git a/test/behavior/eval_stage1.zig b/test/behavior/eval_stage1.zig index 644de50fd075..743f7af69e56 100644 --- a/test/behavior/eval_stage1.zig +++ b/test/behavior/eval_stage1.zig @@ -88,7 +88,7 @@ var st_init_str_foo = StInitStrFoo{ .y = true, }; -test "statically initalized array literal" { +test "statically initialized array literal" { const y: [4]u8 = st_init_arr_lit_x; try expect(y[3] == 4); } diff --git a/test/behavior/switch.zig b/test/behavior/switch.zig index e512565b806c..62afc74d8319 100644 --- a/test/behavior/switch.zig +++ b/test/behavior/switch.zig @@ -65,18 +65,18 @@ fn nonConstSwitchOnEnum(fruit: Fruit) void { } test "switch statement" { - try nonConstSwitch(SwitchStatmentFoo.C); + try nonConstSwitch(SwitchStatementFoo.C); } -fn nonConstSwitch(foo: SwitchStatmentFoo) !void { +fn nonConstSwitch(foo: SwitchStatementFoo) !void { const val = switch (foo) { - SwitchStatmentFoo.A => @as(i32, 1), - SwitchStatmentFoo.B => 2, - SwitchStatmentFoo.C => 3, - SwitchStatmentFoo.D => 4, + SwitchStatementFoo.A => @as(i32, 1), + SwitchStatementFoo.B => 2, + SwitchStatementFoo.C => 3, + SwitchStatementFoo.D => 4, }; try expect(val == 3); } -const SwitchStatmentFoo = enum { +const SwitchStatementFoo = enum { A, B, C, diff --git a/test/behavior/vector.zig b/test/behavior/vector.zig index 2c615b542bcb..b673542f8bd2 100644 --- a/test/behavior/vector.zig +++ b/test/behavior/vector.zig @@ -116,7 +116,7 @@ test "array to vector" { _ = vec; } -test "vector casts of sizes not divisable by 8" { +test "vector casts of sizes not divisible by 8" { const S = struct { fn doTheTest() !void { { diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 058fd1f2dbe7..0e59b0523fd1 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -683,7 +683,7 @@ pub fn addCases(ctx: *TestContext) !void { \\ _ = u; \\} , &[_][]const u8{ - "tmp.zig:12:16: error: runtime cast to union 'U' from non-exhustive enum", + "tmp.zig:12:16: error: runtime cast to union 'U' from non-exhaustive enum", "tmp.zig:17:16: error: no tag by value 15", }); @@ -6145,9 +6145,9 @@ pub fn addCases(ctx: *TestContext) !void { }); ctx.objErrStage1("endless loop in function evaluation", - \\const seventh_fib_number = fibbonaci(7); - \\fn fibbonaci(x: i32) i32 { - \\ return fibbonaci(x - 1) + fibbonaci(x - 2); + \\const seventh_fib_number = fibonacci(7); + \\fn fibonacci(x: i32) i32 { + \\ return fibonacci(x - 1) + fibonacci(x - 2); \\} \\ \\export fn entry() usize { return @sizeOf(@TypeOf(seventh_fib_number)); } @@ -6775,7 +6775,7 @@ pub fn addCases(ctx: *TestContext) !void { "tmp.zig:2:5: error: expression value is ignored", }); - ctx.objErrStage1("ignored defered statement value", + ctx.objErrStage1("ignored deferred statement value", \\export fn foo() void { \\ defer {1;} \\} @@ -6783,7 +6783,7 @@ pub fn addCases(ctx: *TestContext) !void { "tmp.zig:2:12: error: expression value is ignored", }); - ctx.objErrStage1("ignored defered function call", + ctx.objErrStage1("ignored deferred function call", \\export fn foo() void { \\ defer bar(); \\} diff --git a/test/run_translated_c.zig b/test/run_translated_c.zig index 28ba7aa704ce..c222a00eb79c 100644 --- a/test/run_translated_c.zig +++ b/test/run_translated_c.zig @@ -24,7 +24,7 @@ pub fn addCases(cases: *tests.RunTranslatedCContext) void { \\} , "DEG2RAD is: 0.017453" ++ nl); - cases.add("use global scope for record/enum/typedef type transalation if needed", + cases.add("use global scope for record/enum/typedef type translation if needed", \\void bar(void); \\void baz(void); \\struct foo { int x; }; @@ -394,7 +394,7 @@ pub fn addCases(cases: *tests.RunTranslatedCContext) void { \\} , ""); - cases.add("ensure array casts outisde +=", + cases.add("ensure array casts outside +=", \\#include \\static int hash_binary(int k) \\{ diff --git a/test/stage2/darwin.zig b/test/stage2/darwin.zig index 90058404d965..84334828bd34 100644 --- a/test/stage2/darwin.zig +++ b/test/stage2/darwin.zig @@ -118,7 +118,7 @@ pub fn addCases(ctx: *TestContext) !void { { var case = ctx.exe("corner case - update existing, singular TextBlock", target); - // This test case also covers an infrequent scenarion where the string table *may* be relocated + // This test case also covers an infrequent scenario where the string table *may* be relocated // into the position preceeding the symbol table which results in a dyld error. case.addCompareOutput( \\extern fn exit(usize) noreturn; diff --git a/test/tests.zig b/test/tests.zig index a90531c600cd..057709284577 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -455,7 +455,7 @@ pub fn addTranslateCTests(b: *build.Builder, test_filter: ?[]const u8) *build.St const cases = b.allocator.create(TranslateCContext) catch unreachable; cases.* = TranslateCContext{ .b = b, - .step = b.step("test-translate-c", "Run the C transation tests"), + .step = b.step("test-translate-c", "Run the C translation tests"), .test_index = 0, .test_filter = test_filter, }; diff --git a/test/translate_c.zig b/test/translate_c.zig index 5ff6c22ead59..db665124baf5 100644 --- a/test/translate_c.zig +++ b/test/translate_c.zig @@ -3188,7 +3188,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\} }); - cases.add("macro comparisions", + cases.add("macro comparisons", \\#define MIN(a, b) ((b) < (a) ? (b) : (a)) \\#define MAX(a, b) ((b) > (a) ? (b) : (a)) , &[_][]const u8{ @@ -3443,7 +3443,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { }); } - cases.add("unnamed fields have predictabile names", + cases.add("unnamed fields have predictable names", \\struct a { \\ struct {}; \\};