public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] sim: ppc: fix Wnonnull warning
@ 2021-05-19 10:46 Tom de Vries
  2021-05-19 16:25 ` Mike Frysinger
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2021-05-19 10:46 UTC (permalink / raw)
  To: gdb-patches, andrew.burgess, vapier

Hi,

When compiling with --enable-werror and CFLAGS="-O0 -g -Wall", we run into:
...
src/sim/ppc/emul_netbsd.c: In function 'do_gettimeofday':
src/sim/ppc/emul_netbsd.c:770:16: error: null argument where non-null \
  required (argument 1) [-Werror=nonnull]
   int status = gettimeofday((t_addr != 0 ? &t : NULL),
                ^~~~~~~~~~~~
...

Fix this by unconditionally passing &t as first argument.

Any comments?

Thanks,
- Tom

sim: ppc: fix Wnonnull warning

---
 sim/ppc/emul_netbsd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sim/ppc/emul_netbsd.c b/sim/ppc/emul_netbsd.c
index 0135a93298b..4d9f32d52be 100644
--- a/sim/ppc/emul_netbsd.c
+++ b/sim/ppc/emul_netbsd.c
@@ -767,8 +767,7 @@ do_gettimeofday(os_emul_data *emul,
   unsigned_word tz_addr = cpu_registers(processor)->gpr[arg0+1];
   struct timeval t;
   struct timezone tz;
-  int status = gettimeofday((t_addr != 0 ? &t : NULL),
-			    (tz_addr != 0 ? &tz : NULL));
+  int status = gettimeofday(&t, (tz_addr != 0 ? &tz : NULL));
   int err = errno;
 
   if (WITH_TRACE && ppc_trace[trace_os_emul])

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] sim: ppc: fix Wnonnull warning
  2021-05-19 10:46 [PATCH] sim: ppc: fix Wnonnull warning Tom de Vries
@ 2021-05-19 16:25 ` Mike Frysinger
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger @ 2021-05-19 16:25 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches, andrew.burgess

looks good, thanks
-mike

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-19 16:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19 10:46 [PATCH] sim: ppc: fix Wnonnull warning Tom de Vries
2021-05-19 16:25 ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).