From 706d0c3a9172f90d2ace7176d7d4a22d74cc4991 Mon Sep 17 00:00:00 2001 From: Ricardo Silva Date: Fri, 2 Sep 2022 11:30:14 +0100 Subject: [PATCH 1/4] Fix allocation on darwin `absolute_path_from_handle` --- core/os/os_darwin.odin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/os/os_darwin.odin b/core/os/os_darwin.odin index b5e67558c..5c2cf8ec2 100644 --- a/core/os/os_darwin.odin +++ b/core/os/os_darwin.odin @@ -596,7 +596,7 @@ absolute_path_from_handle :: proc(fd: Handle) -> (string, Errno) { return "", Errno(get_last_error()) } - path := strings.clone_from_cstring(cstring(&buf[0]), context.temp_allocator) + path := strings.clone_from_cstring(cstring(&buf[0])) return path, ERROR_NONE } From 0efc79bcb9c97857c50665dd487fb72afa6a4897 Mon Sep 17 00:00:00 2001 From: Joakim Hentula Date: Fri, 2 Sep 2022 13:30:45 +0100 Subject: [PATCH 2/4] Add GL_DEBUG config that falls back to ODIN_DEBUG to preserve previous behaviour, but allows debug builds without OpenGL debug features --- vendor/OpenGL/constants.odin | 2 ++ vendor/OpenGL/helpers.odin | 2 +- vendor/OpenGL/wrappers.odin | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/vendor/OpenGL/constants.odin b/vendor/OpenGL/constants.odin index 28c923903..c7d8b9542 100644 --- a/vendor/OpenGL/constants.odin +++ b/vendor/OpenGL/constants.odin @@ -1,5 +1,7 @@ package odin_gl +GL_DEBUG :: #config(GL_DEBUG, ODIN_DEBUG) + FALSE :: false TRUE :: true diff --git a/vendor/OpenGL/helpers.odin b/vendor/OpenGL/helpers.odin index 927129130..61c68ace5 100644 --- a/vendor/OpenGL/helpers.odin +++ b/vendor/OpenGL/helpers.odin @@ -46,7 +46,7 @@ get_last_error_message :: proc() -> (compile_message: string, compile_type: Shad // Shader checking and linking checking are identical // except for calling differently named GL functions // it's a bit ugly looking, but meh -when ODIN_DEBUG { +when GL_DEBUG { import "core:runtime" @private diff --git a/vendor/OpenGL/wrappers.odin b/vendor/OpenGL/wrappers.odin index b62ed216b..ba6ff369c 100644 --- a/vendor/OpenGL/wrappers.odin +++ b/vendor/OpenGL/wrappers.odin @@ -2,7 +2,7 @@ package odin_gl #assert(size_of(bool) == size_of(u8)) -when !ODIN_DEBUG { +when !GL_DEBUG { // VERSION_1_0 CullFace :: proc "c" (mode: u32) { impl_CullFace(mode) } FrontFace :: proc "c" (mode: u32) { impl_FrontFace(mode) } From c2809c2948cecffc128472ed6a0abe9bfd0c3a26 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Fri, 2 Sep 2022 16:23:16 +0100 Subject: [PATCH 3/4] Improve basic escape analysis --- src/check_stmt.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index d741ceabf..9e4504dc1 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -1400,7 +1400,7 @@ bool check_expr_is_stack_variable(Ast *expr) { expr = unparen_expr(expr); Entity *e = entity_of_node(expr); if (e && e->kind == Entity_Variable) { - if (e->flags & (EntityFlag_Static|EntityFlag_Using)) { + if (e->flags & (EntityFlag_Static|EntityFlag_Using|EntityFlag_ImplicitReference|EntityFlag_ForValue)) { // okay } else if (e->Variable.thread_local_model.len != 0) { // okay @@ -1941,13 +1941,10 @@ void check_stmt_internal(CheckerContext *ctx, Ast *node, u32 flags) { } if (found == nullptr) { entity = alloc_entity_variable(ctx->scope, token, type, EntityState_Resolved); + entity->flags |= EntityFlag_ForValue; entity->flags |= EntityFlag_Value; - if (i == addressable_index) { - if (use_by_reference_for_value) { - entity->flags &= ~EntityFlag_Value; - } else { - entity->flags |= EntityFlag_ForValue; - } + if (i == addressable_index && use_by_reference_for_value) { + entity->flags &= ~EntityFlag_Value; } if (is_soa) { if (i == 0) { From 4c857bf031be285e08ce64f0a89bbee5ee373d4b Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Sat, 3 Sep 2022 16:59:58 +0200 Subject: [PATCH 4/4] FreeBSD: Autodetect LLVM version. --- build_odin.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/build_odin.sh b/build_odin.sh index b8cd09c54..62d8a0f59 100755 --- a/build_odin.sh +++ b/build_odin.sh @@ -50,7 +50,19 @@ config_darwin() { } config_freebsd() { - : ${LLVM_CONFIG=/usr/local/bin/llvm-config11} + : ${LLVM_CONFIG=} + + if [ ! "$LLVM_CONFIG" ]; then + if which llvm-config11 > /dev/null 2>&1; then + LLVM_CONFIG=llvm-config11 + elif which llvm-config12 > /dev/null 2>&1; then + LLVM_CONFIG=llvm-config12 + elif which llvm-config13 > /dev/null 2>&1; then + LLVM_CONFIG=llvm-config13 + else + panic "Unable to find LLVM-config" + fi + fi CXXFLAGS="$CXXFLAGS $($LLVM_CONFIG --cxxflags --ldflags)" LDFLAGS="$LDFLAGS $($LLVM_CONFIG --libs core native --system-libs)"