Fix compilation with MinGW-w64.

BUG=v8:1943
TEST=

Review URL: https://chromiumcodereview.appspot.com/9428027
Patch from Jonathan Liu <net147@gmail.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10793 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yangguo@chromium.org 2012-02-22 12:26:36 +00:00
parent 5632b6d005
commit 0f348c9208
6 changed files with 25 additions and 14 deletions

View File

@ -28,6 +28,7 @@ Jan de Mooij <jandemooij@gmail.com>
Jay Freeman <saurik@saurik.com> Jay Freeman <saurik@saurik.com>
Joel Stanley <joel.stan@gmail.com> Joel Stanley <joel.stan@gmail.com>
John Jozwiak <jjozwiak@codeaurora.org> John Jozwiak <jjozwiak@codeaurora.org>
Jonathan Liu <net147@gmail.com>
Kun Zhang <zhangk@codeaurora.org> Kun Zhang <zhangk@codeaurora.org>
Martyn Capewell <martyn.capewell@arm.com> Martyn Capewell <martyn.capewell@arm.com>
Matt Hanselman <mjhanselman@gmail.com> Matt Hanselman <mjhanselman@gmail.com>

View File

@ -1,4 +1,4 @@
# Copyright 2011 the V8 project authors. All rights reserved. # Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are # modification, are permitted provided that the following conditions are
# met: # met:
@ -300,7 +300,7 @@ V8_EXTRA_FLAGS = {
'-Wnon-virtual-dtor'] '-Wnon-virtual-dtor']
}, },
'os:win32': { 'os:win32': {
'WARNINGFLAGS': ['-pedantic', '-Wno-long-long'] 'WARNINGFLAGS': ['-pedantic', '-Wno-long-long', '-Wno-pedantic-ms-format']
}, },
'os:linux': { 'os:linux': {
'WARNINGFLAGS': ['-pedantic'], 'WARNINGFLAGS': ['-pedantic'],

View File

@ -1,4 +1,4 @@
// Copyright 2011 the V8 project authors. All rights reserved. // Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
@ -191,6 +191,11 @@ typedef byte* Address;
#define V8_PTR_PREFIX "" #define V8_PTR_PREFIX ""
#endif // V8_HOST_ARCH_64_BIT #endif // V8_HOST_ARCH_64_BIT
#ifdef __MINGW64__
#undef V8_PTR_PREFIX
#define V8_PTR_PREFIX "I64"
#endif // __MINGW64__
// The following macro works on both 32 and 64-bit platforms. // The following macro works on both 32 and 64-bit platforms.
// Usage: instead of writing 0x1234567890123456 // Usage: instead of writing 0x1234567890123456
// write V8_2PART_UINT64_C(0x12345678,90123456); // write V8_2PART_UINT64_C(0x12345678,90123456);

View File

@ -58,21 +58,26 @@ int localtime_s(tm* out_tm, const time_t* time) {
} }
// Not sure this the correct interpretation of _mkgmtime
time_t _mkgmtime(tm* timeptr) {
return mktime(timeptr);
}
int fopen_s(FILE** pFile, const char* filename, const char* mode) { int fopen_s(FILE** pFile, const char* filename, const char* mode) {
*pFile = fopen(filename, mode); *pFile = fopen(filename, mode);
return *pFile != NULL ? 0 : 1; return *pFile != NULL ? 0 : 1;
} }
#ifndef __MINGW64_VERSION_MAJOR
// Not sure this the correct interpretation of _mkgmtime
time_t _mkgmtime(tm* timeptr) {
return mktime(timeptr);
}
#define _TRUNCATE 0 #define _TRUNCATE 0
#define STRUNCATE 80 #define STRUNCATE 80
#endif // __MINGW64_VERSION_MAJOR
int _vsnprintf_s(char* buffer, size_t sizeOfBuffer, size_t count, int _vsnprintf_s(char* buffer, size_t sizeOfBuffer, size_t count,
const char* format, va_list argptr) { const char* format, va_list argptr) {
ASSERT(count == _TRUNCATE); ASSERT(count == _TRUNCATE);

View File

@ -1,4 +1,4 @@
// Copyright 2010 the V8 project authors. All rights reserved. // Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
@ -64,10 +64,10 @@
#undef _WIN32_WINNT #undef _WIN32_WINNT
#define _WIN32_WINNT 0x501 #define _WIN32_WINNT 0x501
#endif // __MINGW32__ #endif // __MINGW32__
#ifndef __MINGW32__ #if !defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR)
#include <dbghelp.h> // For SymLoadModule64 and al. #include <dbghelp.h> // For SymLoadModule64 and al.
#include <errno.h> // For STRUNCATE #include <errno.h> // For STRUNCATE
#endif // __MINGW32__ #endif // !defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR)
#include <limits.h> // For INT_MAX and al. #include <limits.h> // For INT_MAX and al.
#include <tlhelp32.h> // For Module32First and al. #include <tlhelp32.h> // For Module32First and al.

View File

@ -1,4 +1,4 @@
// Copyright 2011 the V8 project authors. All rights reserved. // Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
@ -27,7 +27,7 @@
// CPU specific code for x64 independent of OS goes here. // CPU specific code for x64 independent of OS goes here.
#ifdef __GNUC__ #if defined(__GNUC__) && !defined(__MINGW64__)
#include "third_party/valgrind/valgrind.h" #include "third_party/valgrind/valgrind.h"
#endif #endif