summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adb/sysdeps.h10
-rw-r--r--base/include/android-base/stringprintf.h11
-rw-r--r--fastboot/fastboot.h11
-rw-r--r--liblog/include/android/log.h24
4 files changed, 3 insertions, 53 deletions
diff --git a/adb/sysdeps.h b/adb/sysdeps.h
index 3be99f635..fe0ecd6ea 100644
--- a/adb/sysdeps.h
+++ b/adb/sysdeps.h
@@ -41,16 +41,8 @@
41 41
42// Some printf-like functions are implemented in terms of 42// Some printf-like functions are implemented in terms of
43// android::base::StringAppendV, so they should use the same attribute for 43// android::base::StringAppendV, so they should use the same attribute for
44// compile-time format string checking. On Windows, if the mingw version of 44// compile-time format string checking.
45// vsnprintf is used in StringAppendV, use `gnu_printf' which allows z in %zd
46// and PRIu64 (and related) to be recognized by the compile-time checking.
47#define ADB_FORMAT_ARCHETYPE __printf__ 45#define ADB_FORMAT_ARCHETYPE __printf__
48#ifdef __USE_MINGW_ANSI_STDIO
49#if __USE_MINGW_ANSI_STDIO
50#undef ADB_FORMAT_ARCHETYPE
51#define ADB_FORMAT_ARCHETYPE gnu_printf
52#endif
53#endif
54 46
55#ifdef _WIN32 47#ifdef _WIN32
56 48
diff --git a/base/include/android-base/stringprintf.h b/base/include/android-base/stringprintf.h
index 1fd6297fd..517e69e17 100644
--- a/base/include/android-base/stringprintf.h
+++ b/base/include/android-base/stringprintf.h
@@ -24,17 +24,8 @@ namespace android {
24namespace base { 24namespace base {
25 25
26// These printf-like functions are implemented in terms of vsnprintf, so they 26// These printf-like functions are implemented in terms of vsnprintf, so they
27// use the same attribute for compile-time format string checking. On Windows, 27// use the same attribute for compile-time format string checking.
28// if the mingw version of vsnprintf is used, use `gnu_printf' which allows z
29// in %zd and PRIu64 (and related) to be recognized by the compile-time
30// checking.
31#define ANDROID_BASE_FORMAT_ARCHETYPE __printf__ 28#define ANDROID_BASE_FORMAT_ARCHETYPE __printf__
32#ifdef __USE_MINGW_ANSI_STDIO
33#if __USE_MINGW_ANSI_STDIO
34#undef ANDROID_BASE_FORMAT_ARCHETYPE
35#define ANDROID_BASE_FORMAT_ARCHETYPE gnu_printf
36#endif
37#endif
38 29
39// Returns a string corresponding to printf-like formatting of the arguments. 30// Returns a string corresponding to printf-like formatting of the arguments.
40std::string StringPrintf(const char* fmt, ...) 31std::string StringPrintf(const char* fmt, ...)
diff --git a/fastboot/fastboot.h b/fastboot/fastboot.h
index 2935eb57c..dc822e8bf 100644
--- a/fastboot/fastboot.h
+++ b/fastboot/fastboot.h
@@ -78,17 +78,8 @@ char* xstrdup(const char*);
78void set_verbose(); 78void set_verbose();
79 79
80// These printf-like functions are implemented in terms of vsnprintf, so they 80// These printf-like functions are implemented in terms of vsnprintf, so they
81// use the same attribute for compile-time format string checking. On Windows, 81// use the same attribute for compile-time format string checking.
82// if the mingw version of vsnprintf is used, use `gnu_printf' which allows z
83// in %zd and PRIu64 (and related) to be recognized by the compile-time
84// checking.
85#define FASTBOOT_FORMAT_ARCHETYPE __printf__ 82#define FASTBOOT_FORMAT_ARCHETYPE __printf__
86#ifdef __USE_MINGW_ANSI_STDIO
87#if __USE_MINGW_ANSI_STDIO
88#undef FASTBOOT_FORMAT_ARCHETYPE
89#define FASTBOOT_FORMAT_ARCHETYPE gnu_printf
90#endif
91#endif
92void die(const char* fmt, ...) __attribute__((__noreturn__)) 83void die(const char* fmt, ...) __attribute__((__noreturn__))
93__attribute__((__format__(FASTBOOT_FORMAT_ARCHETYPE, 1, 2))); 84__attribute__((__format__(FASTBOOT_FORMAT_ARCHETYPE, 1, 2)));
94void verbose(const char* fmt, ...) __attribute__((__format__(FASTBOOT_FORMAT_ARCHETYPE, 1, 2))); 85void verbose(const char* fmt, ...) __attribute__((__format__(FASTBOOT_FORMAT_ARCHETYPE, 1, 2)));
diff --git a/liblog/include/android/log.h b/liblog/include/android/log.h
index 52cbe8b71..ee9220d4a 100644
--- a/liblog/include/android/log.h
+++ b/liblog/include/android/log.h
@@ -115,16 +115,8 @@ int __android_log_write(int prio, const char* tag, const char* text);
115 */ 115 */
116int __android_log_print(int prio, const char* tag, const char* fmt, ...) 116int __android_log_print(int prio, const char* tag, const char* fmt, ...)
117#if defined(__GNUC__) 117#if defined(__GNUC__)
118#ifdef __USE_MINGW_ANSI_STDIO
119#if __USE_MINGW_ANSI_STDIO
120 __attribute__((__format__(gnu_printf, 3, 4)))
121#else
122 __attribute__((__format__(printf, 3, 4))) 118 __attribute__((__format__(printf, 3, 4)))
123#endif 119#endif
124#else
125 __attribute__((__format__(printf, 3, 4)))
126#endif
127#endif
128 ; 120 ;
129 121
130/** 122/**
@@ -133,16 +125,8 @@ int __android_log_print(int prio, const char* tag, const char* fmt, ...)
133 */ 125 */
134int __android_log_vprint(int prio, const char* tag, const char* fmt, va_list ap) 126int __android_log_vprint(int prio, const char* tag, const char* fmt, va_list ap)
135#if defined(__GNUC__) 127#if defined(__GNUC__)
136#ifdef __USE_MINGW_ANSI_STDIO
137#if __USE_MINGW_ANSI_STDIO
138 __attribute__((__format__(gnu_printf, 3, 0)))
139#else
140 __attribute__((__format__(printf, 3, 0)))
141#endif
142#else
143 __attribute__((__format__(printf, 3, 0))) 128 __attribute__((__format__(printf, 3, 0)))
144#endif 129#endif
145#endif
146 ; 130 ;
147 131
148/** 132/**
@@ -164,16 +148,8 @@ void __android_log_assert(const char* cond, const char* tag, const char* fmt,
164 ...) 148 ...)
165#if defined(__GNUC__) 149#if defined(__GNUC__)
166 __attribute__((__noreturn__)) 150 __attribute__((__noreturn__))
167#ifdef __USE_MINGW_ANSI_STDIO
168#if __USE_MINGW_ANSI_STDIO
169 __attribute__((__format__(gnu_printf, 3, 4)))
170#else
171 __attribute__((__format__(printf, 3, 4)))
172#endif
173#else
174 __attribute__((__format__(printf, 3, 4))) 151 __attribute__((__format__(printf, 3, 4)))
175#endif 152#endif
176#endif
177 ; 153 ;
178 154
179#ifndef log_id_t_defined 155#ifndef log_id_t_defined