breakage with: [committed] libstdc++: Implement P2909R4 ("Dude, where's my char?") for C++20

Hans-Peter Nilsson hp@axis.com
Mon Jan 8 16:24:35 GMT 2024


(Sorry, never a bringer of good news...)

> From: Jonathan Wakely <jwakely@redhat.com>
> Date: Mon,  8 Jan 2024 01:15:50 +0000

> Tested x86_64-linux and aarch64-linux. Pushed to trunk.
> 
> -- >8 --
> 
> This change ensures that char and wchar_t arguments are formatted
> consistently when using integer presentation types. This avoids
> non-portable std::format output that depends on whether char and wchar_t
> happen to be signed or unsigned on the target. Formatting '\xff' as an
> integer will now always format 255 and not sometimes -1. This was
> approved in Kona 2023 as a DR for C++20 so the change is implemented
> unconditionally.
> 
> Also make character formatters check for _Pres_c explicitly and call
> _M_format_character directly. This avoid the overhead of calling format
> and _S_to_character and then calling _M_format_character anyway.
> 
> libstdc++-v3/ChangeLog:
> 
> 	* include/bits/version.def (format_uchar): Define.
> 	* include/bits/version.h: Regenerate.
> 	* include/std/format (formatter<C, C>::format): Check for
> 	_Pres_c and call _M_format_character directly. Cast C to its
> 	unsigned equivalent for formatting as an integer.
> 	(formatter<char, wchar_t>::format): Likewise.
> 	(basic_format_arg(T&)): Store char arguments as unsigned char
> 	for formatting to a wide string.
> 	* testsuite/std/format/functions/format.cc: Adjust test. Check
> 	formatting of

For some reason, this (r14-6990-g74a0dab18292be) breaks a
build of (newlib targets) at least cris-elf and arm-eabi:

libtool: compile:  /obj/./gcc/xgcc -shared-libgcc -B/obj/./gcc -nostdinc++ -L/obj/cris-elf/libstdc++-v3/src -L/obj/cris-elf/libstdc++-v3/src/.libs -L/obj/cris-elf/libstdc++-v3/libsupc++/.libs -nostdinc -B/obj/cris-elf/newlib/ -isystem /obj/cris-elf/newlib/targ-include -isystem /x/gcc/newlib/libc/include -B/obj/cris-elf/libgloss/cris -L/obj/cris-elf/libgloss/libnosys -L/x/gcc/libgloss/cris -B/x/cris-elf/pre/cris-elf/bin/ -B/x/cris-elf/pre/cris-elf/lib/ -isystem /x/cris-elf/pre/cris-elf/include -isystem /x/cris-elf/pre/cris-elf/sys-include -I/x/gcc/libstdc++-v3/../libgcc -I/obj/cris-elf/libstdc++-v3/include/cris-elf -I/obj/cris-elf/libstdc++-v3/include -I/x/gcc/libstdc++-v3/libsupc++ -std=gnu++20 -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2 -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -frandom-seed=tzdb.lo -fimplicit-templates -g -O2 -I. -c /x/gcc/libstdc++-v3/src/c++20/tzdb.cc -o tzdb.o
In file included from /x/gcc/newlib/libc/include/time.h:11,
                 from /obj/cris-elf/libstdc++-v3/include/ctime:42,
                 from /obj/cris-elf/libstdc++-v3/include/bits/chrono.h:40,
                 from /obj/cris-elf/libstdc++-v3/include/chrono:41,
                 from /x/gcc/libstdc++-v3/src/c++20/tzdb.cc:31:
/obj/cris-elf/libstdc++-v3/include/bits/unicode.h:86:37: error: declaration does not declare anything [-fpermissive]
   86 |   inline constexpr _Null_sentinel_t __null_sentinel;
      |                                     ^~~~~~~~~~~~~~~
make[5]: *** [Makefile:754: tzdb.lo] Error 1

I don't see anything immediately related to that line in the
patch, though, so the actual cause and fix isn't obvious, at
least to me.

brgds, H-P


More information about the Libstdc++ mailing list