From 4ef5915741b236f2f051b9d6d3be782198e58b09 Mon Sep 17 00:00:00 2001 From: "sigurds@chromium.org" Date: Wed, 17 Sep 2014 14:20:20 +0000 Subject: [PATCH] This is a reland of issue 563813002: https://codereview.chromium.org/575473002/ This time with additional include headers and MSVC specific guards. Previously, only V8 Win32 - nosnap - shared failed: http://build.chromium.org/p/client.v8/builders/V8%20Win32%20-%20nosnap%20-%20shared/builds/2916 R=marja@chromium.org Review URL: https://codereview.chromium.org/576733002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24006 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/d8.cc | 22 +++++++++++++++++++++- test/cctest/cctest.cc | 23 +++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/d8.cc b/src/d8.cc index a2889482bb..c1d66b4d3c 100644 --- a/src/d8.cc +++ b/src/d8.cc @@ -54,7 +54,12 @@ #if !defined(_WIN32) && !defined(_WIN64) #include // NOLINT -#endif +#else +#include // NOLINT +#if defined(_MSC_VER) +#include // NOLINT +#endif // defined(_MSC_VER) +#endif // !defined(_WIN32) && !defined(_WIN64) #ifndef DCHECK #define DCHECK(condition) assert(condition) @@ -1595,6 +1600,21 @@ class StartupDataHandler { int Shell::Main(int argc, char* argv[]) { +#if (defined(_WIN32) || defined(_WIN64)) + UINT new_flags = + SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX; + UINT existing_flags = SetErrorMode(new_flags); + SetErrorMode(existing_flags | new_flags); +#if defined(_MSC_VER) + _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); + _set_error_mode(_OUT_TO_STDERR); +#endif // defined(_MSC_VER) +#endif // defined(_WIN32) || defined(_WIN64) if (!SetOptions(argc, argv)) return 1; v8::V8::InitializeICU(options.icu_data_file); v8::Platform* platform = v8::platform::CreateDefaultPlatform(); diff --git a/test/cctest/cctest.cc b/test/cctest/cctest.cc index 2bb08b0ec9..3eb189f409 100644 --- a/test/cctest/cctest.cc +++ b/test/cctest/cctest.cc @@ -34,6 +34,13 @@ #include "test/cctest/profiler-extension.h" #include "test/cctest/trace-extension.h" +#if (defined(_WIN32) || defined(_WIN64)) +#include // NOLINT +#if defined(_MSC_VER) +#include +#endif // defined(_MSC_VER) +#endif // defined(_WIN32) || defined(_WIN64) + enum InitializationState {kUnset, kUnintialized, kInitialized}; static InitializationState initialization_state_ = kUnset; static bool disable_automatic_dispose_ = false; @@ -138,6 +145,22 @@ static void SuggestTestHarness(int tests) { int main(int argc, char* argv[]) { +#if (defined(_WIN32) || defined(_WIN64)) + UINT new_flags = + SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX; + UINT existing_flags = SetErrorMode(new_flags); + SetErrorMode(existing_flags | new_flags); +#if defined(_MSC_VER) + _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); + _set_error_mode(_OUT_TO_STDERR); +#endif // _MSC_VER +#endif // defined(_WIN32) || defined(_WIN64) + v8::V8::InitializeICU(); v8::Platform* platform = v8::platform::CreateDefaultPlatform(); v8::V8::InitializePlatform(platform);