From e9c4e838967dec1433bdf3dbe2614b45c5e59efa Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 5 Oct 2011 11:43:29 +1100 Subject: [PATCH] treewide-use-__printf-not-__attribute__formatprintf-fix After merging the akpm tree, today's linux-next build (powerpc ppc64_defconfig) failed like this: In file included from arch/powerpc/boot/stdio.c:12:0: arch/powerpc/boot/stdio.h:10:17: error: expected declaration specifiers or '...' before numeric constant arch/powerpc/boot/stdio.h:10:20: error: expected declaration specifiers or '...' before numeric constant arch/powerpc/boot/stdio.h:10:8: warning: return type defaults to 'int' arch/powerpc/boot/stdio.h:10:8: warning: function declaration isn't a prototype arch/powerpc/boot/stdio.h: In function '__printf': arch/powerpc/boot/stdio.h:14:17: error: expected declaration specifiers or '...' before numeric constant arch/powerpc/boot/stdio.h:14:20: error: expected declaration specifiers or '...' before numeric constant arch/powerpc/boot/stdio.h:14:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int' arch/powerpc/boot/stdio.h:16:12: error: storage class specified for parameter 'vsprintf' Reported-by: Stephen Rothwell Cc: Joe Perches Signed-off-by: Andrew Morton --- arch/powerpc/boot/ps3.c | 3 ++- arch/powerpc/boot/stdio.h | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/boot/ps3.c b/arch/powerpc/boot/ps3.c index 7e3f94cc338d..9954d98871d0 100644 --- a/arch/powerpc/boot/ps3.c +++ b/arch/powerpc/boot/ps3.c @@ -36,7 +36,8 @@ extern int lv1_get_repository_node_value(u64 in_1, u64 in_2, u64 in_3, #ifdef DEBUG #define DBG(fmt...) printf(fmt) #else -static inline __printf(1, 2) int DBG(const char *fmt, ...) {return 0;} +static inline int __attribute__ ((format (printf, 1, 2))) DBG( + const char *fmt, ...) {return 0;} #endif BSS_STACK(4096); diff --git a/arch/powerpc/boot/stdio.h b/arch/powerpc/boot/stdio.h index 756fc04331c4..adffc58412d4 100644 --- a/arch/powerpc/boot/stdio.h +++ b/arch/powerpc/boot/stdio.h @@ -7,11 +7,12 @@ #define EINVAL 22 /* Invalid argument */ #define ENOSPC 28 /* No space left on device */ -extern __printf(1, 2) int printf(const char *fmt, ...); +extern int printf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); #define fprintf(fmt, args...) printf(args) -extern __printf(2, 3) int sprintf(char *buf, const char *fmt, ...); +extern int sprintf(char *buf, const char *fmt, ...) + __attribute__((format(printf, 2, 3))); extern int vsprintf(char *buf, const char *fmt, va_list args); -- 2.39.5