This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Silence execvp argv warning in gcc.c on MinGW
- From: "Aaron W. LaFramboise" <aaronavay62 at aaronwl dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Danny Smith <dannysmith at clear dot net dot nz>
- Date: Sun, 17 Aug 2008 01:01:16 -0500
- Subject: [PATCH] Silence execvp argv warning in gcc.c on MinGW
Annoyingly, Microsoft's prototype for execvp() differs from POSIX; the
mingw-runtime headers are also different in this same way.
process.h:
> int execvp(const char *path, char * const *argv);
This causes a warning that breaks bootstrap with --enable-werror. The
following patch will silence this warning, at a cost of some uglification.
Another way to fix this would be to change this in the mingw-runtime
headers, but then compatibility with MS's runtime is degraded, so I
think working around it in GCC is the best option.
This was tested by bootstrapping on i386-pc-mingw32.
OK to commit?
2008-05-12 Aaron W. LaFramboise <aaronavay62@aaronwl.com>
* gcc.c [_MINGW32] (process_command): Cast execvp argv.
Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c (revision 139148)
+++ gcc/gcc.c (working copy)
@@ -3423,7 +3423,9 @@ process_command (int argc, const char **
new_argv = XDUPVEC (char *, argv, argc + 1);
new_argv[0] = new_argv0;
- execvp (new_argv0, new_argv);
+#ifdef _MINGW32
+ execvp (new_argv0, (char *const *)new_argv);
+#endif
fatal ("couldn't run '%s': %s", new_argv0, xstrerror (errno));
}