From a3d3d9a7d9e0d5bf6168180f4f1b68ed37968f94 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 4 Dec 2023 23:32:51 -0500 Subject: [PATCH] sim: ppc: cleanup getrusage decls Don't conflate HAVE_GETRUSAGE & HAVE_SYS_RESOURCE_H. Use the latter to include the header and nothing else. Use the former to determine whether to use the function and nothing else. If we find a system that doesn't follow POSIX and provides only one of these, we can figure out how to support it then. The manual local definition is clashing with the system ones and leading to build failures with newer C standards. sim/ppc/emul_netbsd.c:51:5: error: a function declaration without a prototype is deprecated in all versions of C and is treated as a zero-parameter prototype in C2x, conflicting with a previous declaration [-Werror,-Wdeprecated-non-prototype] --- sim/ppc/emul_netbsd.c | 9 +-------- sim/ppc/emul_unix.c | 9 +-------- sim/ppc/mon.c | 1 - 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/sim/ppc/emul_netbsd.c b/sim/ppc/emul_netbsd.c index 51f8e98ae32..950f1f4a696 100644 --- a/sim/ppc/emul_netbsd.c +++ b/sim/ppc/emul_netbsd.c @@ -40,15 +40,8 @@ #include "emul_generic.h" #include "emul_netbsd.h" -#ifdef HAVE_GETRUSAGE -#ifndef HAVE_SYS_RESOURCE_H -#undef HAVE_GETRUSAGE -#endif -#endif - -#ifdef HAVE_GETRUSAGE +#ifdef HAVE_SYS_RESOURCE_H #include -int getrusage(); #endif #if HAVE_SYS_IOCTL_H diff --git a/sim/ppc/emul_unix.c b/sim/ppc/emul_unix.c index be9e8385f52..88f6e3abc0a 100644 --- a/sim/ppc/emul_unix.c +++ b/sim/ppc/emul_unix.c @@ -87,15 +87,8 @@ #include #endif -#ifdef HAVE_GETRUSAGE -#ifndef HAVE_SYS_RESOURCE_H -#undef HAVE_GETRUSAGE -#endif -#endif - -#ifdef HAVE_GETRUSAGE +#ifdef HAVE_SYS_RESOURCE_H #include -int getrusage(); #endif #if HAVE_DIRENT_H diff --git a/sim/ppc/mon.c b/sim/ppc/mon.c index 8ab42af8458..8bbabe6e50d 100644 --- a/sim/ppc/mon.c +++ b/sim/ppc/mon.c @@ -36,7 +36,6 @@ #ifdef HAVE_SYS_RESOURCE_H #include -int getrusage(); #endif #include "basics.h"