]> git.feebdaed.xyz Git - 0xmirror/binutils-gdb.git/commit
[gdb/build, c++20] Fix UTF-8 string literal usage
authorTom de Vries <tdevries@suse.de>
Fri, 28 Nov 2025 11:55:33 +0000 (12:55 +0100)
committerTom de Vries <tdevries@suse.de>
Fri, 28 Nov 2025 11:55:33 +0000 (12:55 +0100)
commitf8e4eb6aaac16c42d44fa2580e59bc8017c80cef
tree6e0937bbcb5ffef70fd38ef2f30826b7e4143b4e
parent09aeeb1ca9cf28d4ca297299881168ac06dd562e
[gdb/build, c++20] Fix UTF-8 string literal usage

PR build/33675 reports a build breaker:
...
top.c: In function ‘void box_one_message(ui_file*, std::string, int)’:
top.c:1368:35: error: conditional expression between distinct pointer types \
  ‘const char8_t*’ and ‘const char*’ lacks a cast
 1368 |   const char *wall = emojis_ok () ? u8"\u2503" : "|";
      |                      ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
...

The problem is that UTF-8 string literals have type:
- const char[N]    (until C++20), or
- const char8_t[N] (since C++20)

Fix this by assigning to variables:
...
static const char bd_heavy_vertical[] = u8"\u2503";
...
and using the variables instead.

Tested by rebuilding on x86_64-linux, and starting gdb and checking the
welcome message box.

Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33675
gdb/top.c