]> gcc.gnu.org Git - gcc.git/commitdiff
ada: Skip processing of NUL character for attribute Type_Key
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 3 Apr 2024 09:51:46 +0000 (11:51 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 10 Jun 2024 09:03:59 +0000 (11:03 +0200)
Code cleanup; behavior is unaffected.

gcc/ada/

* sem_attr.adb (Analyze_Attribute): Use fully qualified name
without a NUL, so that it doesn't need to be skipped afterwards.

gcc/ada/sem_attr.adb

index 403810c8b5ec097f887b57a3ffc2b5f70eee0d29..4fd270aeae9c21b83496be8f683855d8fd5362fd 100644 (file)
@@ -6863,8 +6863,8 @@ package body Sem_Attr is
       --------------
 
       when Attribute_Type_Key => Type_Key : declare
-         Full_Name  : constant String_Id :=
-                        Fully_Qualified_Name_String (Entity (P));
+         Full_Name : constant String_Id :=
+           Fully_Qualified_Name_String (Entity (P), Append_NUL => False);
 
          CRC : CRC32;
          --  The computed signature for the type
@@ -6997,9 +6997,9 @@ package body Sem_Attr is
          Start_String;
          Deref := False;
 
-         --  Copy all characters in Full_Name but the trailing NUL
+         --  Copy all characters in Full_Name
 
-         for J in 1 .. String_Length (Full_Name) - 1 loop
+         for J in 1 .. String_Length (Full_Name) loop
             Store_String_Char (Get_String_Char (Full_Name, Pos (J)));
          end loop;
 
This page took 0.075612 seconds and 5 git commands to generate.