diff options
author | Daniel M. Katz <katzdm@gmail.com> | 2018-02-09 11:27:47 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-09 11:27:47 -0500 |
commit | 4791df7d1ac966e6c7abdeffafa5030d718500df (patch) | |
tree | 164ee15643c59328fd61f1476ebac48ad2d9d08e /absl | |
parent | 8311b41974e50f2753921ba986bbd188f9bc28a0 (diff) | |
parent | 4f45903993aa8cb23bfc565c245980f6bd704fb0 (diff) |
Merge pull request #91 from gjasny/printf-attributes
Annotate printf-like functions as such
Diffstat (limited to 'absl')
-rw-r--r-- | absl/base/internal/raw_logging.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/absl/base/internal/raw_logging.cc b/absl/base/internal/raw_logging.cc index 86e34d45..7a32edde 100644 --- a/absl/base/internal/raw_logging.cc +++ b/absl/base/internal/raw_logging.cc @@ -20,6 +20,7 @@ #include <cstdlib> #include <cstring> +#include "absl/base/attributes.h" #include "absl/base/config.h" #include "absl/base/internal/atomic_hook.h" #include "absl/base/log_severity.h" @@ -81,6 +82,8 @@ static const char kTruncated[] = " ... (message truncated)\n"; // consumed bytes, and return whether the message fit without truncation. If // truncation occurred, if possible leave room in the buffer for the message // 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, const char* format, va_list ap) { int n = vsnprintf(*buf, *size, format, ap); @@ -129,6 +132,8 @@ bool DoRawLog(char** buf, int* size, const char* format, ...) { } 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, const char* format, va_list ap) { char buffer[kLogBufSize]; char* buf = buffer; @@ -204,6 +209,8 @@ void SafeWriteToStderr(const char *s, size_t len) { } 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, const char* format, ...) { va_list ap; va_start(ap, format); |