aboutsummaryrefslogtreecommitdiff
path: root/sim/ppc
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-05-29 17:57:55 -0400
committerMike Frysinger <vapier@gentoo.org>2021-05-29 18:05:20 -0400
commit952170707bb525babcd48f6e907512e36a4982ca (patch)
treed393a7d0b1994e46d3f229352e2c0c90fb8590ed /sim/ppc
parent1f8ef36f752871485e6e462dc1cfaa8ac5058011 (diff)
downloadfsf-binutils-gdb-952170707bb525babcd48f6e907512e36a4982ca.zip
fsf-binutils-gdb-952170707bb525babcd48f6e907512e36a4982ca.tar.gz
fsf-binutils-gdb-952170707bb525babcd48f6e907512e36a4982ca.tar.bz2
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".
Diffstat (limited to 'sim/ppc')
-rw-r--r--sim/ppc/ChangeLog8
-rw-r--r--sim/ppc/emul_generic.c12
-rw-r--r--sim/ppc/emul_generic.h4
-rw-r--r--sim/ppc/emul_netbsd.c4
-rw-r--r--sim/ppc/emul_unix.c4
5 files changed, 16 insertions, 16 deletions
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 <vapier@gentoo.org>
+ * 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 <vapier@gentoo.org>
+
* Makefile.in (INCLUDES): Add -I../..
2021-05-16 Mike Frysinger <vapier@gentoo.org>
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 <stdlib.h>
#include <time.h>
-#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