Skip to content

Commit

Permalink
Bug 1362215 - use MOZ_FORMAT_PRINTF in TestHarness.h; r=froydnj
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: JtNSFoowLIv
  • Loading branch information
tromey committed May 5, 2017
1 parent c8cb689 commit 08dea32
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions tools/fuzzing/libfuzzer/harness/LibFuzzerTestHarness.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#define LibFuzzerTestHarness_h__

#include "mozilla/ArrayUtils.h"
#include "mozilla/Attributes.h"

#include "prenv.h"
#include "nsComponentManagerUtils.h"
Expand Down Expand Up @@ -41,7 +42,7 @@ static uint32_t gFailCount = 0;
* "TEST-UNEXPECTED-FAIL " for the benefit of the test harness and
* appending "\n" to eliminate having to type it at each call site.
*/
void fail(const char* msg, ...)
MOZ_FORMAT_PRINTF(1, 2) void fail(const char* msg, ...)
{
va_list ap;

Expand All @@ -60,7 +61,7 @@ void fail(const char* msg, ...)
* "TEST-PASS " for the benefit of the test harness and
* appending "\n" to eliminate having to type it at each call site.
*/
void passed(const char* msg, ...)
MOZ_FORMAT_PRINTF(1, 2) void passed(const char* msg, ...)
{
va_list ap;

Expand Down
9 changes: 5 additions & 4 deletions xpcom/tests/TestHarness.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#define TestHarness_h__

#include "mozilla/ArrayUtils.h"
#include "mozilla/Attributes.h"

#include "prenv.h"
#include "nsComponentManagerUtils.h"
Expand All @@ -39,7 +40,7 @@ static uint32_t gFailCount = 0;
* "TEST-UNEXPECTED-FAIL " for the benefit of the test harness and
* appending "\n" to eliminate having to type it at each call site.
*/
void fail(const char* msg, ...)
MOZ_FORMAT_PRINTF(1, 2) void fail(const char* msg, ...)
{
va_list ap;

Expand All @@ -58,7 +59,7 @@ void fail(const char* msg, ...)
* "TEST-PASS " for the benefit of the test harness and
* appending "\n" to eliminate having to type it at each call site.
*/
void passed(const char* msg, ...)
MOZ_FORMAT_PRINTF(1, 2) void passed(const char* msg, ...)
{
va_list ap;

Expand Down Expand Up @@ -88,7 +89,7 @@ class ScopedXPCOM : public nsIDirectoryServiceProvider2
nsresult rv = NS_InitXPCOM2(&mServMgr, nullptr, this);
if (NS_FAILED(rv))
{
fail("NS_InitXPCOM2 returned failure code 0x%x", rv);
fail("NS_InitXPCOM2 returned failure code 0x%" PRIx32, static_cast<uint32_t>(rv));
mServMgr = nullptr;
return;
}
Expand Down Expand Up @@ -120,7 +121,7 @@ class ScopedXPCOM : public nsIDirectoryServiceProvider2
nsresult rv = NS_ShutdownXPCOM(nullptr);
if (NS_FAILED(rv))
{
fail("XPCOM shutdown failed with code 0x%x", rv);
fail("XPCOM shutdown failed with code 0x%" PRIx32, static_cast<uint32_t>(rv));
exit(1);
}
}
Expand Down

0 comments on commit 08dea32

Please sign in to comment.