Reviewers: net147_gmail.com,

Message:
Please confirm that this patch indeed fixes compilation on MinGW-w64.

Description:
Fix compilation with MinGW-w64.


BUG=v8:1943
TEST=


Please review this at https://chromiumcodereview.appspot.com/9428027/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M SConstruct
  M src/globals.h
  M src/platform-win32.cc
  M src/win32-headers.h
  M src/x64/cpu-x64.cc


Index: SConstruct
diff --git a/SConstruct b/SConstruct
index d4eaebef8debd1fd459ddf6bd662e8c46ede37e3..1043b51ec4b4d908fa49c7bddf47a0cc23f9093d 100644
--- a/SConstruct
+++ b/SConstruct
@@ -299,7 +299,7 @@ V8_EXTRA_FLAGS = {
                        '-Wnon-virtual-dtor']
     },
     'os:win32': {
-      'WARNINGFLAGS': ['-pedantic', '-Wno-long-long']
+ 'WARNINGFLAGS': ['-pedantic', '-Wno-long-long', '-Wno-pedantic-ms-format']
     },
     'os:linux': {
       'WARNINGFLAGS': ['-pedantic'],
Index: src/globals.h
diff --git a/src/globals.h b/src/globals.h
index 30b676c8bd155d71503f7039ae5ba52b56f78447..7970f4ce2966e28ca87198fe16e0080a6b378402 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -191,6 +191,11 @@ typedef byte* Address;
 #define V8_PTR_PREFIX ""
 #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.
 // Usage: instead of writing 0x1234567890123456
 //      write V8_2PART_UINT64_C(0x12345678,90123456);
Index: src/platform-win32.cc
diff --git a/src/platform-win32.cc b/src/platform-win32.cc
index f16b5e74fda8705cd36db689eab1d2e94d0f0f17..dcfb679fd8687bcceb37c8e152b9416f2dbd9402 100644
--- a/src/platform-win32.cc
+++ b/src/platform-win32.cc
@@ -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) {
   *pFile = fopen(filename, mode);
   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 STRUNCATE 80

+#endif  // __MINGW64_VERSION_MAJOR
+
+
 int _vsnprintf_s(char* buffer, size_t sizeOfBuffer, size_t count,
                  const char* format, va_list argptr) {
   ASSERT(count == _TRUNCATE);
Index: src/win32-headers.h
diff --git a/src/win32-headers.h b/src/win32-headers.h
index ca1b1d8b8e005b453f65e0a99b3b613fb5520a9b..1f0ee48532ae58786037bffad7236df2f8cc0dc8 100644
--- a/src/win32-headers.h
+++ b/src/win32-headers.h
@@ -64,10 +64,10 @@
 #undef _WIN32_WINNT
 #define _WIN32_WINNT 0x501
 #endif  // __MINGW32__
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR)
 #include <dbghelp.h>  // For SymLoadModule64 and al.
 #include <errno.h>  // For STRUNCATE
-#endif  // __MINGW32__
+#endif  // !defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR)
 #include <limits.h>  // For INT_MAX and al.
 #include <tlhelp32.h>  // For Module32First and al.

Index: src/x64/cpu-x64.cc
diff --git a/src/x64/cpu-x64.cc b/src/x64/cpu-x64.cc
index 69e77eee9d06325c1f74567a7f78b234fd917b9d..04811686fc9225643fc26fec5848382642cba822 100644
--- a/src/x64/cpu-x64.cc
+++ b/src/x64/cpu-x64.cc
@@ -27,7 +27,7 @@

 // CPU specific code for x64 independent of OS goes here.

-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__MINGW64__)
 #include "third_party/valgrind/valgrind.h"
 #endif



--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev

Reply via email to