From: Florian Weimer <fweimer@redhat.com>
To: Joseph Myers <joseph@codesourcery.com>
Cc: <libc-alpha@sourceware.org>
Subject: Re: Declare asctime_r, ctime_r, gmtime_r, localtime_r for C2X
Date: Mon, 11 Nov 2019 10:55:43 +0100 [thread overview]
Message-ID: <87sgmuybxc.fsf@oldenburg2.str.redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1911082048450.17641@digraph.polyomino.org.uk> (Joseph Myers's message of "Fri, 8 Nov 2019 20:49:28 +0000")
* Joseph Myers:
> C2X adds the asctime_r, ctime_r, gmtime_r and localtime_r functions.
> This patch duly adds __GLIBC_USE (ISOC2X) to the conditions under
> which <time.h> declares them.
>
> Tested for x86_64.
>
> diff --git a/time/time.h b/time/time.h
> index 7daaacce16..05d9098c13 100644
> --- a/time/time.h
> +++ b/time/time.h
> @@ -122,7 +122,7 @@ extern struct tm *gmtime (const time_t *__timer) __THROW;
> of *TIMER in the local timezone. */
> extern struct tm *localtime (const time_t *__timer) __THROW;
>
> -#ifdef __USE_POSIX
> +#if defined __USE_POSIX || __GLIBC_USE (ISOC2X)
> /* Return the `struct tm' representation of *TIMER in UTC,
> using *TP to store the result. */
> extern struct tm *gmtime_r (const time_t *__restrict __timer,
> @@ -132,7 +132,7 @@ extern struct tm *gmtime_r (const time_t *__restrict __timer,
> using *TP to store the result. */
> extern struct tm *localtime_r (const time_t *__restrict __timer,
> struct tm *__restrict __tp) __THROW;
> -#endif /* POSIX */
> +#endif /* POSIX || C2X */
>
> /* Return a string of the form "Day Mon dd hh:mm:ss yyyy\n"
> that is the representation of TP in this format. */
> @@ -141,7 +141,7 @@ extern char *asctime (const struct tm *__tp) __THROW;
> /* Equivalent to `asctime (localtime (timer))'. */
> extern char *ctime (const time_t *__timer) __THROW;
>
> -#ifdef __USE_POSIX
> +#if defined __USE_POSIX || __GLIBC_USE (ISOC2X)
> /* Reentrant versions of the above functions. */
>
> /* Return in BUF a string of the form "Day Mon dd hh:mm:ss yyyy\n"
> @@ -152,7 +152,7 @@ extern char *asctime_r (const struct tm *__restrict __tp,
> /* Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'. */
> extern char *ctime_r (const time_t *__restrict __timer,
> char *__restrict __buf) __THROW;
> -#endif /* POSIX */
> +#endif /* POSIX || C2X */
>
>
> /* Defined in localtime.c. */
This patch is okay. Thanks.
Note that this is the kind of patch where a patch review tool actually
helps because the context in the patch as posted is insufficient for
review.
Florian
prev parent reply other threads:[~2019-11-11 9:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-08 20:49 Declare asctime_r, ctime_r, gmtime_r, localtime_r for C2X Joseph Myers
2019-11-11 9:55 ` Florian Weimer [this message]
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
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sgmuybxc.fsf@oldenburg2.str.redhat.com \
--to=fweimer@redhat.com \
--cc=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).