public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: James Le Cuirot <chewi@gentoo.org>
To: gentoo-dev <gentoo-dev@lists.gentoo.org>
Cc: James Le Cuirot <chewi@gentoo.org>
Subject: [gentoo-dev] [PATCH] toolchain-funcs.eclass: Add functions to get pointer size in bytes
Date: Mon,  6 Nov 2023 22:25:02 +0000	[thread overview]
Message-ID: <20231106222527.25833-1-chewi@gentoo.org> (raw)

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 <chewi@gentoo.org>
---
 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



             reply	other threads:[~2023-11-06 22:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06 22:25 James Le Cuirot [this message]
2023-11-08  6:44 ` [gentoo-dev] [PATCH] toolchain-funcs.eclass: Add functions to get pointer size in bytes Sam James

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=20231106222527.25833-1-chewi@gentoo.org \
    --to=chewi@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.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