зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1331349 Fix printf formatting errors in MinGW compilation r=froydnj
MozReview-Commit-ID: A4PMABfxzez --HG-- extra : rebase_source : d0c40a495ad390aeb71ddc81c33daa081f6e0ba7
This commit is contained in:
Родитель
3cf49afb27
Коммит
fcb35c70f7
|
@ -852,7 +852,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);
|
||||
|
@ -871,7 +871,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);
|
||||
|
@ -890,7 +890,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);
|
||||
|
|
|
@ -97,7 +97,9 @@ int __android_log_write(int prio, const char *tag, const char *text);
|
|||
* Send a formatted string to the log, used like printf(fmt,...)
|
||||
*/
|
||||
int __android_log_print(int prio, const char *tag, const char *fmt, ...)
|
||||
#if defined(__GNUC__)
|
||||
#if defined(__MINGW32__)
|
||||
__attribute__ ((format(__MINGW_PRINTF_FORMAT, 3, 4)))
|
||||
#elif defined(__GNUC__)
|
||||
__attribute__ ((format(printf, 3, 4)))
|
||||
#endif
|
||||
;
|
||||
|
|
|
@ -64,7 +64,12 @@ public:
|
|||
|
||||
static inline const String8 empty();
|
||||
|
||||
static String8 format(const char* fmt, ...) __attribute__((format (printf, 1, 2)));
|
||||
static String8 format(const char* fmt, ...)
|
||||
#ifdef __MINGW32__
|
||||
__attribute__((format (__MINGW_PRINTF_FORMAT, 1, 2)));
|
||||
#else
|
||||
__attribute__((format (printf, 1, 2)));
|
||||
#endif
|
||||
static String8 formatV(const char* fmt, va_list args);
|
||||
|
||||
inline const char* string() const;
|
||||
|
|
|
@ -631,8 +631,16 @@
|
|||
* printf-likes, and in particular this should not be used for
|
||||
* PR_snprintf and friends, which are "printf-like" but which assign
|
||||
* different meanings to the various formats.
|
||||
*
|
||||
* MinGW requires special handling due to different format specifiers
|
||||
* on different platforms. The macro __MINGW_PRINTF_FORMAT maps to
|
||||
* either gnu_printf or ms_printf depending on where we are compiling
|
||||
* to avoid warnings on format specifiers that are legal.
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
#ifdef __MINGW32__
|
||||
#define MOZ_FORMAT_PRINTF(stringIndex, firstToCheck) \
|
||||
__attribute__ ((format (__MINGW_PRINTF_FORMAT, stringIndex, firstToCheck)))
|
||||
#elif __GNUC__
|
||||
#define MOZ_FORMAT_PRINTF(stringIndex, firstToCheck) \
|
||||
__attribute__ ((format (printf, stringIndex, firstToCheck)))
|
||||
#else
|
||||
|
|
Загрузка…
Ссылка в новой задаче