[PATCH 2/3] sim: callback: add printf attributes

Mike Frysinger vapier@gentoo.org
Tue Jun 29 14:32:07 GMT 2021


On 29 Jun 2021 07:01, Aktemur, Tankut Baris wrote:
> On Monday, June 28, 2021 5:25 AM, Mike Frysinger wrote:
> > This helps these funcs get printf format checking coverage.
> > 
> > The sim-io.c hack as a result is a bit unfortunate, but the compiler
> > throws warnings when printing with empty strings.  In this one case,
> > we actually want that due to the side-effect of the callback halting
> > execution for us.
> > ---
> >  include/sim/callback.h | 12 ++++++++----
> >  sim/common/sim-io.c    |  3 ++-
> >  2 files changed, 10 insertions(+), 5 deletions(-)
> 
> This patch resulted in the following build error:
> 
> /path/to/sim/ppc/sim_calls.c: In function ‘sim_io_error’:
> /path/to/sim/ppc/sim_calls.c:382:32: error: zero-length gnu_printf format string [-Werror=format-zero-length]
>    callbacks->error (callbacks, "");
>                                 ^~
> /path/to/sim/ppc/sim_calls.c: In function ‘error’:
> /path/to/sim/ppc/sim_calls.c:394:32: error: zero-length gnu_printf format string [-Werror=format-zero-length]
>    callbacks->error (callbacks, "");
>                                 ^~

are you forcing extra -W flags in your build ?
-mike


More information about the Gdb-patches mailing list