Skip to content

Commit

Permalink
Merge pull request MLton#577 from MatthewFluet/mingw-prototypes-update
Browse files Browse the repository at this point in the history
MinGW prototypes update

Various updates to quell compilation errors with new MinGW prototypes for POSIX functions.
  • Loading branch information
MatthewFluet authored Aug 9, 2024
2 parents 7dc0718 + bc6937b commit 680bfcc
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 22 deletions.
4 changes: 2 additions & 2 deletions runtime/basis/MLton/Process/spawne.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ C_Errno_t(C_PId_t) MLton_Process_spawne (NullString8_t pNStr,
eSaved = env[eLen - 1];
env[eLen - 1] = NULL;
res = spawnve (SPAWN_MODE, path,
(const char * const *)args,
(const char * const *)env);
(char * const *)args,
(char * const *)env);
/* spawnve failed */
args[aLen - 1] = aSaved;
env[eLen - 1] = eSaved;
Expand Down
2 changes: 1 addition & 1 deletion runtime/basis/MLton/Process/spawnp.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ C_Errno_t(C_PId_t) MLton_Process_spawnp (NullString8_t pNStr,
aSaved = args[aLen - 1];
args[aLen - 1] = NULL;
res = spawnvp (SPAWN_MODE, path,
(const char * const *)args);
(char * const *)args);
/* spawnvp failed */
args[aLen - 1] = aSaved;
return (C_Errno_t(C_PId_t))res;
Expand Down
8 changes: 4 additions & 4 deletions runtime/basis/Net/Socket/Socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Socket_Ctl_getSockOptC_Int (C_Sock_t s, C_Int_t level, C_Int_t optname,
int out;

MLton_initSockets ();
out = getsockopt (s, level, optname, optval, &optlen);
out = getsockopt (s, level, optname, (void*)optval, &optlen);
assert (optlen == sizeof(int));
if (out == -1) MLton_fixSocketErrno ();

Expand All @@ -165,7 +165,7 @@ Socket_Ctl_setSockOptC_Int (C_Sock_t s, C_Int_t level, C_Int_t optname,
int out;

MLton_initSockets ();
out = setsockopt (s, level, optname, &optval, optlen);
out = setsockopt (s, level, optname, (void*)&optval, optlen);
if (out == -1) MLton_fixSocketErrno ();

return out;
Expand All @@ -179,7 +179,7 @@ Socket_Ctl_getSockOptC_Linger (C_Sock_t s, C_Int_t level, C_Int_t optname,
int out;

MLton_initSockets ();
out = getsockopt (s, level, optname, &optval, &optlen);
out = getsockopt (s, level, optname, (void*)&optval, &optlen);
assert (optlen == sizeof(struct linger));
*((int*)optval_l_onoff) = optval.l_onoff;
*((int*)optval_l_linger) = optval.l_linger;
Expand All @@ -198,7 +198,7 @@ Socket_Ctl_setSockOptC_Linger (C_Sock_t s, C_Int_t level, C_Int_t optname,
MLton_initSockets ();
optval.l_onoff = optval_l_onoff;
optval.l_linger = optval_l_linger;
out = setsockopt (s, level, optname, &optval, optlen);
out = setsockopt (s, level, optname, (void*)&optval, optlen);
if (out == -1) MLton_fixSocketErrno ();

return out;
Expand Down
4 changes: 2 additions & 2 deletions runtime/basis/Posix/Process/exece.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ C_Errno_t(C_Int_t) Posix_Process_exece (NullString8_t pNStr,
eLen = GC_getSequenceLength((pointer)eStr);
eSaved = env[eLen - 1];
env[eLen - 1] = NULL;
res = EXECVE (path,
(char * const *)args,
res = execve (path,
(char * const *)args,
(char * const *)env);
/* exece failed */
args[aLen - 1] = aSaved;
Expand Down
2 changes: 1 addition & 1 deletion runtime/basis/Posix/Process/execp.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ C_Errno_t(C_Int_t) Posix_Process_execp (NullString8_t fNStr,
aLen = GC_getSequenceLength((pointer)aStr);
aSaved = args[aLen - 1];
args[aLen - 1] = NULL;
res = EXECVP (file,
res = execvp (file,
(char * const *)args);
/* execp failed */
args[aLen - 1] = aSaved;
Expand Down
10 changes: 1 addition & 9 deletions runtime/platform.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2010,2012,2016,2019,2021 Matthew Fluet.
/* Copyright (C) 2010,2012,2016,2019,2021,2024 Matthew Fluet.
* Copyright (C) 1999-2008 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
Expand Down Expand Up @@ -55,14 +55,6 @@
#error HAS_TIME_PROFILING not defined
#endif

#ifndef EXECVP
#define EXECVP execvp
#endif

#ifndef EXECVE
#define EXECVE execve
#endif


#define FE_NOSUPPORT -1

Expand Down
3 changes: 0 additions & 3 deletions runtime/platform/mingw.h
Original file line number Diff line number Diff line change
Expand Up @@ -821,9 +821,6 @@ MLTON_WRAPPER int MLton_uname (struct utsname *buf);
/* Posix.Process */
/* ------------------------------------------------- */

#define EXECVE(path, args, env) \
execve (path, (const char* const*)args, (const char* const*)env)
#define EXECVP(file, args) execvp (file, (const char* const*) args)
#define SPAWN_MODE _P_NOWAIT

/* Windows exit status comes from:
Expand Down

0 comments on commit 680bfcc

Please sign in to comment.