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)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D75E915817D for ; Thu, 13 Jun 2024 15:24:11 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E1963E2AD9; Thu, 13 Jun 2024 15:24:07 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (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 1BA9AE2AD1 for ; Thu, 13 Jun 2024 15:24:07 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH] toolchain-funcs.eclass: Add tc-has-64bit-time_t Date: Thu, 13 Jun 2024 17:23:52 +0200 Message-ID: <20240613152401.47691-1-mgorny@gentoo.org> X-Mailer: git-send-email 2.45.2 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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: 88323ae1-fa01-47a5-a2a9-f8b4bd3f2397 X-Archives-Hash: 848b0b86011affd9327ca985a776bad7 Add a helper function to check whether time_t is 64-bit. This could be used e.g. to deselect tests that rely on timestamps exceeding Y2k38. It is meant to be more future-proof than hardcoding a list of 32-bit architectures, given the necessity of switching to 64-bit time_t in the future. Signed-off-by: Michał Górny --- eclass/toolchain-funcs.eclass | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) Pull-Request: https://github.com/gentoo/gentoo/pull/37142 diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass index cde84e6f34c8..3e20e956e9c2 100644 --- a/eclass/toolchain-funcs.eclass +++ b/eclass/toolchain-funcs.eclass @@ -1,4 +1,4 @@ -# Copyright 2002-2023 Gentoo Authors +# Copyright 2002-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: toolchain-funcs.eclass @@ -1251,4 +1251,14 @@ tc-is-lto() { return 1 } +# @FUNCTION: tc-has-64bit-time_t +# @RETURN: Shell true if time_t is at least 64 bits long, false otherwise +tc-has-64bit-time_t() { + "$(tc-getCC)" ${CFLAGS} ${CPPFLAGS} -c -x c - -o /dev/null <<-EOF &>/dev/null + #include + int test[sizeof(time_t) >= 8 ? 1 : -1]; + EOF + return $? +} + fi -- 2.45.2