From a845a932f56205c77a4d01699ac5e48dab407eba Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Wed, 22 Jan 2025 00:34:36 +0100 Subject: [PATCH] Change _MSC_VER to PLATFORM_WINDOWS for some exec. Fix to nix. --- nix/default.nix | 2 +- releasenotes.md | 2 +- src/compiler/compiler.c | 2 +- src/utils/file_utils.c | 5 +++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/nix/default.nix b/nix/default.nix index df62a9fcc..6706ae2e3 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -58,7 +58,7 @@ in llvmPackages.stdenv.mkDerivation (finalAttrs: { checkPhase = '' runHook preCheck - ( cd ../resources/testproject; ../../build/c3c build ) + ( cd ../resources/testproject; ../../build/c3c build --trust=full ) ( cd ../test; python src/tester.py ../build/c3c test_suite ) runHook postCheck ''; diff --git a/releasenotes.md b/releasenotes.md index a4885839b..d1e2b60ba 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -19,7 +19,7 @@ - Fix `linux-crt` and `linux-crtbegin` not getting recognized as a project paramater - Fix dues to crash when converting a const vector to another vector #1864. - Filter `$exec` output from `\r`, which otherwise would cause a compiler assert #1867. -- Fixes to `"exec" use. +- Fixes to `"exec" use, including issue when compiling with MinGW ### Stdlib changes - Added '%h' and '%H' for printing out binary data in hexadecimal using the formatter. diff --git a/src/compiler/compiler.c b/src/compiler/compiler.c index e4922df87..af8421e83 100644 --- a/src/compiler/compiler.c +++ b/src/compiler/compiler.c @@ -1554,7 +1554,7 @@ File *compile_and_invoke(const char *file, const char *args, const char *stdin_d } DEBUG_LOG("EXEC OUT: %s", out); scratch_buffer_clear(); -#if (!_MSC_VER) +#if (!PLATFORM_WINDOWS) scratch_buffer_append("./"); #endif scratch_buffer_append(output); diff --git a/src/utils/file_utils.c b/src/utils/file_utils.c index d3cf6dad4..950731851 100644 --- a/src/utils/file_utils.c +++ b/src/utils/file_utils.c @@ -718,6 +718,7 @@ char *execute_cmd(const char *cmd, bool ignore_failure, const char *stdin_string bool execute_cmd_failable(const char *cmd, char **result, const char *stdin_string) { + DEBUG_LOG("Executing: %s", cmd); char buffer[BUFSIZE]; char *output = ""; FILE *process = NULL; @@ -726,7 +727,7 @@ bool execute_cmd_failable(const char *cmd, char **result, const char *stdin_stri { cmd = strdup(cmd); scratch_buffer_clear(); -#if (_MSC_VER) +#if (PLATFORM_WINDOWS) scratch_buffer_printf("%s < __c3temp.bin", cmd); #else scratch_buffer_printf("cat __c3temp.bin | %s", cmd); @@ -737,7 +738,7 @@ bool execute_cmd_failable(const char *cmd, char **result, const char *stdin_stri fputs(stdin_string, f); fclose(f); } -#if (_MSC_VER) +#if (PLATFORM_WINDOWS) if (!(process = _wpopen(win_utf8to16(cmd), L"rb"))) return false; #else if (!(process = popen(cmd, "r"))) return false;