public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: James Le Cuirot <chewi@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] [PATCH] toolchain-funcs.eclass: Add tc-has-64bit-time_t
Date: Thu, 13 Jun 2024 17:44:15 +0100	[thread overview]
Message-ID: <c62e1f1e067d2cedac9c1b6bae13b2ffacd56d21.camel@gentoo.org> (raw)
In-Reply-To: <20240613152401.47691-1-mgorny@gentoo.org>

[-- Attachment #1: Type: text/plain, Size: 1663 bytes --]

On Thu, 2024-06-13 at 17:23 +0200, Michał Górny wrote:
> 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 <mgorny@gentoo.org>
> ---
>  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 <sys/types.h>
> +		int test[sizeof(time_t) >= 8 ? 1 : -1];
> +	EOF
> +	return $?
> +}
> +
>  fi

I take it this can't be done with tc-cpp-is-true because you need more than
just the preprocessor?

Please don't quote $(tc-getCC), CC can have additional arguments in some
cases. We don't quote $(tc-getTARGET_CPP) in tc-cpp-is-true.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 858 bytes --]

  reply	other threads:[~2024-06-13 16:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13 15:23 [gentoo-dev] [PATCH] toolchain-funcs.eclass: Add tc-has-64bit-time_t Michał Górny
2024-06-13 16:44 ` James Le Cuirot [this message]
2024-06-13 17:06   ` Michał Górny
2024-06-13 16:48 ` Ulrich Mueller

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=c62e1f1e067d2cedac9c1b6bae13b2ffacd56d21.camel@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