[Pdbg] [PATCH] debug: Add printf attribute to logging function

Joel Stanley joel at jms.id.au
Fri Jun 1 13:43:04 AEST 2018


On 1 June 2018 at 12:59, Alistair Popple <alistair at popple.id.au> wrote:
> Thanks Joel, it seems I get the following warnings/errors after applying this:
>
> In file included from libpdbg/operations.h:21:0,
>                  from libpdbg/cfam.c:24:
> libpdbg/cfam.c: In function ‘opb_poll’:
> libpdbg/debug.h:32:23: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t {aka long unsigned int}’ [-Werror=format=]
>   pdbg_log(PDBG_DEBUG, "%s[%d]: " x, __FUNCTION__, __LINE__, ##args)
>                        ^
> libpdbg/cfam.c:146:3: note: in expansion of macro ‘PR_DEBUG’
>    PR_DEBUG("  STAT=0x%16llx...\n", sval);
>    ^~~~~~~~
> libpdbg/cfam.c: In function ‘p8_opb_read’:
> libpdbg/debug.h:32:23: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t {aka long unsigned int}’ [-Werror=format=]
>   pdbg_log(PDBG_DEBUG, "%s[%d]: " x, __FUNCTION__, __LINE__, ##args)
>                        ^
> libpdbg/cfam.c:196:2: note: in expansion of macro ‘PR_DEBUG’
>   PR_DEBUG("MFSI_OPB_READ: Writing 0x%16llx\n", opb_cmd);
>   ^~~~~~~~
> libpdbg/cfam.c: In function ‘p8_opb_write’:
> libpdbg/debug.h:32:23: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t {aka long unsigned int}’ [-Werror=format=]
>   pdbg_log(PDBG_DEBUG, "%s[%d]: " x, __FUNCTION__, __LINE__, ##args)
>                        ^
> libpdbg/cfam.c:219:2: note: in expansion of macro ‘PR_DEBUG’
>   PR_DEBUG("MFSI_OPB_WRITE: Writing 0x%16llx\n", opb_cmd);
>   ^~~~~~~~
> cc1: all warnings being treated as errors

Cool, the patch works!

> But I have taken this patch and will roll the fixes for the above into it.

Cheers!

Joel


More information about the Pdbg mailing list