| author | |
| committer | |
| log | 664941bf14cad3e62b453f83153ca4b65606707b |
| tree | 776a9f1b32a06e6cc71be4dd77f72f80be01e1b2 |
| parent | ef7fa76001f873824b0f64dfc2172ed2f304c348 |
| signature |
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 | 1 | @echo on |
| 2 | 2 | SET "SRCROOT=%cd%" |
| 3 | 3 | SET "PREVPATH=%PATH%" |
| 4 | SET "PREVMSYSEM=%MSYSTEM%" | |
| 4 | SET "PREVMSYSTEM=%MSYSTEM%" | |
| 5 | 5 | |
| 6 | 6 | set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem" |
| 7 | 7 | SET "MSYSTEM=MINGW64" |
doc/langref.html.in+12-12| ... | ... | @@ -2125,7 +2125,7 @@ fn dump(args: anytype) !void { |
| 2125 | 2125 | |
| 2126 | 2126 | {#header_open|Multidimensional Arrays#} |
| 2127 | 2127 | <p> |
| 2128 | Mutlidimensional arrays can be created by nesting arrays: | |
| 2128 | Multidimensional arrays can be created by nesting arrays: | |
| 2129 | 2129 | </p> |
| 2130 | 2130 | {#code_begin|test|multidimensional#} |
| 2131 | 2131 | const std = @import("std"); |
| ... | ... | @@ -2898,7 +2898,7 @@ fn bar(x: *const u3) u3 { |
| 2898 | 2898 | } |
| 2899 | 2899 | {#code_end#} |
| 2900 | 2900 | <p> |
| 2901 | In this case, the function {#syntax#}bar{#endsyntax#} cannot be called becuse the pointer | |
| 2901 | In this case, the function {#syntax#}bar{#endsyntax#} cannot be called because the pointer | |
| 2902 | 2902 | to the non-ABI-aligned field mentions the bit offset, but the function expects an ABI-aligned pointer. |
| 2903 | 2903 | </p> |
| 2904 | 2904 | <p> |
| ... | ... | @@ -5549,7 +5549,7 @@ test "coerce to optionals" { |
| 5549 | 5549 | } |
| 5550 | 5550 | {#code_end#} |
| 5551 | 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#} | |
| 5553 | 5553 | const std = @import("std"); |
| 5554 | 5554 | const expect = std.testing.expect; |
| 5555 | 5555 | |
| ... | ... | @@ -7669,7 +7669,7 @@ test "main" { |
| 7669 | 7669 | } |
| 7670 | 7670 | {#code_end#} |
| 7671 | 7671 | <p> |
| 7672 | will ouput: | |
| 7672 | will output: | |
| 7673 | 7673 | </p> |
| 7674 | 7674 | <p> |
| 7675 | 7675 | If all {#syntax#}@compileLog{#endsyntax#} calls are removed or |
| ... | ... | @@ -7786,7 +7786,7 @@ test "main" { |
| 7786 | 7786 | the tag value is used as the enumeration value. |
| 7787 | 7787 | </p> |
| 7788 | 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 | 7790 | known at {#link|comptime#}. |
| 7791 | 7791 | </p> |
| 7792 | 7792 | {#see_also|@intToEnum#} |
| ... | ... | @@ -8736,7 +8736,7 @@ fn doTheTest() !void { |
| 8736 | 8736 | {#header_open|@sin#} |
| 8737 | 8737 | <pre>{#syntax#}@sin(value: anytype) @TypeOf(value){#endsyntax#}</pre> |
| 8738 | 8738 | <p> |
| 8739 | Sine trigometric function on a floating point number. Uses a dedicated hardware instruction | |
| 8739 | Sine trigonometric function on a floating point number. Uses a dedicated hardware instruction | |
| 8740 | 8740 | when available. |
| 8741 | 8741 | </p> |
| 8742 | 8742 | <p> |
| ... | ... | @@ -8747,7 +8747,7 @@ fn doTheTest() !void { |
| 8747 | 8747 | {#header_open|@cos#} |
| 8748 | 8748 | <pre>{#syntax#}@cos(value: anytype) @TypeOf(value){#endsyntax#}</pre> |
| 8749 | 8749 | <p> |
| 8750 | Cosine trigometric function on a floating point number. Uses a dedicated hardware instruction | |
| 8750 | Cosine trigonometric function on a floating point number. Uses a dedicated hardware instruction | |
| 8751 | 8751 | when available. |
| 8752 | 8752 | </p> |
| 8753 | 8753 | <p> |
| ... | ... | @@ -10325,7 +10325,7 @@ pub fn main() void { |
| 10325 | 10325 | <p> |
| 10326 | 10326 | Some C constructs cannot be translated to Zig - for example, <em>goto</em>, |
| 10327 | 10327 | 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 | 10329 | </p> |
| 10330 | 10330 | <p> |
| 10331 | 10331 | Demotion comes in three varieties - {#link|opaque#}, <em>extern</em>, and |
| ... | ... | @@ -10335,13 +10335,13 @@ pub fn main() void { |
| 10335 | 10335 | Functions that contain opaque types or code constructs that cannot be translated will be demoted |
| 10336 | 10336 | to {#syntax#}extern{#endsyntax#} declarations. |
| 10337 | 10337 | |
| 10338 | Thus, non-translateable types can still be used as pointers, and non-translateable functions | |
| 10338 | Thus, non-translatable types can still be used as pointers, and non-translatable functions | |
| 10339 | 10339 | can be called so long as the linker is aware of the compiled function. |
| 10340 | 10340 | </p> |
| 10341 | 10341 | <p> |
| 10342 | 10342 | {#syntax#}@compileError{#endsyntax#} is used when top-level definitions (global variables, |
| 10343 | 10343 | 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 unless | |
| 10344 | top-level declarations, untranslatable entities will not cause a compile error in your code unless | |
| 10345 | 10345 | you actually use them. |
| 10346 | 10346 | </p> |
| 10347 | 10347 | {#see_also|opaque|extern|@compileError#} |
| ... | ... | @@ -10353,7 +10353,7 @@ pub fn main() void { |
| 10353 | 10353 | can be translated to Zig. Macros that cannot be translated will be be demoted to |
| 10354 | 10354 | {#syntax#}@compileError{#endsyntax#}. Note that C code which <em>uses</em> macros will be |
| 10355 | 10355 | 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 to | |
| 10356 | with macros expanded). It is merely the macros themselves which may not be translatable to | |
| 10357 | 10357 | Zig. |
| 10358 | 10358 | </p> |
| 10359 | 10359 | <p>Consider the following example:</p> |
| ... | ... | @@ -10373,7 +10373,7 @@ pub export fn foo() c_int { |
| 10373 | 10373 | } |
| 10374 | 10374 | pub const MAKELOCAL = @compileError("unable to translate C expr: unexpected token .Equal"); // macro.c:1:9 |
| 10375 | 10375 | {#code_end#} |
| 10376 | <p>Note that {#syntax#}foo{#endsyntax#} was translated correctly despite using a non-translateable | |
| 10376 | <p>Note that {#syntax#}foo{#endsyntax#} was translated correctly despite using a non-translatable | |
| 10377 | 10377 | macro. {#syntax#}MAKELOCAL{#endsyntax#} was demoted to {#syntax#}@compileError{#endsyntax#} since |
| 10378 | 10378 | it cannot be expressed as a Zig function; this simply means that you cannot directly use |
| 10379 | 10379 | {#syntax#}MAKELOCAL{#endsyntax#} from Zig. |
src/AstGen.zig+2-2| ... | ... | @@ -197,7 +197,7 @@ pub const ResultLoc = union(enum) { |
| 197 | 197 | none_or_ref, |
| 198 | 198 | /// The expression will be coerced into this type, but it will be evaluated as an rvalue. |
| 199 | 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 | 201 | /// so no `as` instruction needs to be emitted. |
| 202 | 202 | coerced_ty: Zir.Inst.Ref, |
| 203 | 203 | /// 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 | 479 | return expr(gz, scope, .ref, node); |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | /// Turn Zig AST into untyped ZIR istructions. | |
| 482 | /// Turn Zig AST into untyped ZIR instructions. | |
| 483 | 483 | /// When `rl` is discard, ptr, inferred_ptr, or inferred_ptr, the |
| 484 | 484 | /// result instruction can be used to inspect whether it is isNoReturn() but that is it, |
| 485 | 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 | 812 | |
| 813 | 813 | const needs_c_symbols = !options.skip_linker_dependencies and is_exe_or_dyn_lib; |
| 814 | 814 | |
| 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 | 816 | const wasi_exec_model = if (options.target.os.tag != .wasi) undefined else options.wasi_exec_model orelse .command; |
| 817 | 817 | |
| 818 | 818 | const comp: *Compilation = comp: { |
src/Liveness.zig+1-1| ... | ... | @@ -30,7 +30,7 @@ tomb_bits: []usize, |
| 30 | 30 | /// The main tomb bits are still used and the extra ones are starting with the lsb of the |
| 31 | 31 | /// value here. |
| 32 | 32 | special: 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. | |
| 34 | 34 | extra: []const u32, |
| 35 | 35 | |
| 36 | 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 | 2188 | node_offset_bin_op: i32, |
| 2189 | 2189 | /// The source location points to the LHS of a binary expression, found |
| 2190 | 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 | 2192 | /// The Decl is determined contextually. |
| 2193 | 2193 | node_offset_bin_lhs: i32, |
| 2194 | 2194 | /// The source location points to the RHS of a binary expression, found |
| 2195 | 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 | 2197 | /// The Decl is determined contextually. |
| 2198 | 2198 | node_offset_bin_rhs: i32, |
| 2199 | 2199 | /// The source location points to the operand of a switch expression, found |
| 2200 | 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 | 2202 | /// The Decl is determined contextually. |
| 2203 | 2203 | node_offset_switch_operand: i32, |
| 2204 | 2204 | /// The source location points to the else/`_` prong of a switch expression, found |
| 2205 | 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 | 2207 | /// The Decl is determined contextually. |
| 2208 | 2208 | node_offset_switch_special_prong: i32, |
| 2209 | 2209 | /// The source location points to all the ranges of a switch expression, found |
| 2210 | 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 the | |
| 2211 | /// which points to a switch expression AST node. Next, navigate to any of the | |
| 2212 | 2212 | /// range nodes. The error applies to all of them. |
| 2213 | 2213 | /// The Decl is determined contextually. |
| 2214 | 2214 | node_offset_switch_range: i32, |
| 2215 | 2215 | /// The source location points to the calling convention of a function type |
| 2216 | 2216 | /// 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 to | |
| 2217 | /// Decl AST node, which points to a function type AST node. Next, navigate to | |
| 2218 | 2218 | /// the calling convention node. |
| 2219 | 2219 | /// The Decl is determined contextually. |
| 2220 | 2220 | node_offset_fn_type_cc: i32, |
| 2221 | 2221 | /// The source location points to the return type of a function type |
| 2222 | 2222 | /// 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 to | |
| 2223 | /// Decl AST node, which points to a function type AST node. Next, navigate to | |
| 2224 | 2224 | /// the return type node. |
| 2225 | 2225 | /// The Decl is determined contextually. |
| 2226 | 2226 | node_offset_fn_type_ret_ty: i32, |
src/Sema.zig+3-3| ... | ... | @@ -11164,7 +11164,7 @@ fn getBuiltinType( |
| 11164 | 11164 | } |
| 11165 | 11165 | |
| 11166 | 11166 | /// There is another implementation of this in `Type.onePossibleValue`. This one |
| 11167 | /// in `Sema` is for calling during semantic analysis, and peforms field resolution | |
| 11167 | /// in `Sema` is for calling during semantic analysis, and performs field resolution | |
| 11168 | 11168 | /// to get the answer. The one in `Type` is for calling during codegen and asserts |
| 11169 | 11169 | /// that the types are already resolved. |
| 11170 | 11170 | fn typeHasOnePossibleValue( |
| ... | ... | @@ -11541,7 +11541,7 @@ fn analyzeComptimeAlloc( |
| 11541 | 11541 | |
| 11542 | 11542 | /// The places where a user can specify an address space attribute |
| 11543 | 11543 | pub 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 | 11545 | function, |
| 11546 | 11546 | |
| 11547 | 11547 | /// A (global) variable is specified to be placed in a certain address space. |
| ... | ... | @@ -11553,7 +11553,7 @@ pub const AddressSpaceContext = enum { |
| 11553 | 11553 | /// In contrast to .variable, values placed in this address space are not required to be mutable. |
| 11554 | 11554 | constant, |
| 11555 | 11555 | |
| 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 | 11557 | pointer, |
| 11558 | 11558 | }; |
| 11559 | 11559 |
src/codegen.zig+7-7| ... | ... | @@ -985,7 +985,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 985 | 985 | // increasing the pc |
| 986 | 986 | const d_pc_p9 = @intCast(i64, delta_pc) - quant; |
| 987 | 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 quanta | |
| 988 | // minus one because if its the last one, we want to leave space to change the line which is one quanta | |
| 989 | 989 | try dbg_out.dbg_line.append(@intCast(u8, @divExact(d_pc_p9, quant) + 128) - quant); |
| 990 | 990 | if (dbg_out.pcop_change_index.*) |pci| |
| 991 | 991 | dbg_out.dbg_line.items[pci] += 1; |
| ... | ... | @@ -1919,15 +1919,15 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 1919 | 1919 | }, |
| 1920 | 1920 | .shl => { |
| 1921 | 1921 | assert(!swap_lhs_and_rhs); |
| 1922 | const shift_amout = switch (operand) { | |
| 1922 | const shift_amount = switch (operand) { | |
| 1923 | 1923 | .Register => |reg_op| Instruction.ShiftAmount.reg(@intToEnum(Register, reg_op.rm)), |
| 1924 | 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 | 1928 | .shr => { |
| 1929 | 1929 | assert(!swap_lhs_and_rhs); |
| 1930 | const shift_amout = switch (operand) { | |
| 1930 | const shift_amount = switch (operand) { | |
| 1931 | 1931 | .Register => |reg_op| Instruction.ShiftAmount.reg(@intToEnum(Register, reg_op.rm)), |
| 1932 | 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 | 1936 | .signed => Instruction.asr, |
| 1937 | 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 | 1941 | else => unreachable, // not a binary instruction |
| 1942 | 1942 | } |
| ... | ... | @@ -3618,7 +3618,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 3618 | 3618 | try self.blocks.putNoClobber(self.gpa, inst, .{ |
| 3619 | 3619 | // A block is a setup to be able to jump to the end. |
| 3620 | 3620 | .relocs = .{}, |
| 3621 | // It also acts as a receptical for break operands. | |
| 3621 | // It also acts as a receptacle for break operands. | |
| 3622 | 3622 | // Here we use `MCValue.none` to represent a null value so that the first |
| 3623 | 3623 | // break instruction will choose a MCValue for the block result and overwrite |
| 3624 | 3624 | // 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 | 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 arch | |
| 3675 | 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 | 2 | const DW = std.dwarf; |
| 3 | 3 | const testing = std.testing; |
| 4 | 4 | |
| 5 | /// The condition field specifies the flags neccessary for an | |
| 5 | /// The condition field specifies the flags necessary for an | |
| 6 | 6 | /// Instruction to be executed |
| 7 | 7 | pub const Condition = enum(u4) { |
| 8 | 8 | /// equal |
src/codegen/llvm.zig+1-1| ... | ... | @@ -1161,7 +1161,7 @@ pub const FuncGen = struct { |
| 1161 | 1161 | /// in other instructions. This table is cleared before every function is generated. |
| 1162 | 1162 | func_inst_table: std.AutoHashMapUnmanaged(Air.Inst.Index, *const llvm.Value), |
| 1163 | 1163 | |
| 1164 | /// These fields are used to refer to the LLVM value of the function paramaters | |
| 1164 | /// These fields are used to refer to the LLVM value of the function parameters | |
| 1165 | 1165 | /// in an Arg instruction. |
| 1166 | 1166 | args: []*const llvm.Value, |
| 1167 | 1167 | arg_index: usize, |
src/codegen/spirv.zig+2-2| ... | ... | @@ -260,7 +260,7 @@ pub const DeclGen = struct { |
| 260 | 260 | }; |
| 261 | 261 | } |
| 262 | 262 | |
| 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 | 264 | /// a message is returned by this function. Callee owns the memory. If this function |
| 265 | 265 | /// returns such a reportable error, it is valid to be called again for a different decl. |
| 266 | 266 | pub fn gen(self: *DeclGen, decl: *Decl, air: Air, liveness: Liveness) !?*Module.ErrorMsg { |
| ... | ... | @@ -565,7 +565,7 @@ pub const DeclGen = struct { |
| 565 | 565 | } |
| 566 | 566 | }, |
| 567 | 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 | 569 | .Vector => { |
| 570 | 570 | // Although not 100% the same, Zig vectors map quite neatly to SPIR-V vectors (including many integer and float operations |
| 571 | 571 | // which work on them), so simply use those. |
src/codegen/wasm.zig+3-3| ... | ... | @@ -1005,7 +1005,7 @@ pub const Context = struct { |
| 1005 | 1005 | const rhs = self.resolveInst(bin_op.rhs); |
| 1006 | 1006 | |
| 1007 | 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 | 1009 | const offset = blk: { |
| 1010 | 1010 | if (lhs == .code_offset) break :blk lhs.code_offset; |
| 1011 | 1011 | if (rhs == .code_offset) break :blk rhs.code_offset; |
| ... | ... | @@ -1031,7 +1031,7 @@ pub const Context = struct { |
| 1031 | 1031 | const rhs = self.resolveInst(bin_op.rhs); |
| 1032 | 1032 | |
| 1033 | 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 | 1035 | const offset = blk: { |
| 1036 | 1036 | if (lhs == .code_offset) break :blk lhs.code_offset; |
| 1037 | 1037 | if (rhs == .code_offset) break :blk rhs.code_offset; |
| ... | ... | @@ -1395,7 +1395,7 @@ pub const Context = struct { |
| 1395 | 1395 | } |
| 1396 | 1396 | |
| 1397 | 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 depth | |
| 1398 | // We then determine how far we have to jump to it by subtracting it from current block depth | |
| 1399 | 1399 | const idx: u32 = self.block_depth - self.blocks.get(br.block_inst).?; |
| 1400 | 1400 | const writer = self.code.writer(); |
| 1401 | 1401 | try writer.writeByte(wasm.opcode(.br)); |
src/link/Coff.zig+3-3| ... | ... | @@ -50,7 +50,7 @@ last_text_block: ?*TextBlock = null, |
| 50 | 50 | section_table_offset: u32 = 0, |
| 51 | 51 | /// Section data file pointer. |
| 52 | 52 | section_data_offset: u32 = 0, |
| 53 | /// Optiona header file pointer. | |
| 53 | /// Optional header file pointer. | |
| 54 | 54 | optional_header_offset: u32 = 0, |
| 55 | 55 | |
| 56 | 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 | 602 | const current_virtual_size = mem.alignForwardGeneric(u32, self.offset_table_size, section_alignment); |
| 603 | 603 | const new_virtual_size = mem.alignForwardGeneric(u32, new_raw_size, section_alignment); |
| 604 | 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` section |
| 605 | // and the virutal size of the `.got` section | |
| 605 | // and the virtual size of the `.got` section | |
| 606 | 606 | |
| 607 | 607 | if (new_virtual_size != current_virtual_size) { |
| 608 | 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 | 980 | const full_out_path = try directory.join(arena, &[_][]const u8{self.base.options.emit.?.sub_path}); |
| 981 | 981 | |
| 982 | 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 copy | |
| 983 | // LLD's COFF driver does not support the equivalent of `-r` so we do a simple file copy | |
| 984 | 984 | // here. TODO: think carefully about how we can avoid this redundant operation when doing |
| 985 | 985 | // build-obj. See also the corresponding TODO in linkAsArchive. |
| 986 | 986 | const the_object_path = blk: { |
src/link/MachO.zig+4-4| ... | ... | @@ -213,7 +213,7 @@ decls: std.AutoArrayHashMapUnmanaged(*Module.Decl, void) = .{}, |
| 213 | 213 | |
| 214 | 214 | /// Currently active Module.Decl. |
| 215 | 215 | /// 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 | 217 | /// somewhere else in the codegen. |
| 218 | 218 | active_decl: ?*Module.Decl = null, |
| 219 | 219 | |
| ... | ... | @@ -512,7 +512,7 @@ pub fn flush(self: *MachO, comp: *Compilation) !void { |
| 512 | 512 | const full_out_path = try directory.join(arena, &[_][]const u8{self.base.options.emit.?.sub_path}); |
| 513 | 513 | |
| 514 | 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 copy | |
| 515 | // LLD's MachO driver does not support the equivalent of `-r` so we do a simple file copy | |
| 516 | 516 | // here. TODO: think carefully about how we can avoid this redundant operation when doing |
| 517 | 517 | // build-obj. See also the corresponding TODO in linkAsArchive. |
| 518 | 518 | const the_object_path = blk: { |
| ... | ... | @@ -2245,7 +2245,7 @@ pub fn createStubAtom(self: *MachO, laptr_sym_index: u32) !*Atom { |
| 2245 | 2245 | fn createTentativeDefAtoms(self: *MachO) !void { |
| 2246 | 2246 | if (self.tentatives.count() == 0) return; |
| 2247 | 2247 | // 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 | 2249 | while (self.tentatives.popOrNull()) |entry| { |
| 2250 | 2250 | const match = MatchingSection{ |
| 2251 | 2251 | .seg = self.data_segment_cmd_index.?, |
| ... | ... | @@ -4609,7 +4609,7 @@ fn populateLazyBindOffsetsInStubHelper(self: *MachO, buffer: []const u8) !void { |
| 4609 | 4609 | |
| 4610 | 4610 | // Because we insert lazy binding opcodes in reverse order (from last to the first atom), |
| 4611 | 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 | 4613 | var atom = last_atom; |
| 4614 | 4614 | while (atom.prev) |prev| { |
| 4615 | 4615 | atom = prev; |
src/link/MachO/Atom.zig+1-1| ... | ... | @@ -41,7 +41,7 @@ code: std.ArrayListUnmanaged(u8) = .{}, |
| 41 | 41 | size: u64, |
| 42 | 42 | |
| 43 | 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. | |
| 45 | 45 | alignment: u32, |
| 46 | 46 | |
| 47 | 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 | 506 | }); |
| 507 | 507 | |
| 508 | 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. | |
| 510 | 510 | |
| 511 | 511 | const exp_buffer = [_]u8{ |
| 512 | 512 | 0x0, 0x1, // node root |
src/link/Plan9/aout.zig+1-1| ... | ... | @@ -16,7 +16,7 @@ pub const ExecHdr = extern struct { |
| 16 | 16 | comptime { |
| 17 | 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 | 20 | pub fn toU8s(self: *@This()) [40]u8 { |
| 21 | 21 | var buf: [40]u8 = undefined; |
| 22 | 22 | var i: u8 = 0; |
src/link/SpirV.zig+2-2| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | //! - OpName and OpMemberName instructions. |
| 13 | 13 | //! - OpModuleProcessed instructions. |
| 14 | 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 | 16 | //! All function declarations without a body (extern functions presumably). |
| 17 | 17 | //! All regular functions. |
| 18 | 18 | |
| ... | ... | @@ -93,7 +93,7 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio |
| 93 | 93 | if (options.use_llvm) return error.LLVM_BackendIsTODO_ForSpirV; // TODO: LLVM Doesn't support SpirV at all. |
| 94 | 94 | if (options.use_lld) return error.LLD_LinkingIsTODO_ForSpirV; // TODO: LLD Doesn't support SpirV at all. |
| 95 | 95 | |
| 96 | // TODO: read the file and keep vaild parts instead of truncating | |
| 96 | // TODO: read the file and keep valid parts instead of truncating | |
| 97 | 97 | const file = try options.emit.?.directory.handle.createFile(sub_path, .{ .truncate = true, .read = true }); |
| 98 | 98 | errdefer file.close(); |
| 99 | 99 |
src/link/Wasm.zig+3-3| ... | ... | @@ -35,7 +35,7 @@ llvm_object: ?*LlvmObject = null, |
| 35 | 35 | /// TODO: can/should we access some data structure in Module directly? |
| 36 | 36 | funcs: std.ArrayListUnmanaged(*Module.Decl) = .{}, |
| 37 | 37 | /// 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 index | |
| 38 | /// wasm binary. The position in the list defines the function index | |
| 39 | 39 | ext_funcs: std.ArrayListUnmanaged(*Module.Decl) = .{}, |
| 40 | 40 | /// When importing objects from the host environment, a name must be supplied. |
| 41 | 41 | /// 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 | 714 | const full_out_path = try directory.join(arena, &[_][]const u8{self.base.options.emit.?.sub_path}); |
| 715 | 715 | |
| 716 | 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 copy | |
| 717 | // LLD's WASM driver does not support the equivalent of `-r` so we do a simple file copy | |
| 718 | 718 | // here. TODO: think carefully about how we can avoid this redundant operation when doing |
| 719 | 719 | // build-obj. See also the corresponding TODO in linkAsArchive. |
| 720 | 720 | const the_object_path = blk: { |
| ... | ... | @@ -756,7 +756,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void { |
| 756 | 756 | |
| 757 | 757 | if (self.base.options.output_mode == .Exe) { |
| 758 | 758 | // 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 | 760 | try argv.append("-z"); |
| 761 | 761 | const stack_size = self.base.options.stack_size_override orelse 1048576; |
| 762 | 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 | 6804 | // Since this frame is async, an await might represent a suspend point, and |
| 6805 | 6805 | // therefore need to spill. It also needs to mark expr scopes as having to spill. |
| 6806 | 6806 | // 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 | 6808 | for (size_t i = 0; i < fn->await_list.length; i += 1) { |
| 6809 | 6809 | Stage1AirInstAwait *await = fn->await_list.at(i); |
| 6810 | 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 | 6374 | |
| 6375 | 6375 | if (target->value->type->data.enumeration.non_exhaustive) { |
| 6376 | 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 | 6378 | buf_ptr(&wanted_type->name))); |
| 6379 | 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 | 15189 | return ir_analyze_inferred_field_ptr(ira, field_name, scope, source_node, container_ptr, bare_type); |
| 15190 | 15190 | } |
| 15191 | 15191 | |
| 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 | 15193 | // We do this if the container pointer is undefined and we are in a TypeOf call. |
| 15194 | 15194 | bool return_undef = container_ptr->value->special == ConstValSpecialUndef && \ |
| 15195 | 15195 | get_scope_typeof(scope) != nullptr; |
| ... | ... | @@ -15248,7 +15248,7 @@ static Stage1AirInst *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_ |
| 15248 | 15248 | if (type_is_invalid(union_val->type)) |
| 15249 | 15249 | return ira->codegen->invalid_inst_gen; |
| 15250 | 15250 | |
| 15251 | // Reject undefined values unless we're intializing the union: | |
| 15251 | // Reject undefined values unless we're initializing the union: | |
| 15252 | 15252 | // a undefined union means also the tag is undefined, accessing |
| 15253 | 15253 | // its payload slot is UB. |
| 15254 | 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 | 558 | case Stage1AirInstIdWasmMemoryGrow: |
| 559 | 559 | return "GenWasmMemoryGrow"; |
| 560 | 560 | case Stage1AirInstIdExtern: |
| 561 | return "GenExtrern"; | |
| 561 | return "GenExtern"; | |
| 562 | 562 | } |
| 563 | 563 | zig_unreachable(); |
| 564 | 564 | } |
| ... | ... | @@ -829,7 +829,7 @@ static const char *cast_op_str(CastOp op) { |
| 829 | 829 | case CastOpIntToFloat: return "IntToFloat"; |
| 830 | 830 | case CastOpFloatToInt: return "FloatToInt"; |
| 831 | 831 | case CastOpBoolToInt: return "BoolToInt"; |
| 832 | case CastOpNumLitToConcrete: return "NumLitToConcrate"; | |
| 832 | case CastOpNumLitToConcrete: return "NumLitToConcrete"; | |
| 833 | 833 | case CastOpErrSet: return "ErrSet"; |
| 834 | 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 | 2073 | return nullptr; |
| 2074 | 2074 | } |
| 2075 | 2075 | if (eat_token_if(pc, TokenIdEq) == 0) { |
| 2076 | // Because ".Name" can also be intepreted as an enum literal, we should put back | |
| 2076 | // Because ".Name" can also be interpreted as an enum literal, we should put back | |
| 2077 | 2077 | // those two tokens again so that the parser can try to parse them as the enum |
| 2078 | 2078 | // literal later. |
| 2079 | 2079 | put_back_token(pc); |
src/type.zig+1-1| ... | ... | @@ -3419,7 +3419,7 @@ pub const Type = extern union { |
| 3419 | 3419 | anyerror_void_error_union, |
| 3420 | 3420 | generic_poison, |
| 3421 | 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 | 3423 | var_args_param, |
| 3424 | 3424 | /// Same as `empty_struct` except it has an empty namespace. |
| 3425 | 3425 | empty_struct_literal, |
src/windows_com.hpp+1-1| ... | ... | @@ -352,7 +352,7 @@ extern "C" { |
| 352 | 352 | 	/// <summary> |
| 353 | 353 | 	/// Gets product-specific properties. |
| 354 | 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 | 356 | 	/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns> |
| 357 | 357 | 	STDMETHOD(GetProperties)( |
| 358 | 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 | 1537 | break; |
| 1538 | 1538 | } |
| 1539 | 1539 | } |
| 1540 | static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ContantExprKind_Normal == clang::Expr::ConstantExprKind::Normal, ""); | |
| 1541 | static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ContantExprKind_NonClassTemplateArgument == clang::Expr::ConstantExprKind::NonClassTemplateArgument, ""); | |
| 1542 | static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ContantExprKind_ClassTemplateArgument == clang::Expr::ConstantExprKind::ClassTemplateArgument, ""); | |
| 1543 | static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ContantExprKind_ImmediateInvocation == clang::Expr::ConstantExprKind::ImmediateInvocation, ""); | |
| 1540 | static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ConstantExprKind_Normal == clang::Expr::ConstantExprKind::Normal, ""); | |
| 1541 | static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ConstantExprKind_NonClassTemplateArgument == clang::Expr::ConstantExprKind::NonClassTemplateArgument, ""); | |
| 1542 | static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ConstantExprKind_ClassTemplateArgument == clang::Expr::ConstantExprKind::ClassTemplateArgument, ""); | |
| 1543 | static_assert((clang::Expr::ConstantExprKind)ZigClangExpr_ConstantExprKind_ImmediateInvocation == clang::Expr::ConstantExprKind::ImmediateInvocation, ""); | |
| 1544 | 1544 | |
| 1545 | 1545 | |
| 1546 | 1546 | static_assert(sizeof(ZigClangAPValue) == sizeof(clang::APValue), ""); |
src/zig_clang.h+4-4| ... | ... | @@ -934,10 +934,10 @@ enum ZigClangPreprocessedEntity_EntityKind { |
| 934 | 934 | }; |
| 935 | 935 | |
| 936 | 936 | enum ZigClangExpr_ConstantExprKind { |
| 937 | ZigClangExpr_ContantExprKind_Normal, | |
| 938 | ZigClangExpr_ContantExprKind_NonClassTemplateArgument, | |
| 939 | ZigClangExpr_ContantExprKind_ClassTemplateArgument, | |
| 940 | ZigClangExpr_ContantExprKind_ImmediateInvocation, | |
| 937 | ZigClangExpr_ConstantExprKind_Normal, | |
| 938 | ZigClangExpr_ConstantExprKind_NonClassTemplateArgument, | |
| 939 | ZigClangExpr_ConstantExprKind_ClassTemplateArgument, | |
| 940 | ZigClangExpr_ConstantExprKind_ImmediateInvocation, | |
| 941 | 941 | }; |
| 942 | 942 | |
| 943 | 943 | enum ZigClangUnaryExprOrTypeTrait_Kind { |
src/zig_llvm-ar.cpp+1-1| ... | ... | @@ -492,7 +492,7 @@ static std::string ArchiveName; |
| 492 | 492 | static std::vector<std::unique_ptr<MemoryBuffer>> ArchiveBuffers; |
| 493 | 493 | static std::vector<std::unique_ptr<object::Archive>> Archives; |
| 494 | 494 | |
| 495 | // This variable holds the list of member files to proecess, as given | |
| 495 | // This variable holds the list of member files to process, as given | |
| 496 | 496 | // on the command line. |
| 497 | 497 | static std::vector<StringRef> Members; |
| 498 | 498 |
test/behavior/array_stage1.zig+1-1| ... | ... | @@ -140,7 +140,7 @@ fn testArrayByValAtComptime(b: [2]u8) u8 { |
| 140 | 140 | return b[0]; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | test "comptime evalutating function that takes array by value" { | |
| 143 | test "comptime evaluating function that takes array by value" { | |
| 144 | 144 | const arr = [_]u8{ 0, 1 }; |
| 145 | 145 | _ = comptime testArrayByValAtComptime(arr); |
| 146 | 146 | _ = comptime testArrayByValAtComptime(arr); |
test/behavior/bugs/1735.zig+1-1| ... | ... | @@ -40,7 +40,7 @@ const a = struct { |
| 40 | 40 | } |
| 41 | 41 | }; |
| 42 | 42 | |
| 43 | test "intialization" { | |
| 43 | test "initialization" { | |
| 44 | 44 | var t = a.init(); |
| 45 | 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 | 88 | .y = true, |
| 89 | 89 | }; |
| 90 | 90 | |
| 91 | test "statically initalized array literal" { | |
| 91 | test "statically initialized array literal" { | |
| 92 | 92 | const y: [4]u8 = st_init_arr_lit_x; |
| 93 | 93 | try expect(y[3] == 4); |
| 94 | 94 | } |
test/behavior/switch.zig+7-7| ... | ... | @@ -65,18 +65,18 @@ fn nonConstSwitchOnEnum(fruit: Fruit) void { |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | test "switch statement" { |
| 68 | try nonConstSwitch(SwitchStatmentFoo.C); | |
| 68 | try nonConstSwitch(SwitchStatementFoo.C); | |
| 69 | 69 | } |
| 70 | fn nonConstSwitch(foo: SwitchStatmentFoo) !void { | |
| 70 | fn nonConstSwitch(foo: SwitchStatementFoo) !void { | |
| 71 | 71 | const val = switch (foo) { |
| 72 | SwitchStatmentFoo.A => @as(i32, 1), | |
| 73 | SwitchStatmentFoo.B => 2, | |
| 74 | SwitchStatmentFoo.C => 3, | |
| 75 | SwitchStatmentFoo.D => 4, | |
| 72 | SwitchStatementFoo.A => @as(i32, 1), | |
| 73 | SwitchStatementFoo.B => 2, | |
| 74 | SwitchStatementFoo.C => 3, | |
| 75 | SwitchStatementFoo.D => 4, | |
| 76 | 76 | }; |
| 77 | 77 | try expect(val == 3); |
| 78 | 78 | } |
| 79 | const SwitchStatmentFoo = enum { | |
| 79 | const SwitchStatementFoo = enum { | |
| 80 | 80 | A, |
| 81 | 81 | B, |
| 82 | 82 | C, |
test/behavior/vector.zig+1-1| ... | ... | @@ -116,7 +116,7 @@ test "array to vector" { |
| 116 | 116 | _ = vec; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | test "vector casts of sizes not divisable by 8" { | |
| 119 | test "vector casts of sizes not divisible by 8" { | |
| 120 | 120 | const S = struct { |
| 121 | 121 | fn doTheTest() !void { |
| 122 | 122 | { |
test/compile_errors.zig+6-6| ... | ... | @@ -683,7 +683,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 683 | 683 | \\ _ = u; |
| 684 | 684 | \\} |
| 685 | 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 | 687 | "tmp.zig:17:16: error: no tag by value 15", |
| 688 | 688 | }); |
| 689 | 689 | |
| ... | ... | @@ -6145,9 +6145,9 @@ pub fn addCases(ctx: *TestContext) !void { |
| 6145 | 6145 | }); |
| 6146 | 6146 | |
| 6147 | 6147 | ctx.objErrStage1("endless loop in function evaluation", |
| 6148 | \\const seventh_fib_number = fibbonaci(7); | |
| 6149 | \\fn fibbonaci(x: i32) i32 { | |
| 6150 | \\ return fibbonaci(x - 1) + fibbonaci(x - 2); | |
| 6148 | \\const seventh_fib_number = fibonacci(7); | |
| 6149 | \\fn fibonacci(x: i32) i32 { | |
| 6150 | \\ return fibonacci(x - 1) + fibonacci(x - 2); | |
| 6151 | 6151 | \\} |
| 6152 | 6152 | \\ |
| 6153 | 6153 | \\export fn entry() usize { return @sizeOf(@TypeOf(seventh_fib_number)); } |
| ... | ... | @@ -6775,7 +6775,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 6775 | 6775 | "tmp.zig:2:5: error: expression value is ignored", |
| 6776 | 6776 | }); |
| 6777 | 6777 | |
| 6778 | ctx.objErrStage1("ignored defered statement value", | |
| 6778 | ctx.objErrStage1("ignored deferred statement value", | |
| 6779 | 6779 | \\export fn foo() void { |
| 6780 | 6780 | \\ defer {1;} |
| 6781 | 6781 | \\} |
| ... | ... | @@ -6783,7 +6783,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 6783 | 6783 | "tmp.zig:2:12: error: expression value is ignored", |
| 6784 | 6784 | }); |
| 6785 | 6785 | |
| 6786 | ctx.objErrStage1("ignored defered function call", | |
| 6786 | ctx.objErrStage1("ignored deferred function call", | |
| 6787 | 6787 | \\export fn foo() void { |
| 6788 | 6788 | \\ defer bar(); |
| 6789 | 6789 | \\} |
test/run_translated_c.zig+2-2| ... | ... | @@ -24,7 +24,7 @@ pub fn addCases(cases: *tests.RunTranslatedCContext) void { |
| 24 | 24 | \\} |
| 25 | 25 | , "DEG2RAD is: 0.017453" ++ nl); |
| 26 | 26 | |
| 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 | 28 | \\void bar(void); |
| 29 | 29 | \\void baz(void); |
| 30 | 30 | \\struct foo { int x; }; |
| ... | ... | @@ -394,7 +394,7 @@ pub fn addCases(cases: *tests.RunTranslatedCContext) void { |
| 394 | 394 | \\} |
| 395 | 395 | , ""); |
| 396 | 396 | |
| 397 | cases.add("ensure array casts outisde +=", | |
| 397 | cases.add("ensure array casts outside +=", | |
| 398 | 398 | \\#include <stdlib.h> |
| 399 | 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 | 118 | { |
| 119 | 119 | var case = ctx.exe("corner case - update existing, singular TextBlock", target); |
| 120 | 120 | |
| 121 | // This test case also covers an infrequent scenarion where the string table *may* be relocated | |
| 121 | // This test case also covers an infrequent scenario where the string table *may* be relocated | |
| 122 | 122 | // into the position preceeding the symbol table which results in a dyld error. |
| 123 | 123 | case.addCompareOutput( |
| 124 | 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 | 455 | const cases = b.allocator.create(TranslateCContext) catch unreachable; |
| 456 | 456 | cases.* = TranslateCContext{ |
| 457 | 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 | 459 | .test_index = 0, |
| 460 | 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 | 3188 | \\} |
| 3189 | 3189 | }); |
| 3190 | 3190 | |
| 3191 | cases.add("macro comparisions", | |
| 3191 | cases.add("macro comparisons", | |
| 3192 | 3192 | \\#define MIN(a, b) ((b) < (a) ? (b) : (a)) |
| 3193 | 3193 | \\#define MAX(a, b) ((b) > (a) ? (b) : (a)) |
| 3194 | 3194 | , &[_][]const u8{ |
| ... | ... | @@ -3443,7 +3443,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3443 | 3443 | }); |
| 3444 | 3444 | } |
| 3445 | 3445 | |
| 3446 | cases.add("unnamed fields have predictabile names", | |
| 3446 | cases.add("unnamed fields have predictable names", | |
| 3447 | 3447 | \\struct a { |
| 3448 | 3448 | \\ struct {}; |
| 3449 | 3449 | \\}; |