MinGW fixes (system return and vsnprintf)

The MinGW system() implementation appears to return the straight
return value instead of the waitpid() like result that more
normal systems return. Because of this just return the system()
result without processing for MinGW compilations.

Older version of the MinGW runtime (pre 3.14) just used the
underlying vsnprintf(). Which has some problems. The 3.14 version
has some nice improvements, but it has a sever bug when processing
"%*.*f", -1, -1, <some_real_value>.  Because of this we need to use
the underlying version without the enhancements for now.
This commit is contained in:
Cary R 2008-05-20 15:07:35 -07:00 committed by Stephen Williams
parent 568e601212
commit f418bea775
2 changed files with 12 additions and 0 deletions

View File

@ -329,6 +329,9 @@ static int t_default(char*cmd, unsigned ncmd)
remove(source_path);
if ( ! getenv("IVERILOG_ICONFIG"))
remove(iconfig_path);
#ifdef __MINGW32__ /* MinGW just returns the exit status, so return it! */
return rc;
#else
if (rc != 0) {
if (rc == 127) {
fprintf(stderr, "Failed to execute: %s\n", cmd);
@ -343,6 +346,7 @@ static int t_default(char*cmd, unsigned ncmd)
}
return 0;
#endif
}

View File

@ -152,7 +152,15 @@ vpi_mcd_vprintf(PLI_UINT32 mcd, const char*fmt, va_list ap)
mcd, fmt);
}
#ifdef __MINGW32__
/*
* The MinGW runtime (version 3.14) fixes some things, but breaks
* %f for us, so we have to us the underlying version.
*/
rc = _vsnprintf(buffer, sizeof buffer, fmt, ap);
#else
rc = vsnprintf(buffer, sizeof buffer, fmt, ap);
#endif
for(int i = 0; i < 31; i++) {
if((mcd>>i) & 1) {