Annotate printf-like functions as such

This commit is contained in:
Gregor Jasny 2018-02-09 09:48:24 +01:00
parent 8311b41974
commit 282daf63c3

View file

@ -81,6 +81,8 @@ static const char kTruncated[] = " ... (message truncated)\n";
// consumed bytes, and return whether the message fit without truncation. If // consumed bytes, and return whether the message fit without truncation. If
// truncation occurred, if possible leave room in the buffer for the message // truncation occurred, if possible leave room in the buffer for the message
// kTruncated[]. // kTruncated[].
inline static bool VADoRawLog(char** buf, int* size, const char* format,
va_list ap) ABSL_PRINTF_ATTRIBUTE(3, 0);
inline static bool VADoRawLog(char** buf, int* size, inline static bool VADoRawLog(char** buf, int* size,
const char* format, va_list ap) { const char* format, va_list ap) {
int n = vsnprintf(*buf, *size, format, ap); int n = vsnprintf(*buf, *size, format, ap);
@ -128,6 +130,8 @@ bool DoRawLog(char** buf, int* size, const char* format, ...) {
return true; return true;
} }
void RawLogVA(absl::LogSeverity severity, const char* file, int line,
const char* format, va_list ap) ABSL_PRINTF_ATTRIBUTE(4, 0);
void RawLogVA(absl::LogSeverity severity, const char* file, int line, void RawLogVA(absl::LogSeverity severity, const char* file, int line,
const char* format, va_list ap) { const char* format, va_list ap) {
char buffer[kLogBufSize]; char buffer[kLogBufSize];
@ -203,6 +207,8 @@ void SafeWriteToStderr(const char *s, size_t len) {
#endif #endif
} }
void RawLog(absl::LogSeverity severity, const char* file, int line,
const char* format, ...) ABSL_PRINTF_ATTRIBUTE(4, 5);
void RawLog(absl::LogSeverity severity, const char* file, int line, void RawLog(absl::LogSeverity severity, const char* file, int line,
const char* format, ...) { const char* format, ...) {
va_list ap; va_list ap;