public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/3 committed] sim: ppc: cleanup getrusage decls
Date: Mon,  4 Dec 2023 23:46:14 -0500	[thread overview]
Message-ID: <20231205044616.4000-1-vapier@gentoo.org> (raw)

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 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"
-- 
2.43.0


             reply	other threads:[~2023-12-05  4:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-05  4:46 Mike Frysinger [this message]
2023-12-05  4:46 ` [PATCH 2/3 committed] sim: ppc: fix -Wmisleading-indentation warnings Mike Frysinger
2023-12-05  4:46 ` [PATCH 3/3 committed] sim: ppc: fix implicit enum conversion Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231205044616.4000-1-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).