diff options
author | Bob Duff <duff@adacore.com> | 2020-03-30 10:14:27 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-06-15 04:04:21 -0400 |
commit | eb72521915b1f109b3b65aa384005c2527f76c31 (patch) | |
tree | 59fbf0467f5bf4c8384ab12ba6d48f866e88f85b /gcc/ada/namet.adb | |
parent | 6c04efdd9c2a21f719c6fabcf267d03d7127982f (diff) | |
download | gcc-eb72521915b1f109b3b65aa384005c2527f76c31.zip gcc-eb72521915b1f109b3b65aa384005c2527f76c31.tar.gz gcc-eb72521915b1f109b3b65aa384005c2527f76c31.tar.bz2 |
[Ada] Put_Image improvements for strings
2020-06-15 Bob Duff <duff@adacore.com>
gcc/ada/
* exp_attr.adb (Put_Image): Use underlying type for strings.
Remove unchecked union processing.
* exp_put_image.adb (Tagged_Put_Image_Enabled): Use -gnatd_z to
enable default Put_Image for tagged types. This allows testing
that feature.
(Build_String_Put_Image_Call): Set Conversion_OK flag.
(Make_Component_List_Attributes): Remove unchecked union
processing.
(Enable_Put_Image): Disable for unchecked unions. Enable for
nonscalar types (which were mistakenly disabled in earlier
changes).
* debug.adb: Document -gnatd_z switch.
* libgnat/s-putima.adb (Put_Image_String, Put_Image_Wide_String,
Put_Image_Wide_Wide_String): Double double-quote characters.
Forget about special handling of control characters for now --
that's rare enough to not be a priority, and it's not clear what
the right thing to do is anyway.
* namet.adb: Minor: Improve debugger-friendliness.
* sinfo.ads: Minor: Add "???" comment.
Diffstat (limited to 'gcc/ada/namet.adb')
-rw-r--r-- | gcc/ada/namet.adb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/ada/namet.adb b/gcc/ada/namet.adb index 60c1050..6cc05bb 100644 --- a/gcc/ada/namet.adb +++ b/gcc/ada/namet.adb @@ -1179,11 +1179,13 @@ package body Namet is Hash_Index : Hash_Index_Type; -- Computed hash index + Result : Valid_Name_Id; + begin -- Quick handling for one character names if Buf.Length = 1 then - return Valid_Name_Id (First_Name_Id + Character'Pos (Buf.Chars (1))); + Result := First_Name_Id + Character'Pos (Buf.Chars (1)); -- Otherwise search hash table for existing matching entry @@ -1210,7 +1212,8 @@ package body Namet is end if; end loop; - return New_Id; + Result := New_Id; + goto Done; -- Current entry in hash chain does not match @@ -1248,8 +1251,11 @@ package body Namet is Name_Chars.Append (ASCII.NUL); - return Name_Entries.Last; + Result := Name_Entries.Last; end if; + + <<Done>> + return Result; end Name_Find; function Name_Find (S : String) return Valid_Name_Id is |