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".
This commit is contained in:
Mike Frysinger 2021-05-29 17:57:55 -04:00
parent 1f8ef36f75
commit 952170707b
5 changed files with 16 additions and 16 deletions

View 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../..

View 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 {

View 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,

View 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

View 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