diff --git a/src/build_settings.cpp b/src/build_settings.cpp index 3c822e295..4be189cf1 100644 --- a/src/build_settings.cpp +++ b/src/build_settings.cpp @@ -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 "); diff --git a/src/check_expr.cpp b/src/check_expr.cpp index e9a6f5122..8fb2cf36b 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -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); } } diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index 4280e7578..7cccab226 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -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) { diff --git a/src/error.cpp b/src/error.cpp index b96719420..2458061c2 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -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); diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp index 24e86fa64..375235752 100644 --- a/src/llvm_abi.cpp +++ b/src/llvm_abi.cpp @@ -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 *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); diff --git a/src/parser.cpp b/src/parser.cpp index eb9e73342..6a7be8a7c 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -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) { diff --git a/vendor/commonmark/cmark.odin b/vendor/commonmark/cmark.odin index 3563dff16..9ad71da3f 100644 --- a/vendor/commonmark/cmark.odin +++ b/vendor/commonmark/cmark.odin @@ -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) ---