From 84b790dfccb4c1f4d282fe069063d14b42d9fee9 Mon Sep 17 00:00:00 2001 From: Georg Koppen Date: Wed, 1 Feb 2017 11:52:36 +0000 Subject: [PATCH] Backport of tjr's patch for bug 1331349 --- js/src/gc/Memory.cpp | 6 +++--- mfbt/Attributes.h | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/js/src/gc/Memory.cpp b/js/src/gc/Memory.cpp index 26da754692c04..4851546f4ecad 100644 --- a/js/src/gc/Memory.cpp +++ b/js/src/gc/Memory.cpp @@ -849,7 +849,7 @@ ProtectPages(void* p, size_t size) #if defined(XP_WIN) DWORD oldProtect; if (!VirtualProtect(p, size, PAGE_NOACCESS, &oldProtect)) { - MOZ_CRASH_UNSAFE_PRINTF("VirtualProtect(PAGE_NOACCESS) failed! Error code: %u", + MOZ_CRASH_UNSAFE_PRINTF("VirtualProtect(PAGE_NOACCESS) failed! Error code: %lu", GetLastError()); } MOZ_ASSERT(oldProtect == PAGE_READWRITE); @@ -868,7 +868,7 @@ MakePagesReadOnly(void* p, size_t size) #if defined(XP_WIN) DWORD oldProtect; if (!VirtualProtect(p, size, PAGE_READONLY, &oldProtect)) { - MOZ_CRASH_UNSAFE_PRINTF("VirtualProtect(PAGE_READONLY) failed! Error code: %u", + MOZ_CRASH_UNSAFE_PRINTF("VirtualProtect(PAGE_READONLY) failed! Error code: %lu", GetLastError()); } MOZ_ASSERT(oldProtect == PAGE_READWRITE); @@ -887,7 +887,7 @@ UnprotectPages(void* p, size_t size) #if defined(XP_WIN) DWORD oldProtect; if (!VirtualProtect(p, size, PAGE_READWRITE, &oldProtect)) { - MOZ_CRASH_UNSAFE_PRINTF("VirtualProtect(PAGE_READWRITE) failed! Error code: %u", + MOZ_CRASH_UNSAFE_PRINTF("VirtualProtect(PAGE_READWRITE) failed! Error code: %lu", GetLastError()); } MOZ_ASSERT(oldProtect == PAGE_NOACCESS || oldProtect == PAGE_READONLY); diff --git a/mfbt/Attributes.h b/mfbt/Attributes.h index df6172f31b5a9..bcd393cbe594b 100644 --- a/mfbt/Attributes.h +++ b/mfbt/Attributes.h @@ -594,7 +594,10 @@ * PR_snprintf and friends, which are "printf-like" but which assign * different meanings to the various formats. */ -#ifdef __GNUC__ +#ifdef __MINGW__ +#define MOZ_FORMAT_PRINTF(stringIndex, firstToCheck) \ + __attribute__ ((format (ms_printf, stringIndex, firstToCheck))) +#elseif __GNUC__ #define MOZ_FORMAT_PRINTF(stringIndex, firstToCheck) \ __attribute__ ((format (printf, stringIndex, firstToCheck))) #else -- GitLab