From f8261de1b22cc1a72ae18a2300df8b2cf7f027db Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 29 Jun 2021 21:45:13 -0400 Subject: sim: ppc: fix printf warnings This code hits some format-zero-length warnings, so hack the code like we did in the common layers. --- sim/ppc/ChangeLog | 6 ++++++ sim/ppc/main.c | 2 ++ sim/ppc/sim_calls.c | 10 ++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) (limited to 'sim') diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index b41d202..7a23d68 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,3 +1,9 @@ +2021-06-29 Mike Frysinger + + * main.c (sim_io_error): Add comment + * sim_calls.c (sim_io_error): Likewise. Change "" to " ". + (error): Likewise. + 2021-06-20 Mike Frysinger * Makefile.in (INLINE_CFLAGS): Change to $(SIM_INLINE). diff --git a/sim/ppc/main.c b/sim/ppc/main.c index 0c1a070..2d4d7e4 100644 --- a/sim/ppc/main.c +++ b/sim/ppc/main.c @@ -214,6 +214,8 @@ sim_io_flush_stdoutput(void) } } +/* Glue to use sim-fpu module. */ + void sim_io_error (SIM_DESC sd, const char *msg, ...) { diff --git a/sim/ppc/sim_calls.c b/sim/ppc/sim_calls.c index 14d4d65..ee9d123 100644 --- a/sim/ppc/sim_calls.c +++ b/sim/ppc/sim_calls.c @@ -372,6 +372,8 @@ sim_io_flush_stdoutput(void) } } +/* Glue to use sim-fpu module. */ + void sim_io_error (SIM_DESC sd, const char *fmt, ...) { @@ -379,7 +381,9 @@ sim_io_error (SIM_DESC sd, const char *fmt, ...) va_start(ap, fmt); callbacks->evprintf_filtered (callbacks, fmt, ap); va_end(ap); - callbacks->error (callbacks, ""); + /* Printing a space here avoids empty printf compiler warnings. Not ideal, + but we want error's side-effect where it halts processing. */ + callbacks->error (callbacks, " "); } /****/ @@ -391,7 +395,9 @@ error (const char *msg, ...) va_start(ap, msg); callbacks->evprintf_filtered (callbacks, msg, ap); va_end(ap); - callbacks->error (callbacks, ""); + /* Printing a space here avoids empty printf compiler warnings. Not ideal, + but we want error's side-effect where it halts processing. */ + callbacks->error (callbacks, " "); } void * -- cgit v1.1