From 952170707bb525babcd48f6e907512e36a4982ca Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 29 May 2021 17:57:55 -0400 Subject: sim: ppc: avoid shadowing errno If the OS headers define the "errno" symbol, it breaks some of these funcs that were using "int errno" itself. Rename local vars to "err" to avoid that, and delete the old "extern int errno". --- sim/ppc/ChangeLog | 8 ++++++++ sim/ppc/emul_generic.c | 12 ++++++------ sim/ppc/emul_generic.h | 4 ++-- sim/ppc/emul_netbsd.c | 4 ---- sim/ppc/emul_unix.c | 4 ---- 5 files changed, 16 insertions(+), 16 deletions(-) (limited to 'sim/ppc') diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index 15b50ef..501b9f8 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,5 +1,13 @@ 2021-05-29 Mike Frysinger + * emul_generic.c (emul_write_status): Rename errno to err. + (emul_write2_status): Likewise. + * emul_generic.h (emul_write_status, emul_write2_status): Likewise. + * emul_netbsd.c (errno): Delete. + * emul_unix.c (errno): Delete. + +2021-05-29 Mike Frysinger + * Makefile.in (INCLUDES): Add -I../.. 2021-05-16 Mike Frysinger diff --git a/sim/ppc/emul_generic.c b/sim/ppc/emul_generic.c index 64c0219..0018cea 100644 --- a/sim/ppc/emul_generic.c +++ b/sim/ppc/emul_generic.c @@ -120,10 +120,10 @@ emul_read_string(char *dest, INLINE_EMUL_GENERIC void emul_write_status(cpu *processor, int status, - int errno) + int err) { - if (status == -1 && errno != 0) { - cpu_registers(processor)->gpr[3] = errno; + if (status == -1 && err != 0) { + cpu_registers(processor)->gpr[3] = err; CR_SET(0, cr_i_summary_overflow); } else { @@ -137,10 +137,10 @@ INLINE_EMUL_GENERIC void emul_write2_status(cpu *processor, int status1, int status2, - int errno) + int err) { - if (status1 == -1 && errno != 0) { - cpu_registers(processor)->gpr[3] = errno; + if (status1 == -1 && err != 0) { + cpu_registers(processor)->gpr[3] = err; CR_SET(0, cr_i_summary_overflow); } else { diff --git a/sim/ppc/emul_generic.h b/sim/ppc/emul_generic.h index 9ea23d4..8e0ebca 100644 --- a/sim/ppc/emul_generic.h +++ b/sim/ppc/emul_generic.h @@ -123,13 +123,13 @@ INLINE_EMUL_GENERIC void emul_write_gpr64 INLINE_EMUL_GENERIC void emul_write_status (cpu *processor, int status, - int errno); + int err); INLINE_EMUL_GENERIC void emul_write2_status (cpu *processor, int status1, int status2, - int errno); + int err); INLINE_EMUL_GENERIC char *emul_read_string (char *dest, diff --git a/sim/ppc/emul_netbsd.c b/sim/ppc/emul_netbsd.c index 4d9f32d..a97fc3b 100644 --- a/sim/ppc/emul_netbsd.c +++ b/sim/ppc/emul_netbsd.c @@ -98,10 +98,6 @@ extern int getdirentries(int fd, char *buf, int nbytes, long *basep); #undef HAVE_GETDIRENTRIES #endif -#if (BSD < 199306) /* here BSD as just a bug */ -extern int errno; -#endif - #ifndef STATIC_INLINE_EMUL_NETBSD #define STATIC_INLINE_EMUL_NETBSD STATIC_INLINE #endif diff --git a/sim/ppc/emul_unix.c b/sim/ppc/emul_unix.c index 79ef7bc..cfcb469 100644 --- a/sim/ppc/emul_unix.c +++ b/sim/ppc/emul_unix.c @@ -124,10 +124,6 @@ int getrusage(); #include #include -#if defined(BSD) && !defined(errno) && (BSD < 199306) /* here BSD as just a bug */ -extern int errno; -#endif - #ifndef STATIC_INLINE_EMUL_UNIX #define STATIC_INLINE_EMUL_UNIX STATIC_INLINE #endif -- cgit v1.1