> From: Jonathan Wakely <jwak...@redhat.com>
> Cc: Hans-Peter Nilsson <h...@axis.com>
> Date: Thu,  1 Feb 2024 15:36:50 +0000

> I plan to push this to trunk soon.
> 
> CC HP for visibility of the change affecting cris-elf. In practice it
> shouldn't make any difference to any sensible code. It only affects
> C++20 mode (and later), and only changes the size of std::formatter
> objects which are typically only created by the library headers
> themselves, and only on the stack (when using std::format and other new
> C++20 APIs related to it).
> 
> -- >8 --
> 
> 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 to optimize the conversions between
> locale encodings and UTF-8.
> 
> This will result in an ABI change for targets that use 1-byte alignment
> for all integral types, e.g. cris-elf.

Thanks for the heads-up, but don't worry about ABI changes
for cris-elf.

Not speaking for other platforms with default-packed layout
or where ABI structure layout alignment implies a change due
to PCC_BITFIELD_TYPE_MATTERS and the "unsigned long"
bitfield type.

That last one may matter though.

> We can't do that once C++20
> support is non-experimental and ABI stable, so do it now before GCC 14
> is released.
> 
> libstdc++-v3/ChangeLog:
> 
>       * include/std/format (__format::_Spec::_M_reserved): Define a
>       new bit-field member in place of padding bits.
> ---
>  libstdc++-v3/include/std/format | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
> index 0eca8b58bfa..6c958bc11a5 100644
> --- a/libstdc++-v3/include/std/format
> +++ b/libstdc++-v3/include/std/format
> @@ -406,6 +406,7 @@ namespace __format
>        _WidthPrec _M_width_kind : 2;
>        _WidthPrec _M_prec_kind : 2;
>        _Pres_type _M_type : 4;
> +      unsigned long _M_reserved : 17;
>        unsigned short _M_width;
>        unsigned short _M_prec;
>        char32_t _M_fill = ' ';
> -- 
> 2.43.0
> 

Reply via email to