summaryrefslogtreecommitdiff
path: root/base/include/base/stringprintf.h
diff options
context:
space:
mode:
Diffstat (limited to 'base/include/base/stringprintf.h')
-rw-r--r--base/include/base/stringprintf.h24
1 files changed, 5 insertions, 19 deletions
diff --git a/base/include/base/stringprintf.h b/base/include/base/stringprintf.h
index d68af8713e..e17a2b521e 100644
--- a/base/include/base/stringprintf.h
+++ b/base/include/base/stringprintf.h
@@ -20,35 +20,21 @@
#include <stdarg.h>
#include <string>
+#include "base/macros.h"
+
namespace android {
namespace base {
-// These printf-like functions are implemented in terms of vsnprintf, so they
-// use the same attribute for compile-time format string checking. On Windows,
-// if the mingw version of vsnprintf is used, use `gnu_printf' which allows z
-// in %zd and PRIu64 (and related) to be recognized by the compile-time
-// checking.
-#define FORMAT_ARCHETYPE __printf__
-#ifdef __USE_MINGW_ANSI_STDIO
-#if __USE_MINGW_ANSI_STDIO
-#undef FORMAT_ARCHETYPE
-#define FORMAT_ARCHETYPE gnu_printf
-#endif
-#endif
-
// Returns a string corresponding to printf-like formatting of the arguments.
-std::string StringPrintf(const char* fmt, ...)
- __attribute__((__format__(FORMAT_ARCHETYPE, 1, 2)));
+std::string StringPrintf(const char* fmt, ...) ATTRIBUTE_FORMAT(1, 2);
// Appends a printf-like formatting of the arguments to 'dst'.
void StringAppendF(std::string* dst, const char* fmt, ...)
- __attribute__((__format__(FORMAT_ARCHETYPE, 2, 3)));
+ ATTRIBUTE_FORMAT(2, 3);
// Appends a printf-like formatting of the arguments to 'dst'.
void StringAppendV(std::string* dst, const char* format, va_list ap)
- __attribute__((__format__(FORMAT_ARCHETYPE, 2, 0)));
-
-#undef FORMAT_ARCHETYPE
+ ATTRIBUTE_FORMAT(2, 0);
} // namespace base
} // namespace android