Avoid warnings by using format(__printf__)
When building sandbox, barebox is built with -Dprintf=barebox_printf as
to not collide with the printf provided by libc. This would also match
the format(printf) function __attribute__.
Since gcc documents that __printf__ can be used instead of printf as a
format attribute, use this instead and avoid a lot of noisy warnings.
NB: this relates to 6b082cfe9f
which was
an earlier attempt at solving this, which got reverted due to other
regressions.
Signed-off-by: Loïc Minier <loic.minier@linaro.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
4e26fba680
commit
3808cb7a45
|
@ -9,7 +9,7 @@
|
|||
*/
|
||||
|
||||
/* serial stuff */
|
||||
void serial_printf(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
|
||||
void serial_printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
|
||||
|
||||
/* stdin */
|
||||
int tstc(void);
|
||||
|
@ -30,12 +30,12 @@ static inline void putchar(char c)
|
|||
console_putc(CONSOLE_STDOUT, c);
|
||||
}
|
||||
|
||||
int printf(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
|
||||
int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
|
||||
int vprintf(const char *fmt, va_list args);
|
||||
int sprintf(char *buf, const char *fmt, ...) __attribute__ ((format(printf, 2, 3)));
|
||||
int snprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(printf, 3, 4)));
|
||||
int sprintf(char *buf, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3)));
|
||||
int snprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(__printf__, 3, 4)));
|
||||
int vsprintf(char *buf, const char *fmt, va_list args);
|
||||
char *asprintf(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
|
||||
char *asprintf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
|
||||
char *vasprintf(const char *fmt, va_list ap);
|
||||
int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
|
||||
int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
|
||||
|
@ -54,7 +54,7 @@ int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
|
|||
#define stderr 2
|
||||
#define MAX_FILES 128
|
||||
|
||||
void fprintf(int file, const char *fmt, ...) __attribute__ ((format(printf, 2, 3)));
|
||||
void fprintf(int file, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3)));
|
||||
int fputs(int file, const char *s);
|
||||
int fputc(int file, const char c);
|
||||
int ftstc(int file);
|
||||
|
|
|
@ -1300,7 +1300,7 @@ static void read_symbols(char *modname)
|
|||
* following helper, then compare to the file on disk and
|
||||
* only update the later if anything changed */
|
||||
|
||||
void __attribute__((format(printf, 2, 3))) buf_printf(struct buffer *buf,
|
||||
void __attribute__((format(__printf__, 2, 3))) buf_printf(struct buffer *buf,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
char tmp[SZ];
|
||||
|
|
|
@ -94,7 +94,7 @@ struct buffer {
|
|||
int size;
|
||||
};
|
||||
|
||||
void __attribute__((format(printf, 2, 3)))
|
||||
void __attribute__((format(__printf__, 2, 3)))
|
||||
buf_printf(struct buffer *buf, const char *fmt, ...);
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue