Reviewers: Yang,
Message:
Hey Yang,
PTAL at this MinGW compile fix.
-- Benedikt
Description:
Fix compilation with recent MinGW64 versions.
Don't check for WIN32 define. Use V8_OS_* macros whenever
possible, and if not use _WIN32.
BUG=v8:2300
Please review this at https://codereview.chromium.org/23687003/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/arm/disasm-arm.cc
M src/ast.h
M src/flag-definitions.h
M src/gdb-jit.cc
M src/ia32/regexp-macro-assembler-ia32.cc
M src/mips/disasm-mips.cc
M src/platform.h
M src/preparser.h
M src/v8dll-main.cc
M src/win32-headers.h
M src/x64/regexp-macro-assembler-x64.cc
M test/cctest/test-api.cc
Index: src/arm/disasm-arm.cc
diff --git a/src/arm/disasm-arm.cc b/src/arm/disasm-arm.cc
index
ecdf638a1da36fafa12812c347e35cda684d8210..acffaa3f230ac5fe9fb639a34e0dbec3dc5cdc3c
100644
--- a/src/arm/disasm-arm.cc
+++ b/src/arm/disasm-arm.cc
@@ -50,9 +50,6 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
-#ifndef WIN32
-#include <stdint.h>
-#endif
#include "v8.h"
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index
0fac145264bc8abd784a5a7d66afc90a395a19e9..bf76cfacd27aaf16ef7ad5e577e00f3950b9517c
100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -123,10 +123,6 @@ namespace internal {
STATEMENT_NODE_LIST(V) \
EXPRESSION_NODE_LIST(V)
-#ifdef WIN32
-#undef Yield
-#endif
-
// Forward declarations
class AstConstructionVisitor;
template<class> class AstNodeFactory;
Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index
2d6863b40f9058d0285e9ce1ba699f2a8ee20811..0ea5a324264d5fcc31f36aad8380b8f9d4a89bfa
100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -620,7 +620,7 @@ DEFINE_int(testing_int_flag, 13, "testing_int_flag")
DEFINE_float(testing_float_flag, 2.5, "float-flag")
DEFINE_string(testing_string_flag, "Hello, world!", "string-flag")
DEFINE_int(testing_prng_seed, 42, "Seed used for threading test
randomness")
-#ifdef WIN32
+#ifdef _WIN32
DEFINE_string(testing_serialization_file, "C:\\Windows\\Temp\\serdes",
"file in which to testing_serialize heap")
#else
Index: src/gdb-jit.cc
diff --git a/src/gdb-jit.cc b/src/gdb-jit.cc
index
74db807fb35b1072fc2363ecfb5147e1869f547b..664673f3c97b8989b183bf67a5eca0ab73baed39
100644
--- a/src/gdb-jit.cc
+++ b/src/gdb-jit.cc
@@ -1872,7 +1872,7 @@ static void DestroyCodeEntry(JITCodeEntry* entry) {
static void RegisterCodeEntry(JITCodeEntry* entry,
bool dump_if_enabled,
const char* name_hint) {
-#if defined(DEBUG) && !defined(WIN32)
+#if defined(DEBUG) && !V8_OS_WIN
static int file_num = 0;
if (FLAG_gdbjit_dump && dump_if_enabled) {
static const int kMaxFileNameSize = 64;
Index: src/ia32/regexp-macro-assembler-ia32.cc
diff --git a/src/ia32/regexp-macro-assembler-ia32.cc
b/src/ia32/regexp-macro-assembler-ia32.cc
index
dfcc8695675617775e1422e921118f76b70b70bc..7d9e2f70527f6994470aa53a96dfce3c90a4c851
100644
--- a/src/ia32/regexp-macro-assembler-ia32.cc
+++ b/src/ia32/regexp-macro-assembler-ia32.cc
@@ -711,7 +711,7 @@ Handle<HeapObject>
RegExpMacroAssemblerIA32::GetCode(Handle<String> source) {
// position registers.
__ mov(Operand(ebp, kInputStartMinusOne), eax);
-#ifdef WIN32
+#if V8_OS_WIN
// Ensure that we write to each stack page, in order. Skipping a page
// on Windows can cause segmentation faults. Assuming page size is 4k.
const int kPageSize = 4096;
@@ -721,7 +721,7 @@ Handle<HeapObject>
RegExpMacroAssemblerIA32::GetCode(Handle<String> source) {
i += kRegistersPerPage) {
__ mov(register_location(i), eax); // One write every page.
}
-#endif // WIN32
+#endif // V8_OS_WIN
Label load_char_start_regexp, start_regexp;
// Load newline if index is at start, previous character otherwise.
Index: src/mips/disasm-mips.cc
diff --git a/src/mips/disasm-mips.cc b/src/mips/disasm-mips.cc
index
708df39d24ef855eb720433b85b6ebddd46b8279..691df940f2db366dbf6e9b0b3d9760fa71b0d07a
100644
--- a/src/mips/disasm-mips.cc
+++ b/src/mips/disasm-mips.cc
@@ -50,9 +50,6 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
-#ifndef WIN32
-#include <stdint.h>
-#endif
#include "v8.h"
Index: src/platform.h
diff --git a/src/platform.h b/src/platform.h
index
384ae15c96306a79a6916f871b054e376cfda10e..10a7e2c92e516be43f7286451b5de739ecedfe8e
100644
--- a/src/platform.h
+++ b/src/platform.h
@@ -44,6 +44,12 @@
#ifndef V8_PLATFORM_H_
#define V8_PLATFORM_H_
+#include <cstdarg>
+
+#include "lazy-instance.h"
+#include "utils.h"
+#include "v8globals.h"
+
#ifdef __sun
# ifndef signbit
namespace std {
@@ -55,19 +61,12 @@ int signbit(double x);
// GCC specific stuff
#ifdef __GNUC__
-// Needed for va_list on at least MinGW and Android.
-#include <stdarg.h>
-
#define __GNUC_VERSION__ (__GNUC__ * 10000 + __GNUC_MINOR__ * 100)
#endif // __GNUC__
-
-// Windows specific stuff.
-#ifdef WIN32
-
// Microsoft Visual C++ specific stuff.
-#ifdef _MSC_VER
+#if V8_CC_MSVC
#include "win32-headers.h"
#include "win32-math.h"
@@ -76,7 +75,7 @@ int strncasecmp(const char* s1, const char* s2, int n);
inline int lrint(double flt) {
int intgr;
-#if defined(V8_TARGET_ARCH_IA32)
+#if V8_TARGET_ARCH_IA32
__asm {
fld flt
fistp intgr
@@ -91,18 +90,12 @@ inline int lrint(double flt) {
return intgr;
}
-#endif // _MSC_VER
+#endif // V8_CC_MSVC
-#ifndef __CYGWIN__
// Random is missing on both Visual Studio and MinGW.
+#if V8_CC_MSVC || V8_CC_MINGW
int random();
-#endif
-
-#endif // WIN32
-
-#include "lazy-instance.h"
-#include "utils.h"
-#include "v8globals.h"
+#endif // V8_CC_MSVC || V8_CC_MINGW
namespace v8 {
namespace internal {
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index
faddecc5622f91c5972d791defe0d487a1666032..9358d6bd18957e21fbf6334b70ce09186dd9e0a6
100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -104,11 +104,6 @@ class DuplicateFinder {
};
-#ifdef WIN32
-#undef Yield
-#endif
-
-
class PreParser {
public:
enum PreParseResult {
Index: src/v8dll-main.cc
diff --git a/src/v8dll-main.cc b/src/v8dll-main.cc
index
49d868957d9d3fa1fce110565a0afcf99f90d6da..7f6c9f955d3f5a0ca63dd9ff14d5fb8fc93e734b
100644
--- a/src/v8dll-main.cc
+++ b/src/v8dll-main.cc
@@ -30,8 +30,8 @@
#undef USING_V8_SHARED
#include "../include/v8.h"
-#ifdef WIN32
-#include <windows.h> // NOLINT
+#if V8_OS_WIN
+#include "win32-headers.h"
extern "C" {
BOOL WINAPI DllMain(HANDLE hinstDLL,
@@ -41,4 +41,4 @@ BOOL WINAPI DllMain(HANDLE hinstDLL,
return TRUE;
}
}
-#endif
+#endif // V8_OS_WIN
Index: src/win32-headers.h
diff --git a/src/win32-headers.h b/src/win32-headers.h
index
2b5d7d71f21a26457b3eb1eb3a9ce03e23f5b63b..c83937c6da190f28752b69f4c9fcec14d024105a
100644
--- a/src/win32-headers.h
+++ b/src/win32-headers.h
@@ -96,3 +96,4 @@
#undef GetObject
#undef CreateMutex
#undef CreateSemaphore
+#undef Yield
Index: src/x64/regexp-macro-assembler-x64.cc
diff --git a/src/x64/regexp-macro-assembler-x64.cc
b/src/x64/regexp-macro-assembler-x64.cc
index
dcd317c666edbd122e65de85c392d076aa1329ce..49d9de65ab96229088b88b0c3e919631f3351283
100644
--- a/src/x64/regexp-macro-assembler-x64.cc
+++ b/src/x64/regexp-macro-assembler-x64.cc
@@ -761,7 +761,7 @@ Handle<HeapObject>
RegExpMacroAssemblerX64::GetCode(Handle<String> source) {
// position registers.
__ movq(Operand(rbp, kInputStartMinusOne), rax);
-#ifdef WIN32
+#if V8_OS_WIN
// Ensure that we have written to each stack page, in order. Skipping a
page
// on Windows can cause segmentation faults. Assuming page size is 4k.
const int kPageSize = 4096;
@@ -771,7 +771,7 @@ Handle<HeapObject>
RegExpMacroAssemblerX64::GetCode(Handle<String> source) {
i += kRegistersPerPage) {
__ movq(register_location(i), rax); // One write every page.
}
-#endif // WIN32
+#endif // V8_OS_WIN
// Initialize code object pointer.
__ Move(code_object_pointer(), masm_.CodeObject());
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index
c4e136657ba9a6f0d0fc9d0270ee31d4b42d30ce..ccf1cbd9514b528175bdae7e410ed4cd9180d175
100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -25,17 +25,17 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include <limits.h>
-
-#ifndef WIN32
-#include <signal.h> // kill
-#include <unistd.h> // getpid
-#endif // WIN32
+#include <climits>
+#include <csignal>
#include <string>
#include <map>
#include "v8.h"
+#if V8_OS_POSIX
+#include <unistd.h> // NOLINT
+#endif
+
#include "api.h"
#include "arguments.h"
#include "cctest.h"
@@ -20031,7 +20031,7 @@ THREADED_TEST(JSONParseNumber) {
}
-#ifndef WIN32
+#if V8_OS_POSIX
class ThreadInterruptTest {
public:
ThreadInterruptTest() : sem_(NULL), sem_value_(0) { }
@@ -20273,4 +20273,4 @@ TEST(AccessCheckThrows) {
v8::V8::SetFailedAccessCheckCallbackFunction(NULL);
}
-#endif // WIN32
+#endif // V8_OS_POSIX
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.