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.
* 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);
#ifdef JANET_MINGW
#pragma GCC diagnostic pop
#endif
switch (signature->variant) {
default:

View File

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

View File

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

View File

@ -144,7 +144,7 @@
(assert (< 1000 1e23) "greater than immediate 2")
# 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
(compwhen