]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: ppc: fix Wnonnull warning
authorTom de Vries <tdevries@suse.de>
Wed, 19 May 2021 16:42:59 +0000 (18:42 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 19 May 2021 16:42:59 +0000 (18:42 +0200)
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.

sim/ppc/emul_netbsd.c

index 0135a93298b8a38d5175d32d39646ba7053f465a..4d9f32d52bed66fbb8e7d1ed644e36255e831bef 100644 (file)
@@ -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])