From: Tom de Vries Date: Wed, 19 May 2021 16:42:59 +0000 (+0200) Subject: sim: ppc: fix Wnonnull warning X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bfff0efb3d8283a48825abc1701bb39a56d223c5;p=binutils-gdb.git sim: ppc: fix Wnonnull warning 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. --- 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])