public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r14-8792] libstdc++: Replace padding bits with bit-fields in __format::_Spec
Date: Sun,  4 Feb 2024 21:47:49 +0000 (GMT)	[thread overview]
Message-ID: <20240204214749.7A1ED3858CDB@sourceware.org> (raw)

https://gcc.gnu.org/g:260a22de4fa3d4ad3bb0d3ef2cd45d7f03eb3160

commit r14-8792-g260a22de4fa3d4ad3bb0d3ef2cd45d7f03eb3160
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Feb 1 11:09:29 2024 +0000

    libstdc++: Replace padding bits with bit-fields in __format::_Spec
    
    This ensures that the unused bits will be zero-initialized reliably, and
    so can be used later by assigning them values in formatter
    specializations. For example, formatters for std::chrono will need to
    use an extra bit for a boolean flag to optimize the conversions between
    locale encodings and UTF-8.
    
    Adding the 16-bit _M_reserved2 bit-field results in an increased size
    for targets that use 1- or 2-byte alignment for all integral types, e.g.
    cris-elf or m68k.  Placing that member before the _M_width member
    adjusts the layout for all targets, but keeps all the bit-fields
    together. We can't make that change once C++20 support is ABI stable and
    non-experimental, so do it now before GCC 14 is released. The _M_fill
    data member already change from char to char32_t in
    r14-6991-g37a4c5c23a270c so _Spec is already incompatible with gcc-13
    anyway.
    
    libstdc++-v3/ChangeLog:
    
            * include/std/format (__format::_Spec::_M_reserved): Define new
            bit-field members to reserve padding bits for future extensions.

Diff:
---
 libstdc++-v3/include/std/format | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index 0eca8b58bfa8..961441e355b3 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -406,6 +406,8 @@ namespace __format
       _WidthPrec _M_width_kind : 2;
       _WidthPrec _M_prec_kind : 2;
       _Pres_type _M_type : 4;
+      unsigned   _M_reserved : 1;
+      unsigned   _M_reserved2 : 16;
       unsigned short _M_width;
       unsigned short _M_prec;
       char32_t _M_fill = ' ';

                 reply	other threads:[~2024-02-04 21:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240204214749.7A1ED3858CDB@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@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).