From a2196179cc626de67ee4e4121246bcc8002d4bad Mon Sep 17 00:00:00 2001 From: Rafal Chlodnicki Date: Thu, 25 Aug 2016 23:33:31 +0200 Subject: Fix breakpad compilation issue with clang on Windows Fix unused variable error. Code that uses the kWaitForHandlerThreadMs constant is inside and ifdef so in some compile configurations constant was unused. Move it where it's used. And do the same with other constants as requested during review. BUG= Change-Id: I4f4c8f36c982092d53438ed6d2a0a97772402d69 Reviewed-on: https://chromium-review.googlesource.com/374378 Reviewed-by: Mark Mentovai --- src/client/windows/handler/exception_handler.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/client/windows/handler/exception_handler.cc b/src/client/windows/handler/exception_handler.cc index ef581dd3..1f7b19f9 100644 --- a/src/client/windows/handler/exception_handler.cc +++ b/src/client/windows/handler/exception_handler.cc @@ -41,12 +41,6 @@ namespace google_breakpad { -static const int kWaitForHandlerThreadMs = 60000; -static const int kExceptionHandlerThreadInitialStackSize = 64 * 1024; - -// As documented on MSDN, on failure SuspendThread returns (DWORD) -1 -static const DWORD kFailedToSuspendThread = static_cast(-1); - // This is passed as the context to the MinidumpWriteDump callback. typedef struct { AppMemoryList::const_iterator iter; @@ -217,6 +211,7 @@ void ExceptionHandler::Initialize( // Don't attempt to create the thread if we could not create the semaphores. if (handler_finish_semaphore_ != NULL && handler_start_semaphore_ != NULL) { DWORD thread_id; + const int kExceptionHandlerThreadInitialStackSize = 64 * 1024; handler_thread_ = CreateThread(NULL, // lpThreadAttributes kExceptionHandlerThreadInitialStackSize, ExceptionHandlerThreadMain, @@ -353,6 +348,7 @@ ExceptionHandler::~ExceptionHandler() { // inside DllMain. is_shutdown_ = true; ReleaseSemaphore(handler_start_semaphore_, 1, NULL); + const int kWaitForHandlerThreadMs = 60000; WaitForSingleObject(handler_thread_, kWaitForHandlerThreadMs); #else TerminateThread(handler_thread_, 1); @@ -781,6 +777,8 @@ bool ExceptionHandler::WriteMinidumpForChild(HANDLE child, EXCEPTION_RECORD ex; CONTEXT ctx; EXCEPTION_POINTERS exinfo = { NULL, NULL }; + // As documented on MSDN, on failure SuspendThread returns (DWORD) -1 + const DWORD kFailedToSuspendThread = static_cast(-1); DWORD last_suspend_count = kFailedToSuspendThread; HANDLE child_thread_handle = OpenThread(THREAD_GET_CONTEXT | THREAD_QUERY_INFORMATION | -- cgit v1.2.1