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>
This commit is contained in:
Mike Frysinger 2013-12-19 01:37:49 -05:00 committed by chrome-internal-fetch
parent 1c5708f69f
commit 754dc92466

View file

@ -138,6 +138,10 @@ class MetricsLibrary : public MetricsLibraryInterface {
// 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, ...);