From 51b14b1f53bfb6c5c10288ab3a6c8c4a86fb70b9 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 1 Sep 2016 17:12:12 +0300 Subject: [PATCH] Avoid compiler warnings with MinGW64 GCC 6 * nt/inc/ms-w32.h (execve) [MINGW_W64]: Make the prototype match the GCC 6 builtin, to avoid warnings. For more details, see http://lists.gnu.org/archive/html/emacs-devel/2016-08/msg00721.html. --- nt/inc/ms-w32.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h index bb8ae6ad8f9..12cd0810054 100644 --- a/nt/inc/ms-w32.h +++ b/nt/inc/ms-w32.h @@ -293,7 +293,16 @@ extern int sys_umask (int); #define execvp _execvp #include /* for intptr_t */ extern intptr_t _execvp (const char *, char **); +#ifdef MINGW_W64 +/* MinGW64 GCC 6 has a builtin execve with the prototype shown below. + The return value is wrong, and is a bug in GCC, but using the + correct prototype causes GCC to emit warnings. Fortunately, execve + is not used in the MinGW build, but the code that references it is + still compiled. */ +extern int execve (const char *, char * const *, char * const *); +#else extern intptr_t execve (const char *, char * const *, char * const *); +#endif #define fdatasync _commit #define fdopen _fdopen #define fsync _commit -- 2.39.2