Skip to content

[libc++] ABI break: std::__format::__formatted_size_buffer/__format_to_n_buffer #158713

@zibi2

Description

@zibi2

Compiling std/utilities/format/format.functions/locale-specific_form.pass.cpp with -std=c++26 -Xclang -fdump-record-layouts-canonical -fsyntax-only against LLVM 19 and LLVM 21 will result with the following difference:

          0 | class std::__format::__formatted_size_buffer<char>
-         0 |   class std::__format::__internal_storage<char> __storage_
-         0 |     char[256] __buffer_
-       256 |   class std::__format::__output_buffer<char> __output_
-       256 |     char * __ptr_
-       264 |     unsigned long __capacity_
-       272 |     unsigned long __size_
-       280 |     void (*)(char *, unsigned long, void *) __flush_
-       288 |     void * __obj_
-       296 |   unsigned long __size_
-           | [sizeof=304, dsize=304, align=8,
-           |  nvsize=304, nvalign=8]
+         0 |   class std::__format::__output_buffer<char> (base)
+         0 |     char * __ptr_
+         8 |     unsigned long __capacity_
+        16 |     unsigned long __size_
+        24 |     void (*)(class std::__format::__output_buffer<char> &, unsigned long) __prepare_write_
+        32 |     class std::__format::__max_output_size * __max_output_size_
+        40 |   class std::__format::__max_output_size __max_output_size_
+        40 |     unsigned long __max_size_
+        48 |     unsigned long __code_units_written_
+           | [sizeof=56, dsize=56, align=8,
+           |  nvsize=56, nvalign=8]

The difference is coming from __storage_ member which takes 256 bytes in space. I believe this was changed in PR 157592.

Similar diffs are also observed in various instantiations of std::__format::__formatted_size_buffer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ABIApplication Binary Interfacelibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.questionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions