From patchwork Tue Dec 5 04:46:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 81332 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7DAFE388217B for ; Tue, 5 Dec 2023 04:47:46 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id A82293858D33 for ; Tue, 5 Dec 2023 04:47:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A82293858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A82293858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.211.166.183 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701751653; cv=none; b=q/4vDF2xkRYQyz7RGHIqew9h5FK7cSGJb55au1lSLRDsY0CDcHq01Vph8h6yTsMXigEwxpkHTT4ia7kZ0wX8M7Lr91mJkPEQwCE4hyIJeH8ii9bvHftz/ACGYd8GwrN6ENqhWqpQieD46FAUDoQOcMyAbfEkd55RKefYcvi7ZBw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701751653; c=relaxed/simple; bh=TkMBa9yJTGWr/t6Zlna6C4HmqDckCUS/jxOXuJ5gDIw=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Hw2iCEIoaMUISS19svp131lhUJjknf+wG21UCbDTxcRTH/jiBkrDV91MEE4wUsZkTydgq+ZRPPzIEurO9G7YGq039F8PbesbeZBiT2mb8HHa9kpwsvJAMDJ75pCDo7vpmtVtS8TG4Pd4fjtNYBAKovbg/ACx67atfZlH77p5fMs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by smtp.gentoo.org (Postfix, from userid 559) id EA8AD335D6E; Tue, 5 Dec 2023 04:47:22 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH 1/3 committed] sim: ppc: cleanup getrusage decls Date: Mon, 4 Dec 2023 23:46:14 -0500 Message-ID: <20231205044616.4000-1-vapier@gentoo.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org 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 -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 #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 8ab42af84589..8bbabe6e50d4 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"