add printf attributes to printf func
This fixes build warnings when using clang:
.../metrics/metrics_library.cc:235:30: warning: format string is not a string literal [-Wformat-nonliteral]
format, args);
^~~~~~
BUG=None
TEST=`FEATURES=test emerge-x86-alex platform2` works & doesn't warn
TEST=`FEATURES=test emerge-daisyplatform2` works & doesn't warn
TEST=`FEATURES=test emerge-lumpy platform2` works & doesn't warn
Change-Id: I03bfffe328eb1f1742de5b3fe722209e6e91f4bc
Reviewed-on: https://chromium-review.googlesource.com/180930
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/metrics/metrics_library.h b/metrics/metrics_library.h
index 9a4c59b..4bba96d 100644
--- a/metrics/metrics_library.h
+++ b/metrics/metrics_library.h
@@ -138,6 +138,10 @@
// The arbitrary |format| argument covers the non-LENGTH portion of the
// message. The caller is responsible to store the \0 character
// between NAME and VALUE (e.g. "%s%c%d", name, '\0', value).
+ //
+ // Ideally we'd use "3, 4" here instead of "4, 5", but it seems clang/gcc
+ // have an implicit first arg ("this"). http://crbug.com/329356
+ __attribute__((__format__(__printf__, 4, 5)))
int32_t FormatChromeMessage(int32_t buffer_size, char* buffer,
const char* format, ...);