]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: ppc: avoid shadowing errno
authorMike Frysinger <vapier@gentoo.org>
Sat, 29 May 2021 21:57:55 +0000 (17:57 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sat, 29 May 2021 22:05:20 +0000 (18:05 -0400)
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
sim/ppc/emul_generic.c
sim/ppc/emul_generic.h
sim/ppc/emul_netbsd.c
sim/ppc/emul_unix.c

index 15b50ef50d120b73883d25a8615b5f6f7ad90a88..501b9f8db9add85fbdb7171bfd797b95f8c7a0ed 100644 (file)
@@ -1,3 +1,11 @@
+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../..
index 64c0219309099fe4733bdc49b7b702f6d59a2c1a..0018cea324f16a7887871a190999c7324defc804 100644 (file)
@@ -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 {
index 9ea23d4cbd551ee0a2344767d103a94bf4837fb4..8e0ebcaabd3320c4f15bac6013835bda7f1759f8 100644 (file)
@@ -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,
index 4d9f32d52bed66fbb8e7d1ed644e36255e831bef..a97fc3b64609d0d32ce9191462849363e4b6e57f 100644 (file)
@@ -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
index 79ef7bc7c9caf343c9cfbaf8a691aaca93340f0b..cfcb4691247630bc3c18460872ffc8086df046b0 100644 (file)
@@ -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