Bug 965022 - Use MOZ_FORMAT_PRINTF for [f]printf_stderr, and fix incorrect usages. r=jrmuizel

This commit is contained in:
Botond Ballo 2014-08-25 18:28:25 -04:00
parent 65854776c8
commit 18e3296080
6 changed files with 12 additions and 10 deletions

View File

@ -833,7 +833,7 @@ GLBlitHelper::BlitTextureToFramebuffer(GLuint srcTex, GLuint destFB,
if (!good) {
// We're up against the wall, so bail.
// This should really be MOZ_CRASH(why) or MOZ_RUNTIME_ASSERT(good).
printf_stderr("[%s:%d] Fatal Error: Failed to prepare to blit texture->framebuffer.\n");
printf_stderr("Fatal Error: Failed to prepare to blit texture->framebuffer.\n");
MOZ_CRASH();
}
mGL->fDrawArrays(LOCAL_GL_TRIANGLE_STRIP, 0, 4);

View File

@ -29,6 +29,7 @@
#include "TextureGarbageBin.h"
#include "gfx2DGlue.h"
#include "gfxPrefs.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "OGLShaderProgram.h" // for ShaderProgramType
@ -1271,7 +1272,7 @@ GLContext::DebugCallback(GLenum source,
break;
}
printf_stderr("[KHR_debug: 0x%x] ID %u: %s %s %s:\n %s",
printf_stderr("[KHR_debug: 0x%" PRIuPTR "] ID %u: %s %s %s:\n %s",
(uintptr_t)this,
id,
sourceStr.BeginReading(),

View File

@ -481,7 +481,7 @@ GLXLibrary::AfterGLXCall()
if (sErrorEvent.mError.error_code) {
char buffer[2048];
XGetErrorText(DefaultXDisplay(), sErrorEvent.mError.error_code, buffer, sizeof(buffer));
printf_stderr("X ERROR: %s (%i) - Request: %i.%i, Serial: %i",
printf_stderr("X ERROR: %s (%i) - Request: %i.%i, Serial: %lu",
buffer,
sErrorEvent.mError.error_code,
sErrorEvent.mError.request_code,

View File

@ -1805,13 +1805,13 @@ MessageChannel::DebugAbort(const char* file, int line, const char* cond,
reply ? "(reply)" : "");
// technically we need the mutex for this, but we're dying anyway
DumpInterruptStack(" ");
printf_stderr(" remote Interrupt stack guess: %lu\n",
printf_stderr(" remote Interrupt stack guess: %" PRIuSIZE "\n",
mRemoteStackDepthGuess);
printf_stderr(" deferred stack size: %lu\n",
printf_stderr(" deferred stack size: %" PRIuSIZE "\n",
mDeferred.size());
printf_stderr(" out-of-turn Interrupt replies stack size: %lu\n",
printf_stderr(" out-of-turn Interrupt replies stack size: %" PRIuSIZE "\n",
mOutOfTurnReplies.size());
printf_stderr(" Pending queue size: %lu, front to back:\n",
printf_stderr(" Pending queue size: %" PRIuSIZE ", front to back:\n",
mPending.size());
MessageQueue pending = mPending;

View File

@ -451,7 +451,7 @@ AnimationPlayerCollection::LogAsyncAnimationFailure(nsCString& aMessage,
aMessage.Append(']');
}
aMessage.Append('\n');
printf_stderr(aMessage.get());
printf_stderr("%s", aMessage.get());
}
/*static*/ void

View File

@ -402,12 +402,13 @@ typedef void (*StderrCallback)(const char* aFmt, va_list aArgs);
extern "C" {
#endif
NS_COM_GLUE void printf_stderr(const char* aFmt, ...);
NS_COM_GLUE void printf_stderr(const char* aFmt, ...) MOZ_FORMAT_PRINTF(1, 2);
NS_COM_GLUE void vprintf_stderr(const char* aFmt, va_list aArgs);
// fprintf with special handling for stderr to print to the console
NS_COM_GLUE void fprintf_stderr(FILE* aFile, const char* aFmt, ...);
NS_COM_GLUE void fprintf_stderr(FILE* aFile, const char* aFmt, ...)
MOZ_FORMAT_PRINTF(2, 3);
// used by the profiler to log stderr in the profiler for more
// advanced performance debugging and display/layers visualization.