public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aoliva at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/77760] get_time needs to set tm_wday amd tm_yday
Date: Thu, 09 Feb 2023 23:40:32 +0000	[thread overview]
Message-ID: <bug-77760-4-8SgbW3x0B0@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-77760-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77760

--- Comment #5 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
I'm not entirely sure what the point of testing for __clang__ is, really.  Is
libstdc++ used with, or supposed to be used (say, as a system library) with
__clang__?  If so, wouldn't it be useful if it actually worked as expected? 
Currently, the code compiles just fine, though it fails to parse %I%p if
compiled with the actual __clang__ (or when __clang__ is defined on other
compilers for whatever reasons, but that's besides the point).  My thinking is
that either libstdc++ headers are to work with clang, in which case there's an
error in that bit, or they aren't, in which case the preprocessor test is
superfluous and, in this oddball case, harmful.

As for tm bits, my suggestion was to overwrite tm fields internally, not to
expose that externally.  They'd be used as scratch bits.  As in, member
functions in the public interface would not use incoming tm bits as
__time_get_state, but rather a zeroed-out __time_get_state structure, as today,
but when calling the internal implementation primitive do_get, they'd *blindly*
*overwrite* some of the tm bits with those from __time_get_state, and when
do-get returns, they'd pull them back into __time_get_state and out of tm. 
They'd be used as scratch bits, which AFAICT is permissible.  do_get, being
protected and thus more of an internal implementation bit, could make use of
those scratch bits.  do_get overriders could tweak them, for better or worse,
but since this use would be nonstandard, we could probably get away with
assuming any such uses to be libstdc++-specific.  It would probably not be wise
for users to rely on this internal extension, though, since one can hope the
standard will eventually  make room for an implementation of time_get that is
both standard-compliant and compatible with reasonable strptime expectations.

  parent reply	other threads:[~2023-02-09 23:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-77760-4@http.gcc.gnu.org/bugzilla/>
2021-12-15 19:43 ` jakub at gcc dot gnu.org
2022-01-10 14:40 ` cvs-commit at gcc dot gnu.org
2023-02-09  8:50 ` aoliva at gcc dot gnu.org
2023-02-09  9:08 ` jakub at gcc dot gnu.org
2023-02-09 23:40 ` aoliva at gcc dot gnu.org [this message]
2023-02-10  3:05 ` redi at gcc dot gnu.org
2023-02-10  8:33 ` jakub at gcc dot gnu.org
2023-02-17  7:54 ` aoliva at gcc dot gnu.org

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=bug-77760-4-8SgbW3x0B0@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).