public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/107760] New: Implement C++23 <print>
@ 2022-11-19 11:32 redi at gcc dot gnu.org
  2022-12-08 20:25 ` [Bug libstdc++/107760] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-19 11:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107760
           Summary: Implement C++23 <print>
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
            Blocks: 106749
  Target Milestone: ---

https://wg21.link/P2093R14
https://wg21.link/P2539R3


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106749
[Bug 106749] Implement C++23 library features

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/107760] Implement C++23 <print>
  2022-11-19 11:32 [Bug libstdc++/107760] New: Implement C++23 <print> redi at gcc dot gnu.org
@ 2022-12-08 20:25 ` pinskia at gcc dot gnu.org
  2023-02-16 15:33 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-08 20:25 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-12-08
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/107760] Implement C++23 <print>
  2022-11-19 11:32 [Bug libstdc++/107760] New: Implement C++23 <print> redi at gcc dot gnu.org
  2022-12-08 20:25 ` [Bug libstdc++/107760] " pinskia at gcc dot gnu.org
@ 2023-02-16 15:33 ` redi at gcc dot gnu.org
  2023-12-15  0:02 ` cvs-commit at gcc dot gnu.org
  2023-12-15  0:04 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2023-02-16 15:33 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/107760] Implement C++23 <print>
  2022-11-19 11:32 [Bug libstdc++/107760] New: Implement C++23 <print> redi at gcc dot gnu.org
  2022-12-08 20:25 ` [Bug libstdc++/107760] " pinskia at gcc dot gnu.org
  2023-02-16 15:33 ` redi at gcc dot gnu.org
@ 2023-12-15  0:02 ` cvs-commit at gcc dot gnu.org
  2023-12-15  0:04 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-15  0:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:fe54b57728c09ab0389e2bb3f079d5210566199d

commit r14-6569-gfe54b57728c09ab0389e2bb3f079d5210566199d
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Dec 14 23:23:34 2023 +0000

    libstdc++: Implement C++23 <print> header [PR107760]

    This adds the C++23 std::print functions, which use std::format to write
    to a FILE stream or std::ostream (defaulting to stdout).

    The new extern symbols are in the libstdc++exp.a archive, so we aren't
    committing to stable symbols in the DSO yet. There's a UTF-8 validating
    and transcoding function added by this change. That can certainly be
    optimized, but it's internal to libstdc++exp.a so can be tweaked later
    at leisure.

    Currently the external symbols work for all targets, but are only
    actually used for Windows, where it's necessary to transcode to UTF-16
    to write to the console.  The standard seems to encourage us to also
    diagnose invalid UTF-8 for non-Windows targets when writing to a
    terminal (and only when writing to a terminal), but I'm reliably
    informed that that wasn't the intent of the wording. Checking for
    invalid UTF-8 sequences only needs to happen for Windows, which is good
    as checking for a terminal requires a call to isatty, and on Linux that
    uses an ioctl syscall, which would make std::print ten times slower!

    Testing the std::print behaviour is difficult if it depends on whether
    the output stream is connected to a Windows console or not, as we can't
    (as far as I know) do that non-interactively in DejaGNU. One of the new
    tests uses the internal __write_to_terminal function directly. That
    allows us to verify its UTF-8 error handling on POSIX targets, even
    though that's not actually used by std::print. For Windows, that
    __write_to_terminal function transcodes to UTF-16 but then uses
    WriteConsoleW which fails unless it really is writing to the console.
    That means the 27_io/print/2.cc test FAILs on Windows. The UTF-16
    transcoding has been manually tested using mingw-w64 and Wine, and
    appears to work.

    libstdc++-v3/ChangeLog:

            PR libstdc++/107760
            * include/Makefile.am: Add new header.
            * include/Makefile.in: Regenerate.
            * include/bits/version.def (__cpp_lib_print): Define.
            * include/bits/version.h: Regenerate.
            * include/std/format (__literal_encoding_is_utf8): New function.
            (_Seq_sink::view()): New member function.
            * include/std/ostream (vprintf_nonunicode, vprintf_unicode)
            (print, println): New functions.
            * include/std/print: New file.
            * src/c++23/Makefile.am: Add new source file.
            * src/c++23/Makefile.in: Regenerate.
            * src/c++23/print.cc: New file.
            * testsuite/27_io/basic_ostream/print/1.cc: New test.
            * testsuite/27_io/print/1.cc: New test.
            * testsuite/27_io/print/2.cc: New test.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/107760] Implement C++23 <print>
  2022-11-19 11:32 [Bug libstdc++/107760] New: Implement C++23 <print> redi at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-12-15  0:02 ` cvs-commit at gcc dot gnu.org
@ 2023-12-15  0:04 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2023-12-15  0:04 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |14.0

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Done for GCC 14

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-15  0:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-19 11:32 [Bug libstdc++/107760] New: Implement C++23 <print> redi at gcc dot gnu.org
2022-12-08 20:25 ` [Bug libstdc++/107760] " pinskia at gcc dot gnu.org
2023-02-16 15:33 ` redi at gcc dot gnu.org
2023-12-15  0:02 ` cvs-commit at gcc dot gnu.org
2023-12-15  0:04 ` redi at gcc dot gnu.org

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).