[COMMITTED,06/35] ada: Fix wrong handling of wide wide characters in Append_Decoded_With_Brackets

Message ID 20241025091107.485741-6-poulhies@adacore.com
State Committed
Commit a71c37a7241d8a73fe51712e5b4c7222afbaee8b
Headers
Series [COMMITTED,01/35] ada: Pass parameters of full access unconstrained array types by copy in calls |

Commit Message

Marc Poulhiès Oct. 25, 2024, 9:10 a.m. UTC
  From: Eric Botcazou <ebotcazou@adacore.com>

This only shows up at link time when the name of a compilation unit contains
a wide wide character.

gcc/ada/ChangeLog:

	* namet.adb (Append_Decoded_With_Brackets): Fix condition for the
	cheap test at the beginning of the loop.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/namet.adb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Patch

diff --git a/gcc/ada/namet.adb b/gcc/ada/namet.adb
index 72f6c2088db..2e3b9c014fc 100644
--- a/gcc/ada/namet.adb
+++ b/gcc/ada/namet.adb
@@ -474,7 +474,11 @@  package body Namet is
 
             P := 1;
             while P < Temp.Length loop
-               if Temp.Chars (P + 1) in 'A' .. 'Z' then
+               --  Cheap test for the common case of no encoding
+
+               if Temp.Chars (P + 1) in 'A' .. 'Z'
+                 and then Temp.Chars (P + 1) /= 'W'
+               then
                   P := P + 1;
 
                --  Uhh encoding