[1/3,committed] sim: ppc: cleanup getrusage decls

Message ID 20231205044616.4000-1-vapier@gentoo.org
State New
Headers
Series [1/3,committed] sim: ppc: cleanup getrusage decls |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 warning Patch is already merged
linaro-tcwg-bot/tcwg_gdb_build--master-arm warning Patch is already merged

Commit Message

Mike Frysinger Dec. 5, 2023, 4:46 a.m. UTC
  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(-)
  

Patch

diff --git a/sim/ppc/emul_netbsd.c b/sim/ppc/emul_netbsd.c
index 51f8e98ae32b..950f1f4a696a 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 <sys/resource.h>
-int getrusage();
 #endif
 
 #if HAVE_SYS_IOCTL_H
diff --git a/sim/ppc/emul_unix.c b/sim/ppc/emul_unix.c
index be9e8385f526..88f6e3abc0a2 100644
--- a/sim/ppc/emul_unix.c
+++ b/sim/ppc/emul_unix.c
@@ -87,15 +87,8 @@ 
 #include <sys/termio.h>
 #endif
 
-#ifdef HAVE_GETRUSAGE
-#ifndef HAVE_SYS_RESOURCE_H
-#undef HAVE_GETRUSAGE
-#endif
-#endif
-
-#ifdef HAVE_GETRUSAGE
+#ifdef HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
-int getrusage();
 #endif
 
 #if HAVE_DIRENT_H
diff --git a/sim/ppc/mon.c b/sim/ppc/mon.c
index 8ab42af84589..8bbabe6e50d4 100644
--- a/sim/ppc/mon.c
+++ b/sim/ppc/mon.c
@@ -36,7 +36,6 @@ 
 
 #ifdef HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
-int getrusage();
 #endif
 
 #include "basics.h"