1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-26 00:10:27 +00:00

Add :mingw value when getting the OS setting when compiled with mingw.

This commit is contained in:
bakpakin 2023-01-21 11:50:03 -06:00
parent 8ee5942481
commit a490937cd9
4 changed files with 18 additions and 2 deletions

View File

@ -1178,7 +1178,13 @@ static Janet janet_ffi_win64(JanetFFISignature *signature, void *function_pointe
/* hack to get proper stack placement and avoid clobbering from logic above - shift stack down, otherwise we have issues. /* hack to get proper stack placement and avoid clobbering from logic above - shift stack down, otherwise we have issues.
* Technically, this writes into 16 bytes of unallocated stack memory */ * Technically, this writes into 16 bytes of unallocated stack memory */
#ifdef JANET_MINGW
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#endif
if (stack_size) memmove(stack - stack_shift, stack, stack_size); if (stack_size) memmove(stack - stack_shift, stack, stack_size);
#ifdef JANET_MINGW
#pragma GCC diagnostic pop
#endif
switch (signature->variant) { switch (signature->variant) {
default: default:

View File

@ -118,6 +118,7 @@ JANET_CORE_FN(os_which,
"(os/which)", "(os/which)",
"Check the current operating system. Returns one of:\n\n" "Check the current operating system. Returns one of:\n\n"
"* :windows\n\n" "* :windows\n\n"
"* :mingw\n\n"
"* :macos\n\n" "* :macos\n\n"
"* :web - Web assembly (emscripten)\n\n" "* :web - Web assembly (emscripten)\n\n"
"* :linux\n\n" "* :linux\n\n"
@ -130,6 +131,8 @@ JANET_CORE_FN(os_which,
(void) argv; (void) argv;
#if defined(JANET_OS_NAME) #if defined(JANET_OS_NAME)
return janet_ckeywordv(janet_stringify(JANET_OS_NAME)); return janet_ckeywordv(janet_stringify(JANET_OS_NAME));
#elif defined(JANET_MINGW)
return janet_ckeywordv("mingw");
#elif defined(JANET_WINDOWS) #elif defined(JANET_WINDOWS)
return janet_ckeywordv("windows"); return janet_ckeywordv("windows");
#elif defined(JANET_APPLE) #elif defined(JANET_APPLE)
@ -445,7 +448,9 @@ typedef struct {
static JanetEVGenericMessage janet_proc_wait_subr(JanetEVGenericMessage args) { static JanetEVGenericMessage janet_proc_wait_subr(JanetEVGenericMessage args) {
JanetProc *proc = (JanetProc *) args.argp; JanetProc *proc = (JanetProc *) args.argp;
WaitForSingleObject(proc->pHandle, INFINITE); WaitForSingleObject(proc->pHandle, INFINITE);
GetExitCodeProcess(proc->pHandle, (LPDWORD) &args.tag); DWORD exitcode = 0;
GetExitCodeProcess(proc->pHandle, &exitcode);
args.tag = (int32_t) exitcode;
return args; return args;
} }

View File

@ -97,6 +97,11 @@ extern "C" {
#define JANET_MSVC #define JANET_MSVC
#endif #endif
/* Check Mingw 32-bit and 64-bit */
#ifdef __MINGW32__
#define JANET_MINGW
#endif
/* Check 64-bit vs 32-bit */ /* Check 64-bit vs 32-bit */
#if ((defined(__x86_64__) || defined(_M_X64)) \ #if ((defined(__x86_64__) || defined(_M_X64)) \
&& (defined(JANET_POSIX) || defined(JANET_WINDOWS))) \ && (defined(JANET_POSIX) || defined(JANET_WINDOWS))) \

View File

@ -144,7 +144,7 @@
(assert (< 1000 1e23) "greater than immediate 2") (assert (< 1000 1e23) "greater than immediate 2")
# os/execute with environment variables # os/execute with environment variables
(assert (= 0 (os/execute [(dyn :executable) "-e" "(+ 1 2 3)"] :pe {"HELLO" "WORLD"})) "os/execute with env") (assert (= 0 (os/execute [(dyn :executable) "-e" "(+ 1 2 3)"] :pe (merge (os/environ) {"HELLO" "WORLD"}))) "os/execute with env")
# Regression #638 # Regression #638
(compwhen (compwhen