mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 915765 - fix -Wformat warnings in xpcom/; r=bsmedberg
Unfortunately this doesn't fix all platforms, since Android's inttypes.h doesn't have the right macros for intptr_t at least, but it makes the situation a little better.
This commit is contained in:
parent
852cc698b9
commit
1d18ef8622
@ -6,8 +6,9 @@
|
|||||||
|
|
||||||
/* API for getting a stack trace of the C/C++ stack on the current thread */
|
/* API for getting a stack trace of the C/C++ stack on the current thread */
|
||||||
|
|
||||||
#include "mozilla/StackWalk.h"
|
|
||||||
#include "mozilla/Assertions.h"
|
#include "mozilla/Assertions.h"
|
||||||
|
#include "mozilla/IntegerPrintfMacros.h"
|
||||||
|
#include "mozilla/StackWalk.h"
|
||||||
#include "nsStackWalkPrivate.h"
|
#include "nsStackWalkPrivate.h"
|
||||||
|
|
||||||
#include "nsStackWalk.h"
|
#include "nsStackWalk.h"
|
||||||
@ -1317,10 +1318,11 @@ NS_FormatCodeAddressDetails(void *aPC, const nsCodeAddressDetails *aDetails,
|
|||||||
if (!aDetails->library[0]) {
|
if (!aDetails->library[0]) {
|
||||||
snprintf(aBuffer, aBufferSize, "UNKNOWN %p\n", aPC);
|
snprintf(aBuffer, aBufferSize, "UNKNOWN %p\n", aPC);
|
||||||
} else if (!aDetails->function[0]) {
|
} else if (!aDetails->function[0]) {
|
||||||
snprintf(aBuffer, aBufferSize, "UNKNOWN [%s +0x%08lX]\n",
|
snprintf(aBuffer, aBufferSize, "UNKNOWN [%s +0x%08" PRIxPTR "]\n",
|
||||||
aDetails->library, aDetails->loffset);
|
aDetails->library, aDetails->loffset);
|
||||||
} else {
|
} else {
|
||||||
snprintf(aBuffer, aBufferSize, "%s+0x%08lX [%s +0x%08lX]\n",
|
snprintf(aBuffer, aBufferSize, "%s+0x%08" PRIxPTR
|
||||||
|
" [%s +0x%08" PRIxPTR "]\n",
|
||||||
aDetails->function, aDetails->foffset,
|
aDetails->function, aDetails->foffset,
|
||||||
aDetails->library, aDetails->loffset);
|
aDetails->library, aDetails->loffset);
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "nsTraceRefcntImpl.h"
|
#include "nsTraceRefcntImpl.h"
|
||||||
|
#include "mozilla/IntegerPrintfMacros.h"
|
||||||
#include "nsXPCOMPrivate.h"
|
#include "nsXPCOMPrivate.h"
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
#include "nsISupports.h"
|
#include "nsISupports.h"
|
||||||
@ -363,7 +364,7 @@ public:
|
|||||||
stats->mCreates != 0 ||
|
stats->mCreates != 0 ||
|
||||||
meanObjs != 0 ||
|
meanObjs != 0 ||
|
||||||
stddevObjs != 0) {
|
stddevObjs != 0) {
|
||||||
fprintf(out, "%4d %-40.40s %8d %8llu %8llu %8llu (%8.2f +/- %8.2f) %8llu %8llu (%8.2f +/- %8.2f)\n",
|
fprintf(out, "%4d %-40.40s %8d %8" PRIu64 " %8" PRIu64 " %8" PRIu64 " (%8.2f +/- %8.2f) %8" PRIu64 " %8" PRIu64 " (%8.2f +/- %8.2f)\n",
|
||||||
i+1, mClassName,
|
i+1, mClassName,
|
||||||
(int32_t)mClassSize,
|
(int32_t)mClassSize,
|
||||||
(nsCRT::strcmp(mClassName, "TOTAL"))
|
(nsCRT::strcmp(mClassName, "TOTAL"))
|
||||||
@ -443,13 +444,15 @@ static int DumpSerialNumbers(PLHashEntry* aHashEntry, int aIndex, void* aClosure
|
|||||||
{
|
{
|
||||||
serialNumberRecord* record = reinterpret_cast<serialNumberRecord *>(aHashEntry->value);
|
serialNumberRecord* record = reinterpret_cast<serialNumberRecord *>(aHashEntry->value);
|
||||||
#ifdef HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
|
#ifdef HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
|
||||||
fprintf((FILE*) aClosure, "%ld @%p (%d references; %d from COMPtrs)\n",
|
fprintf((FILE*) aClosure, "%" PRIdPTR
|
||||||
|
" @%p (%d references; %d from COMPtrs)\n",
|
||||||
record->serialNumber,
|
record->serialNumber,
|
||||||
NS_INT32_TO_PTR(aHashEntry->key),
|
NS_INT32_TO_PTR(aHashEntry->key),
|
||||||
record->refCount,
|
record->refCount,
|
||||||
record->COMPtrCount);
|
record->COMPtrCount);
|
||||||
#else
|
#else
|
||||||
fprintf((FILE*) aClosure, "%ld @%p (%d references)\n",
|
fprintf((FILE*) aClosure, "%" PRIdPTR
|
||||||
|
" @%p (%d references)\n",
|
||||||
record->serialNumber,
|
record->serialNumber,
|
||||||
NS_INT32_TO_PTR(aHashEntry->key),
|
NS_INT32_TO_PTR(aHashEntry->key),
|
||||||
record->refCount);
|
record->refCount);
|
||||||
@ -811,7 +814,7 @@ static void InitTraceLog(void)
|
|||||||
}
|
}
|
||||||
for (intptr_t serialno = bottom; serialno <= top; serialno++) {
|
for (intptr_t serialno = bottom; serialno <= top; serialno++) {
|
||||||
PL_HashTableAdd(gObjectsToLog, (const void*)serialno, (void*)1);
|
PL_HashTableAdd(gObjectsToLog, (const void*)serialno, (void*)1);
|
||||||
fprintf(stdout, "%ld ", serialno);
|
fprintf(stdout, "%" PRIdPTR " ", serialno);
|
||||||
}
|
}
|
||||||
if (!cm) break;
|
if (!cm) break;
|
||||||
*cm = ',';
|
*cm = ',';
|
||||||
@ -986,7 +989,7 @@ NS_LogAddRef(void* aPtr, nsrefcnt aRefcnt,
|
|||||||
|
|
||||||
bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
|
bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
|
||||||
if (aRefcnt == 1 && gAllocLog && loggingThisType && loggingThisObject) {
|
if (aRefcnt == 1 && gAllocLog && loggingThisType && loggingThisObject) {
|
||||||
fprintf(gAllocLog, "\n<%s> 0x%08X %ld Create\n",
|
fprintf(gAllocLog, "\n<%s> 0x%08X %" PRIdPTR " Create\n",
|
||||||
aClazz, NS_PTR_TO_INT32(aPtr), serialno);
|
aClazz, NS_PTR_TO_INT32(aPtr), serialno);
|
||||||
nsTraceRefcntImpl::WalkTheStack(gAllocLog);
|
nsTraceRefcntImpl::WalkTheStack(gAllocLog);
|
||||||
}
|
}
|
||||||
@ -998,7 +1001,7 @@ NS_LogAddRef(void* aPtr, nsrefcnt aRefcnt,
|
|||||||
else {
|
else {
|
||||||
// Can't use PR_LOG(), b/c it truncates the line
|
// Can't use PR_LOG(), b/c it truncates the line
|
||||||
fprintf(gRefcntsLog,
|
fprintf(gRefcntsLog,
|
||||||
"\n<%s> 0x%08X %ld AddRef %d\n", aClazz, NS_PTR_TO_INT32(aPtr), serialno, aRefcnt);
|
"\n<%s> 0x%08X %" PRIdPTR " AddRef %d\n", aClazz, NS_PTR_TO_INT32(aPtr), serialno, aRefcnt);
|
||||||
nsTraceRefcntImpl::WalkTheStack(gRefcntsLog);
|
nsTraceRefcntImpl::WalkTheStack(gRefcntsLog);
|
||||||
fflush(gRefcntsLog);
|
fflush(gRefcntsLog);
|
||||||
}
|
}
|
||||||
@ -1046,7 +1049,7 @@ NS_LogRelease(void* aPtr, nsrefcnt aRefcnt, const char* aClazz)
|
|||||||
else {
|
else {
|
||||||
// Can't use PR_LOG(), b/c it truncates the line
|
// Can't use PR_LOG(), b/c it truncates the line
|
||||||
fprintf(gRefcntsLog,
|
fprintf(gRefcntsLog,
|
||||||
"\n<%s> 0x%08X %ld Release %d\n", aClazz, NS_PTR_TO_INT32(aPtr), serialno, aRefcnt);
|
"\n<%s> 0x%08X %" PRIdPTR " Release %d\n", aClazz, NS_PTR_TO_INT32(aPtr), serialno, aRefcnt);
|
||||||
nsTraceRefcntImpl::WalkTheStack(gRefcntsLog);
|
nsTraceRefcntImpl::WalkTheStack(gRefcntsLog);
|
||||||
fflush(gRefcntsLog);
|
fflush(gRefcntsLog);
|
||||||
}
|
}
|
||||||
@ -1057,7 +1060,7 @@ NS_LogRelease(void* aPtr, nsrefcnt aRefcnt, const char* aClazz)
|
|||||||
|
|
||||||
if (aRefcnt == 0 && gAllocLog && loggingThisType && loggingThisObject) {
|
if (aRefcnt == 0 && gAllocLog && loggingThisType && loggingThisObject) {
|
||||||
fprintf(gAllocLog,
|
fprintf(gAllocLog,
|
||||||
"\n<%s> 0x%08X %ld Destroy\n",
|
"\n<%s> 0x%08X %" PRIdPTR " Destroy\n",
|
||||||
aClazz, NS_PTR_TO_INT32(aPtr), serialno);
|
aClazz, NS_PTR_TO_INT32(aPtr), serialno);
|
||||||
nsTraceRefcntImpl::WalkTheStack(gAllocLog);
|
nsTraceRefcntImpl::WalkTheStack(gAllocLog);
|
||||||
}
|
}
|
||||||
@ -1097,7 +1100,7 @@ NS_LogCtor(void* aPtr, const char* aType, uint32_t aInstanceSize)
|
|||||||
|
|
||||||
bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
|
bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
|
||||||
if (gAllocLog && loggingThisType && loggingThisObject) {
|
if (gAllocLog && loggingThisType && loggingThisObject) {
|
||||||
fprintf(gAllocLog, "\n<%s> 0x%08X %ld Ctor (%d)\n",
|
fprintf(gAllocLog, "\n<%s> 0x%08X %" PRIdPTR " Ctor (%d)\n",
|
||||||
aType, NS_PTR_TO_INT32(aPtr), serialno, aInstanceSize);
|
aType, NS_PTR_TO_INT32(aPtr), serialno, aInstanceSize);
|
||||||
nsTraceRefcntImpl::WalkTheStack(gAllocLog);
|
nsTraceRefcntImpl::WalkTheStack(gAllocLog);
|
||||||
}
|
}
|
||||||
@ -1138,7 +1141,7 @@ NS_LogDtor(void* aPtr, const char* aType, uint32_t aInstanceSize)
|
|||||||
// (If we're on a losing architecture, don't do this because we'll be
|
// (If we're on a losing architecture, don't do this because we'll be
|
||||||
// using LogDeleteXPCOM instead to get file and line numbers.)
|
// using LogDeleteXPCOM instead to get file and line numbers.)
|
||||||
if (gAllocLog && loggingThisType && loggingThisObject) {
|
if (gAllocLog && loggingThisType && loggingThisObject) {
|
||||||
fprintf(gAllocLog, "\n<%s> 0x%08X %ld Dtor (%d)\n",
|
fprintf(gAllocLog, "\n<%s> 0x%08X %" PRIdPTR " Dtor (%d)\n",
|
||||||
aType, NS_PTR_TO_INT32(aPtr), serialno, aInstanceSize);
|
aType, NS_PTR_TO_INT32(aPtr), serialno, aInstanceSize);
|
||||||
nsTraceRefcntImpl::WalkTheStack(gAllocLog);
|
nsTraceRefcntImpl::WalkTheStack(gAllocLog);
|
||||||
}
|
}
|
||||||
@ -1179,7 +1182,7 @@ NS_LogCOMPtrAddRef(void* aCOMPtr, nsISupports* aObject)
|
|||||||
bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
|
bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
|
||||||
|
|
||||||
if (gCOMPtrLog && loggingThisObject) {
|
if (gCOMPtrLog && loggingThisObject) {
|
||||||
fprintf(gCOMPtrLog, "\n<?> 0x%08X %ld nsCOMPtrAddRef %d 0x%08X\n",
|
fprintf(gCOMPtrLog, "\n<?> 0x%08X %" PRIdPTR " nsCOMPtrAddRef %d 0x%08X\n",
|
||||||
NS_PTR_TO_INT32(object), serialno, count?(*count):-1, NS_PTR_TO_INT32(aCOMPtr));
|
NS_PTR_TO_INT32(object), serialno, count?(*count):-1, NS_PTR_TO_INT32(aCOMPtr));
|
||||||
nsTraceRefcntImpl::WalkTheStack(gCOMPtrLog);
|
nsTraceRefcntImpl::WalkTheStack(gCOMPtrLog);
|
||||||
}
|
}
|
||||||
@ -1220,7 +1223,7 @@ NS_LogCOMPtrRelease(void* aCOMPtr, nsISupports* aObject)
|
|||||||
bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
|
bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
|
||||||
|
|
||||||
if (gCOMPtrLog && loggingThisObject) {
|
if (gCOMPtrLog && loggingThisObject) {
|
||||||
fprintf(gCOMPtrLog, "\n<?> 0x%08X %ld nsCOMPtrRelease %d 0x%08X\n",
|
fprintf(gCOMPtrLog, "\n<?> 0x%08X %" PRIdPTR " nsCOMPtrRelease %d 0x%08X\n",
|
||||||
NS_PTR_TO_INT32(object), serialno, count?(*count):-1, NS_PTR_TO_INT32(aCOMPtr));
|
NS_PTR_TO_INT32(object), serialno, count?(*count):-1, NS_PTR_TO_INT32(aCOMPtr));
|
||||||
nsTraceRefcntImpl::WalkTheStack(gCOMPtrLog);
|
nsTraceRefcntImpl::WalkTheStack(gCOMPtrLog);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user