https://gcc.gnu.org/g:2793b5188b3cbc220e033559f596095a207d4be0

commit r16-8985-g2793b5188b3cbc220e033559f596095a207d4be0
Author: Eric Botcazou <[email protected]>
Date:   Wed Jan 21 11:13:45 2026 +0100

    ada: Rename Image_Should_Call_Put_Image into Image_Must_Call_Put_Image
    
    The former is a bit of a misnomer, since there is absolutely no leeway.
    
    gcc/ada/ChangeLog:
    
            * exp_put_image.ads (Image_Should_Call_Put_Image): Rename into...
            (Image_Must_Call_Put_Image): ...this.
            * exp_put_image.adb (Image_Should_Call_Put_Image): Rename into...
            (Image_Must_Call_Put_Image): ...this.
            * exp_imgv.adb (Expand_Image_Attribute): Adjust to above renaming.
            (Expand_Wide_Image_Attribute): Likewise.
            (Expand_Wide_Wide_Image_Attribute): Likewise.
            * sem_attr.adb (Eval_Attribute): Likewise.

Diff:
---
 gcc/ada/exp_imgv.adb      | 15 ++++++---------
 gcc/ada/exp_put_image.adb | 10 +++++-----
 gcc/ada/exp_put_image.ads |  6 +++---
 gcc/ada/sem_attr.adb      |  4 ++--
 4 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/gcc/ada/exp_imgv.adb b/gcc/ada/exp_imgv.adb
index 082acbe4d88a..1d7af928690d 100644
--- a/gcc/ada/exp_imgv.adb
+++ b/gcc/ada/exp_imgv.adb
@@ -1047,10 +1047,9 @@ package body Exp_Imgv is
          return;
       end if;
 
-      --  If Image should be transformed using Put_Image, then do so. See
-      --  Exp_Put_Image for details.
+      --  If Image must be turned into Put_Image, then do so
 
-      if Exp_Put_Image.Image_Should_Call_Put_Image (N) then
+      if Exp_Put_Image.Image_Must_Call_Put_Image (N) then
          Establish_Transient_Scope (N, Manage_Sec_Stack => True);
          Rewrite (N, Exp_Put_Image.Build_Image_Call (N));
          Analyze_And_Resolve (N, Standard_String, Suppress => All_Checks);
@@ -1860,10 +1859,9 @@ package body Exp_Imgv is
          return;
       end if;
 
-      --  If Image should be transformed using Put_Image, then do so. See
-      --  Exp_Put_Image for details.
+      --  If Image must be turned into Put_Image, then do so
 
-      if Exp_Put_Image.Image_Should_Call_Put_Image (N) then
+      if Exp_Put_Image.Image_Must_Call_Put_Image (N) then
          Establish_Transient_Scope (N, Manage_Sec_Stack => True);
          Rewrite (N, Exp_Put_Image.Build_Image_Call (N));
          Analyze_And_Resolve (N, Standard_Wide_String, Suppress => All_Checks);
@@ -1970,10 +1968,9 @@ package body Exp_Imgv is
          return;
       end if;
 
-      --  If Image should be transformed using Put_Image, then do so. See
-      --  Exp_Put_Image for details.
+      --  If Image must be turned into Put_Image, then do so
 
-      if Exp_Put_Image.Image_Should_Call_Put_Image (N) then
+      if Exp_Put_Image.Image_Must_Call_Put_Image (N) then
          Establish_Transient_Scope (N, Manage_Sec_Stack => True);
          Rewrite (N, Exp_Put_Image.Build_Image_Call (N));
          Analyze_And_Resolve
diff --git a/gcc/ada/exp_put_image.adb b/gcc/ada/exp_put_image.adb
index 2853ffad38d6..0bc1a8873756 100644
--- a/gcc/ada/exp_put_image.adb
+++ b/gcc/ada/exp_put_image.adb
@@ -1240,11 +1240,11 @@ package body Exp_Put_Image is
       return Make_Defining_Identifier (Loc, Sname);
    end Make_Put_Image_Name;
 
-   ---------------------------------
-   -- Image_Should_Call_Put_Image --
-   ---------------------------------
+   -------------------------------
+   -- Image_Must_Call_Put_Image --
+   -------------------------------
 
-   function Image_Should_Call_Put_Image (N : Node_Id) return Boolean is
+   function Image_Must_Call_Put_Image (N : Node_Id) return Boolean is
    begin
       if Ada_Version < Ada_2022 then
          return False;
@@ -1282,7 +1282,7 @@ package body Exp_Put_Image is
 
          return False;
       end;
-   end Image_Should_Call_Put_Image;
+   end Image_Must_Call_Put_Image;
 
    ----------------------
    -- Build_Image_Call --
diff --git a/gcc/ada/exp_put_image.ads b/gcc/ada/exp_put_image.ads
index 09a68b8426bc..30703aa247c4 100644
--- a/gcc/ada/exp_put_image.ads
+++ b/gcc/ada/exp_put_image.ads
@@ -82,9 +82,9 @@ package Exp_Put_Image is
    function Build_Unknown_Put_Image_Call (N : Node_Id) return Node_Id;
    --  Build a call to Put_Image_Unknown
 
-   function Image_Should_Call_Put_Image (N : Node_Id) return Boolean;
-   --  True if T'Image should call T'Put_Image. N is the attribute_reference
-   --  T'Image.
+   function Image_Must_Call_Put_Image (N : Node_Id) return Boolean;
+   --  True if T'Image must be implemented by a call to T'Put_Image. N is the
+   --  attribute reference to T'Image.
 
    function Build_Image_Call (N : Node_Id) return Node_Id;
    --  N is a call to T'[[Wide_]Wide_]Image, and this translates it into the
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 6c049b82e835..1eea23718cc8 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -8523,7 +8523,7 @@ package body Sem_Attr is
         and then Is_Enumeration_Type (Etype (P))
         and then not Is_Character_Type (Etype (P))
         and then Compile_Time_Known_Value (P)
-        and then not Image_Should_Call_Put_Image (N)
+        and then not Image_Must_Call_Put_Image (N)
       then
          Fold_Compile_Time_Known_Enumeration_Image (P);
          Set_Is_Static_Expression
@@ -9738,7 +9738,7 @@ package body Sem_Attr is
          if Is_Enumeration_Type (Etype (P))
            and then not Is_Character_Type (Etype (P))
            and then Compile_Time_Known_Value (E1)
-           and then not Image_Should_Call_Put_Image (N)
+           and then not Image_Must_Call_Put_Image (N)
          then
             Fold_Compile_Time_Known_Enumeration_Image (E1);
             Set_Is_Static_Expression (N, False);

Reply via email to