mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-18 11:52:22 -07:00
Merge remote-tracking branch 'offical/master'
This commit is contained in:
@@ -1476,6 +1476,7 @@ gb_internal void init_build_context(TargetMetrics *cross_target, Subtarget subta
|
||||
bc->link_flags = str_lit("/machine:x64 ");
|
||||
break;
|
||||
case TargetOs_darwin:
|
||||
bc->link_flags = str_lit("-arch x86_64 ");
|
||||
break;
|
||||
case TargetOs_linux:
|
||||
bc->link_flags = str_lit("-arch x86-64 ");
|
||||
|
||||
@@ -2248,6 +2248,17 @@ gb_internal void check_assignment_error_suggestion(CheckerContext *c, Operand *o
|
||||
gbString s = expr_to_string(c->type_hint_expr);
|
||||
error_line("\tSuggestion: make sure that `%s` is attached to the compound literal directly\n", s);
|
||||
gb_string_free(s);
|
||||
} else if (is_type_pointer(type) &&
|
||||
o->mode == Addressing_Variable &&
|
||||
are_types_identical(type_deref(type), o->type)) {
|
||||
gbString s = expr_to_string(o->expr);
|
||||
error_line("\tSuggestion: Did you mean `&%s`\n", s);
|
||||
gb_string_free(s);
|
||||
} else if (is_type_pointer(o->type) &&
|
||||
are_types_identical(type_deref(o->type), type)) {
|
||||
gbString s = expr_to_string(o->expr);
|
||||
error_line("\tSuggestion: Did you mean `%s^`\n", s);
|
||||
gb_string_free(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1661,6 +1661,8 @@ gb_internal void check_range_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags)
|
||||
defer (gb_string_free(s));
|
||||
defer (gb_string_free(t));
|
||||
|
||||
ERROR_BLOCK();
|
||||
|
||||
error(operand.expr, "Cannot iterate over '%s' of type '%s'", s, t);
|
||||
|
||||
if (rs->vals.count == 1) {
|
||||
|
||||
+1
-1
@@ -460,7 +460,7 @@ gb_internal void syntax_error_va(TokenPos const &pos, TokenPos end, char const *
|
||||
error_out_coloured("Syntax Error: ", TerminalStyle_Normal, TerminalColour_Red);
|
||||
error_out_va(fmt, va);
|
||||
error_out("\n");
|
||||
// show_error_on_line(pos, end);
|
||||
show_error_on_line(pos, end);
|
||||
} else if (pos.line == 0) {
|
||||
error_out_empty();
|
||||
error_out_coloured("Syntax Error: ", TerminalStyle_Normal, TerminalColour_Red);
|
||||
|
||||
+19
-11
@@ -876,7 +876,7 @@ namespace lbAbiAmd64SysV {
|
||||
if (types.count == 1) {
|
||||
return types[0];
|
||||
}
|
||||
return LLVMStructTypeInContext(c, types.data, cast(unsigned)types.count, false);
|
||||
return LLVMStructTypeInContext(c, types.data, cast(unsigned)types.count, true);
|
||||
}
|
||||
|
||||
gb_internal void classify_with(LLVMTypeRef t, Array<RegClass> *cls, i64 ix, i64 off) {
|
||||
@@ -1183,17 +1183,25 @@ namespace lbAbiArm64 {
|
||||
i64 size = lb_sizeof(type);
|
||||
if (size <= 16) {
|
||||
LLVMTypeRef cast_type = nullptr;
|
||||
if (size <= 1) {
|
||||
cast_type = LLVMIntTypeInContext(c, 8);
|
||||
} else if (size <= 2) {
|
||||
cast_type = LLVMIntTypeInContext(c, 16);
|
||||
} else if (size <= 4) {
|
||||
cast_type = LLVMIntTypeInContext(c, 32);
|
||||
} else if (size <= 8) {
|
||||
cast_type = LLVMIntTypeInContext(c, 64);
|
||||
if (size <= 8) {
|
||||
cast_type = LLVMIntTypeInContext(c, cast(unsigned)(size*8));
|
||||
} else {
|
||||
unsigned count = cast(unsigned)((size+7)/8);
|
||||
cast_type = llvm_array_type(LLVMIntTypeInContext(c, 64), count);
|
||||
|
||||
LLVMTypeRef llvm_i64 = LLVMIntTypeInContext(c, 64);
|
||||
LLVMTypeRef *types = gb_alloc_array(temporary_allocator(), LLVMTypeRef, count);
|
||||
|
||||
i64 size_copy = size;
|
||||
for (unsigned i = 0; i < count; i++) {
|
||||
if (size_copy >= 8) {
|
||||
types[i] = llvm_i64;
|
||||
} else {
|
||||
types[i] = LLVMIntTypeInContext(c, 8*cast(unsigned)size_copy);
|
||||
}
|
||||
size_copy -= 8;
|
||||
}
|
||||
GB_ASSERT(size_copy <= 0);
|
||||
cast_type = LLVMStructTypeInContext(c, types, count, true);
|
||||
}
|
||||
args[i] = lb_arg_type_direct(type, cast_type, nullptr, nullptr);
|
||||
} else {
|
||||
@@ -1318,7 +1326,7 @@ namespace lbAbiWasm {
|
||||
// ignore padding
|
||||
LLVMStructGetTypeAtIndex(type, 2)
|
||||
};
|
||||
LLVMTypeRef new_type = LLVMStructTypeInContext(c, types, gb_count_of(types), false);
|
||||
LLVMTypeRef new_type = LLVMStructTypeInContext(c, types, gb_count_of(types), true);
|
||||
return lb_arg_type_direct(type, new_type, nullptr, nullptr);
|
||||
} else {
|
||||
return is_struct(c, type, calling_convention);
|
||||
|
||||
@@ -5440,14 +5440,27 @@ gb_internal AstPackage *try_add_import_path(Parser *p, String path, String const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
isize files_with_ext = 0;
|
||||
isize files_to_reserve = 1; // always reserve 1
|
||||
for (FileInfo fi : list) {
|
||||
String name = fi.name;
|
||||
String ext = path_extension(name);
|
||||
if (ext == FILE_EXT) {
|
||||
files_with_ext += 1;
|
||||
}
|
||||
if (ext == FILE_EXT && !is_excluded_target_filename(name)) {
|
||||
files_to_reserve += 1;
|
||||
}
|
||||
}
|
||||
if (files_with_ext == 0 || files_to_reserve == 1) {
|
||||
if (files_with_ext != 0) {
|
||||
syntax_error(pos, "Directory contains no .odin files for the specified platform: %.*s", LIT(rel_path));
|
||||
} else {
|
||||
syntax_error(pos, "Empty directory that contains no .odin files: %.*s", LIT(rel_path));
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
array_reserve(&pkg->files, files_to_reserve);
|
||||
for (FileInfo fi : list) {
|
||||
|
||||
Vendored
+10
@@ -366,6 +366,16 @@ foreign lib {
|
||||
// Returns `true` on success, `false`on failure.
|
||||
node_set_on_enter :: proc(node: ^Node, on_enter: cstring) -> (success: b32) ---
|
||||
|
||||
// Returns the literal "on exit" text for a custom 'node', or
|
||||
// an empty string if no on_exit is set. Returns NULL if
|
||||
// called on a non-custom node.
|
||||
node_get_on_exit :: proc(node: ^Node) -> (on_exit: cstring) ---
|
||||
|
||||
// Sets the literal text to render "on exit" for a custom 'node'.
|
||||
// Any children of the node will be rendered before this text.
|
||||
// Returns 1 on success 0 on failure.
|
||||
node_set_on_exit :: proc(node: ^Node, on_exit: cstring) -> (success: b32) ---
|
||||
|
||||
// Returns the line on which `node` begins.
|
||||
node_get_start_line :: proc(node: ^Node) -> (line: c.int) ---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user