From patchwork Tue Aug 1 22:27:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 129513 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp51753vqx; Tue, 1 Aug 2023 15:28:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlH/8vuKIpOO4XZEPlpWRX4U5SpNsZiGpmMFMEKqnSLNC7VnNygJwTmq9WGejbxGAKbPcTKL X-Received: by 2002:a17:907:2c44:b0:997:e9a3:9c4f with SMTP id hf4-20020a1709072c4400b00997e9a39c4fmr4577379ejc.30.1690928893420; Tue, 01 Aug 2023 15:28:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690928893; cv=none; d=google.com; s=arc-20160816; b=J6Md9j0frNUzD5C5q7iis05at2KCaV+RaznbAb/3GCUO2sIgZ6NQGhjUjxXHlZTDN3 7aO9FVXC8TqG7t+R1biwDrsdnEUjUQkI5muv62eyFelz3hhMKiGxqVNHWQ8SJHavU40g 2znThK9YQJuQYYBwZoDc0lL/pbD2tvHUa9RNsneKMV/Hmodz0kpACRiiy5Z3iq7AWeXL sOBoF2IbAd6QdGEzdXZ9nV+er2SNingd8TYuH8VL8Vndrql7Rad7xtscBifxYKggQPDM UIIiQ3TITAOj7NGcl0z/PuaW+mlH9+blnYEqbY7k8EBxcPhMfpSQkTFXS1B99Zg/KQqU mumg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=uOBB309WTLC49g1+2PxHwU7bApq0n+RXZaoFZ1PS5wY=; fh=HNIqzTA9Dp00ovCAyCdXfuEvWDT00OlFxFRPLybXRis=; b=YE6u+doF3vJSgI5s1Q5sUQJogSh7oNzgU6EES6tyfmgKMDzH1dMaK8upK7mqX95Kvd X7y6PB97GBiTAOxKTbfMQ9aJrLjAMZFxuT21pMfS7XXBmzSLsloStwzeckLia83/Z4VH zg+L/gAtpRibGLQwWIKXI7FinaToqjiYaCuBssSvaV8S5mqPC0Dz93l7kclst8xu6CuZ cZWfebF5r8X6hxRG5ja22e4S81oM0bbjoreljnLWoXFib2pSC5eSF1Hozyn8TlAnROJK vRK4v+0rRfF5TuheXPcX5E1SVbalT7VA+IafOio8ma18hQq2gth/7prrcLzpcY+v765r e8BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=bdzYBbx+; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id s11-20020a170906a18b00b0099b41fa79f3si8868875ejy.331.2023.08.01.15.28.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 15:28:13 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=bdzYBbx+; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1E40E385841C for ; Tue, 1 Aug 2023 22:28:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1E40E385841C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1690928892; bh=uOBB309WTLC49g1+2PxHwU7bApq0n+RXZaoFZ1PS5wY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=bdzYBbx+H3eRovTlOGwEjr/cUNVFSN/9Opby7BrrI0/rQvQ2/X1wlKqk0qGvEmzpw 5w1qB69PYppbtEx+bmXESUIW+Q3v+Bpj5OTTOZ8HsVcEDZyop5NqV4mlh4NCcuc1XH KzPD9AnTPAhFjIx8mfg3HDw3g/n9sJpIu1TZKtxM= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by sourceware.org (Postfix) with ESMTPS id B14E63858D28 for ; Tue, 1 Aug 2023 22:28:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B14E63858D28 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-68706b39c4cso3652996b3a.2 for ; Tue, 01 Aug 2023 15:28:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690928882; x=1691533682; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uOBB309WTLC49g1+2PxHwU7bApq0n+RXZaoFZ1PS5wY=; b=VKpxbJZ/psq602BzL7CtbGpu79ZObjDqxi9YnrbKyhkawfJtjTi6OUemHhAgViFK5h zrVhhmTQNYMrpmtlASJnYkj2xNIZ2REqs6zeOFDA7DzpO57OHQ/g6qu+/P+98IfMDEkM eM0zvMKRm8hVyGennyNPEpBVkMnd85SBmqZ/uw140jeoAaK/Z+7K3id2FUQ+mpG7T+WD UEcNgzCy5877gZkrNxLQUMuvLtJ9oOjShhMEOnat8Hzme0ZZ1aQVbQ0aGob7CJsYu6Ng MQnX1po9SChKC93kbyFJjMZ6gX6bpRjOi5D8nYRt851twpyljqVQpi3ZggEd75beETwU h3Fg== X-Gm-Message-State: ABy/qLZAERNrK6vMZe9Oxt4r33JbUcMV/7Lr2MlsebfCpvgdegrrUSve C1ULdQr+DZ0p47QqhxDRyZNEYAqZYto= X-Received: by 2002:a05:6a20:1615:b0:137:53d1:3e2 with SMTP id l21-20020a056a20161500b0013753d103e2mr15940421pzj.41.1690928882187; Tue, 01 Aug 2023 15:28:02 -0700 (PDT) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id u17-20020aa78491000000b006870ff20254sm7775387pfn.125.2023.08.01.15.28.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 15:28:01 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 0C11111403B1; Wed, 2 Aug 2023 07:57:59 +0930 (ACST) Date: Wed, 2 Aug 2023 07:57:59 +0930 To: binutils@sourceware.org Subject: Don't declare xmalloc or xrealloc in bucomm.h Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3034.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Alan Modra via Binutils From: Alan Modra Reply-To: Alan Modra Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773067455069209836 X-GMAIL-MSGID: 1773067455069209836 It's better to include the proper header, which has declarations with various attributes. Commit 096aefc040 in 1994 introduced this wart. * bucomm.h (xmalloc, xrealloc): Delete declaration. * od-macho.c: Include libiberty.h. * od-xcoff.c: Include libiberty.h. diff --git a/binutils/bucomm.h b/binutils/bucomm.h index 0c11c0b868d..b70879078ee 100644 --- a/binutils/bucomm.h +++ b/binutils/bucomm.h @@ -76,12 +76,6 @@ extern void set_times (const char *, const struct stat *); extern int smart_rename (const char *, const char *, int, struct stat *, bool); - -/* In libiberty. */ -void *xmalloc (size_t); - -void *xrealloc (void *, size_t); - #if __GNUC__ >= 7 #define _mul_overflow(a, b, res) __builtin_mul_overflow (a, b, res) #else diff --git a/binutils/od-macho.c b/binutils/od-macho.c index 17253d4f70b..c2bd7d38a89 100644 --- a/binutils/od-macho.c +++ b/binutils/od-macho.c @@ -23,6 +23,7 @@ #include #include #include "safe-ctype.h" +#include "libiberty.h" #include "bfd.h" #include "objdump.h" #include "bucomm.h" diff --git a/binutils/od-xcoff.c b/binutils/od-xcoff.c index 92d17e99fbf..e6b2f08c245 100644 --- a/binutils/od-xcoff.c +++ b/binutils/od-xcoff.c @@ -23,6 +23,7 @@ #include #include #include "safe-ctype.h" +#include "libiberty.h" #include "bfd.h" #include "objdump.h" #include "bucomm.h"