#else
# define NEED_SPAWN 1
#endif
-#if defined(_MSC_VER)
-# pragma warning(disable : 4996)
+
+/* GCC strictly follows http://c-faq.com/ansi/constmismatch.html and issues an
+ * 'incompatible pointer type' warning - that can't be suppressed via #pragma.
+ * The spawnvp() prototype of MinGW (http://www.mingw.org/) differs from the
+ * one of MinGW-w64 (http://mingw-w64.sourceforge.net/) regarding constness.
+ * So there's no alternative to actually distinguish these environments :-(
+ */
+#define SPAWN_ARGV_CONST_CAST
+#if defined(__MINGW32__)
+# include <_mingw.h>
+# if !defined(__MINGW64_VERSION_MAJOR)
+# undef SPAWN_ARGV_CONST_CAST
+# define SPAWN_ARGV_CONST_CAST (const char* const *)
+# endif
#endif
}
/* Call the program */
- Status = spawnvp (P_WAIT, Cmd->Name, (const char* const *) Cmd->Args);
+ Status = spawnvp (P_WAIT, Cmd->Name, SPAWN_ARGV_CONST_CAST Cmd->Args);
/* Check the result code */
if (Status < 0) {
int spawnvp (int Mode attribute ((unused)),
const char* File attribute ((unused)),
- const char* const argv [])
+ char* const argv [])
/* Execute the given program searching and wait til it terminates. The Mode
* argument is ignored (compatibility only). The result of the function is
* the return code of the program. The function will terminate the program
-int spawnvp (int Mode attribute ((unused)), const char* File, const char* const argv [])
+int spawnvp (int Mode attribute ((unused)), const char* File, char* const argv [])
/* Execute the given program searching and wait til it terminates. The Mode
* argument is ignored (compatibility only). The result of the function is
* the return code of the program. The function will terminate the program
} else if (pid == 0) {
/* The son - exec the program */
- if (execvp (File, (char* const *) argv) < 0) {
+ if (execvp (File, argv) < 0) {
Error ("Cannot exec `%s': %s", File, strerror (errno));
}