Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: src/base/platform/platform.h

Issue 1877453002: Fix printf formats (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Handle ptrdiff_t format, which seems to make MSVC barf Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/base/macros.h ('k') | src/compilation-statistics.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/base/platform/platform.h
diff --git a/src/base/platform/platform.h b/src/base/platform/platform.h
index 5b2dbc9a0b29831865f082ce0fd25024754ff541..84d9db5b9356a34a050e2f92edf07d97699cbb03 100644
--- a/src/base/platform/platform.h
+++ b/src/base/platform/platform.h
@@ -26,6 +26,7 @@
#include <vector>
#include "src/base/build_config.h"
+#include "src/base/compiler-specific.h"
#include "src/base/platform/mutex.h"
#include "src/base/platform/semaphore.h"
@@ -154,18 +155,19 @@ class OS {
// Print output to console. This is mostly used for debugging output.
// On platforms that has standard terminal output, the output
// should go to stdout.
- static void Print(const char* format, ...);
- static void VPrint(const char* format, va_list args);
+ static PRINTF_FORMAT(1, 2) void Print(const char* format, ...);
+ static PRINTF_FORMAT(1, 0) void VPrint(const char* format, va_list args);
// Print output to a file. This is mostly used for debugging output.
- static void FPrint(FILE* out, const char* format, ...);
- static void VFPrint(FILE* out, const char* format, va_list args);
+ static PRINTF_FORMAT(2, 3) void FPrint(FILE* out, const char* format, ...);
+ static PRINTF_FORMAT(2, 0) void VFPrint(FILE* out, const char* format,
+ va_list args);
// Print error output to console. This is mostly used for error message
// output. On platforms that has standard terminal output, the output
// should go to stderr.
- static void PrintError(const char* format, ...);
- static void VPrintError(const char* format, va_list args);
+ static PRINTF_FORMAT(1, 2) void PrintError(const char* format, ...);
+ static PRINTF_FORMAT(1, 0) void VPrintError(const char* format, va_list args);
// Allocate/Free memory used by JS heap. Pages are readable/writable, but
// they are not guaranteed to be executable unless 'executable' is true.
@@ -222,11 +224,10 @@ class OS {
// Safe formatting print. Ensures that str is always null-terminated.
// Returns the number of chars written, or -1 if output was truncated.
- static int SNPrintF(char* str, int length, const char* format, ...);
- static int VSNPrintF(char* str,
- int length,
- const char* format,
- va_list args);
+ static PRINTF_FORMAT(3, 4) int SNPrintF(char* str, int length,
+ const char* format, ...);
+ static PRINTF_FORMAT(3, 0) int VSNPrintF(char* str, int length,
+ const char* format, va_list args);
static char* StrChr(char* str, int c);
static void StrNCpy(char* dest, int length, const char* src, size_t n);
« no previous file with comments | « src/base/macros.h ('k') | src/compilation-statistics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698