From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 29FF7158089 for ; Mon, 6 Nov 2023 22:25:52 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6AC9B2BC018; Mon, 6 Nov 2023 22:25:48 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0E6152BC013 for ; Mon, 6 Nov 2023 22:25:47 +0000 (UTC) From: James Le Cuirot To: gentoo-dev Cc: James Le Cuirot Subject: [gentoo-dev] [PATCH] toolchain-funcs.eclass: Add functions to get pointer size in bytes Date: Mon, 6 Nov 2023 22:25:02 +0000 Message-ID: <20231106222527.25833-1-chewi@gentoo.org> X-Mailer: git-send-email 2.41.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: cd6e04e4-3074-4735-aaf9-5745eaf58a91 X-Archives-Hash: b0110c7a375893e9a60a44eb35ac18dd tc-get-ptr-size for CHOST and tc-get-build-ptr-size for CBUILD. Closes: https://bugs.gentoo.org/328401 Signed-off-by: James Le Cuirot --- eclass/toolchain-funcs.eclass | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass index 8fef764ad597..5da93063866b 100644 --- a/eclass/toolchain-funcs.eclass +++ b/eclass/toolchain-funcs.eclass @@ -1216,4 +1216,18 @@ tc-get-c-rtlib() { return 0 } +# @FUNCTION: tc-get-ptr-size +# @RETURN: Size of a pointer in bytes for CHOST (e.g. 4 or 8). +tc-get-ptr-size() { + $(tc-getCPP) -P - <<< __SIZEOF_POINTER__ || + die "Could not determine CHOST pointer size" +} + +# @FUNCTION: tc-get-build-ptr-size +# @RETURN: Size of a pointer in bytes for CBUILD (e.g. 4 or 8). +tc-get-build-ptr-size() { + $(tc-getBUILD_CPP) -P - <<< __SIZEOF_POINTER__ || + die "Could not determine CBUILD pointer size" +} + fi -- 2.41.0