Skip to content

Commit

Permalink
Bug 965022 - Use MOZ_FORMAT_PRINTF for [f]printf_stderr, and fix inco…
Browse files Browse the repository at this point in the history
…rrect usages. r=jrmuizel
  • Loading branch information
theres-waldo committed Aug 25, 2014
1 parent d8d183c commit bd92c7e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion gfx/gl/GLBlitHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion gfx/gl/GLContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "TextureGarbageBin.h"
#include "gfx2DGlue.h"
#include "gfxPrefs.h"
#include "mozilla/IntegerPrintfMacros.h"

#include "OGLShaderProgram.h" // for ShaderProgramType

Expand Down Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion gfx/gl/GLContextProviderGLX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions ipc/glue/MessageChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion layout/style/AnimationCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ AnimationPlayerCollection::LogAsyncAnimationFailure(nsCString& aMessage,
aMessage.Append(']');
}
aMessage.Append('\n');
printf_stderr(aMessage.get());
printf_stderr("%s", aMessage.get());
}

/*static*/ void
Expand Down
5 changes: 3 additions & 2 deletions xpcom/glue/nsDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit bd92c7e

Please sign in to comment.