Re: [v2] xmon: Use __printf markup to silence compiler
From: Michael Ellerman
Date: Fri May 25 2018 - 08:00:44 EST
On Sun, 2018-03-25 at 09:06:47 UTC, Mathieu Malaterre wrote:
> Update the other prototype declarations in asm/xmon.h.
>
> Silence warnings (triggered at W=1) by adding relevant __printf attribute.
> Move #define at bottom of the file to prevent conflict with gcc attribute.
>
> Solve the original warning:
>
> arch/powerpc/xmon/nonstdio.c:178:2: error: function might be possible candidate for â??gnu_printfâ?? format attribute [-Werror=suggest-attribute=format]
>
> In turn this uncovered the following (partial list) warnings (treated as
> errors with W=1):
>
> arch/powerpc/xmon/xmon.c:2866:17: error: format â??%xâ?? expects argument of type â??unsigned intâ??, but argument 2 has type â??unsigned char *â?? [-Werror=format=]
> arch/powerpc/xmon/xmon.c:1607:31: error: format â??%lxâ?? expects argument of type â??long unsigned intâ??, but argument 4 has type â??struct pt_regs *â?? [-Werror=format=]
> arch/powerpc/xmon/xmon.c:1611:9: error: too many arguments for format [-Werror=format-extra-args]
> arch/powerpc/xmon/xmon.c:1623:26: error: format â??%lxâ?? expects argument of type â??long unsigned intâ??, but argument 2 has type â??struct task_struct *â?? [-Werror=format=]
> arch/powerpc/xmon/xmon.c:630:36: error: format â??%lxâ?? expects argument of type â??long unsigned intâ??, but argument 2 has type â??intâ?? [-Werror=format=]
> arch/powerpc/xmon/xmon.c:1392:15: error: format â??%xâ?? expects argument of type â??unsigned intâ??, but argument 2 has type â??long intâ?? [-Werror=format=]
> arch/powerpc/xmon/xmon.c:2570:16: error: format â??%lxâ?? expects argument of type â??long unsigned intâ??, but argument 3 has type â??u64 {aka long long unsigned int}â?? [-Werror=format=]
> arch/powerpc/xmon/xmon.c:1629:25: error: format â??%ldâ?? expects argument of type â??long intâ??, but argument 2 has type â??pid_t {aka int}â?? [-Werror=format=]
> arch/powerpc/xmon/xmon.c:1168:18: error: format â??%xâ?? expects argument of type â??unsigned intâ??, but argument 2 has type â??long unsigned intâ?? [-Werror=format=]
> arch/powerpc/xmon/xmon.c:3016:24: error: format â??%lxâ?? expects argument of type â??long unsigned intâ??, but argument 2 has type â??pgd_t * {aka struct <anonymous> *}â?? [-Werror=format=]
> arch/powerpc/xmon/xmon.c:2339:9: error: format â??%lxâ?? expects argument of type â??long unsigned intâ??, but argument 5 has type â??u64 {aka long long unsigned int}â?? [-Werror=format=]
> arch/powerpc/xmon/xmon.c:2339:9: error: format â??%llxâ?? expects argument of type â??long long unsigned intâ??, but argument 5 has type â??long unsigned intâ?? [-Werror=format=]
> arch/powerpc/xmon/xmon.c:3827:10: error: format â??%pâ?? expects argument of type â??void *â??, but argument 4 has type â??long long unsigned intâ?? [-Werror=format=]
> arch/powerpc/xmon/xmon.c:3896:50: error: format â??%dâ?? expects argument of type â??intâ??, but argument 2 has type â??long unsigned intâ?? [-Werror=format=]
> arch/powerpc/xmon/spu-dis.c:137:18: error: format â??%dâ?? expects argument of type â??intâ??, but argument 2 has type â??long unsigned intâ?? [-Werror=format=]
> arch/powerpc/xmon/xmon.c:3827:10: error: format â??%dâ?? expects argument of type â??intâ??, but argument 4 has type â??u64 {aka long long unsigned int}â?? [-Werror=format=]
> arch/powerpc/xmon/xmon.c:1665:17: error: format â??%ldâ?? expects argument of type â??long intâ??, but argument 2 has type â??intâ?? [-Werror=format=]
> arch/powerpc/xmon/xmon.c:2339:9: error: '#' flag used with â??%pâ?? gnu_printf format [-Werror=format=]
>
> Signed-off-by: Mathieu Malaterre <malat@xxxxxxxxxx>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/e70d8f55268ba95f00c61857df2bab
cheers