1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-10 19:29:45 +00:00

Support both MinGW and MinGW-w64.

This commit is contained in:
Oliver Schmidt 2014-03-05 22:28:38 +01:00
parent 0f6564cb4e
commit ee9c42bbf5
3 changed files with 18 additions and 6 deletions

View File

@ -41,8 +41,20 @@
#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
@ -375,7 +387,7 @@ static void ExecProgram (CmdDesc* Cmd)
}
/* 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) {

View File

@ -54,7 +54,7 @@
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

View File

@ -62,7 +62,7 @@
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
@ -81,7 +81,7 @@ int spawnvp (int Mode attribute ((unused)), const char* File, const char* const
} 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));
}