mirror of
https://github.com/ziglang/zig.git
synced 2024-11-26 23:22:44 +00:00
Spelling corrections (#9833)
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
This commit is contained in:
parent
ef7fa76001
commit
664941bf14
@ -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"
|
||||
|
@ -2125,7 +2125,7 @@ fn dump(args: anytype) !void {
|
||||
|
||||
{#header_open|Multidimensional Arrays#}
|
||||
<p>
|
||||
Mutlidimensional arrays can be created by nesting arrays:
|
||||
Multidimensional arrays can be created by nesting arrays:
|
||||
</p>
|
||||
{#code_begin|test|multidimensional#}
|
||||
const std = @import("std");
|
||||
@ -2898,7 +2898,7 @@ fn bar(x: *const u3) u3 {
|
||||
}
|
||||
{#code_end#}
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
@ -5549,7 +5549,7 @@ test "coerce to optionals" {
|
||||
}
|
||||
{#code_end#}
|
||||
<p>It works nested inside the {#link|Error Union Type#}, too:</p>
|
||||
{#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#}
|
||||
<p>
|
||||
will ouput:
|
||||
will output:
|
||||
</p>
|
||||
<p>
|
||||
If all {#syntax#}@compileLog{#endsyntax#} calls are removed or
|
||||
@ -7786,7 +7786,7 @@ test "main" {
|
||||
the tag value is used as the enumeration value.
|
||||
</p>
|
||||
<p>
|
||||
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#}.
|
||||
</p>
|
||||
{#see_also|@intToEnum#}
|
||||
@ -8736,7 +8736,7 @@ fn doTheTest() !void {
|
||||
{#header_open|@sin#}
|
||||
<pre>{#syntax#}@sin(value: anytype) @TypeOf(value){#endsyntax#}</pre>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
@ -8747,7 +8747,7 @@ fn doTheTest() !void {
|
||||
{#header_open|@cos#}
|
||||
<pre>{#syntax#}@cos(value: anytype) @TypeOf(value){#endsyntax#}</pre>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
@ -10325,7 +10325,7 @@ pub fn main() void {
|
||||
<p>
|
||||
Some C constructs cannot be translated to Zig - for example, <em>goto</em>,
|
||||
structs with bitfields, and token-pasting macros. Zig employs <em>demotion</em> to allow translation
|
||||
to continue in the face of non-translateable entities.
|
||||
to continue in the face of non-translatable entities.
|
||||
</p>
|
||||
<p>
|
||||
Demotion comes in three varieties - {#link|opaque#}, <em>extern</em>, 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.
|
||||
</p>
|
||||
<p>
|
||||
{#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.
|
||||
</p>
|
||||
{#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 <em>uses</em> 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.
|
||||
</p>
|
||||
<p>Consider the following example:</p>
|
||||
@ -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#}
|
||||
<p>Note that {#syntax#}foo{#endsyntax#} was translated correctly despite using a non-translateable
|
||||
<p>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.
|
||||
|
@ -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.
|
||||
|
@ -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: {
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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.
|
||||
|
@ -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));
|
||||
|
@ -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: {
|
||||
|
@ -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;
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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});
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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";
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -352,7 +352,7 @@ extern "C" {
|
||||
/// <summary>
|
||||
/// Gets product-specific properties.
|
||||
/// </summary>
|
||||
/// <param name="ppPropeties">A pointer to an instance of <see cref="ISetupPropertyStore"/>. This may be NULL if no properties are defined.</param>
|
||||
/// <param name="ppProperties">A pointer to an instance of <see cref="ISetupPropertyStore"/>. This may be NULL if no properties are defined.</param>
|
||||
/// <returns>Standard HRESULT indicating success or failure, including E_FILENOTFOUND if the instance state does not exist.</returns>
|
||||
STDMETHOD(GetProperties)(
|
||||
_Outptr_result_maybenull_ ISetupPropertyStore** ppProperties
|
||||
|
@ -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), "");
|
||||
|
@ -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 {
|
||||
|
@ -492,7 +492,7 @@ static std::string ArchiveName;
|
||||
static std::vector<std::unique_ptr<MemoryBuffer>> ArchiveBuffers;
|
||||
static std::vector<std::unique_ptr<object::Archive>> 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<StringRef> Members;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -40,7 +40,7 @@ const a = struct {
|
||||
}
|
||||
};
|
||||
|
||||
test "intialization" {
|
||||
test "initialization" {
|
||||
var t = a.init();
|
||||
try std.testing.expect(t.foo.len == 0);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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 {
|
||||
{
|
||||
|
@ -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();
|
||||
\\}
|
||||
|
@ -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 <stdlib.h>
|
||||
\\static int hash_binary(int k)
|
||||
\\{
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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 {};
|
||||
\\};
|
||||
|
Loading…
Reference in New Issue
Block a user