public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Remove explicit call to Make_Unchecked_Type_Conversion
@ 2022-07-06 13:31 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-07-06 13:31 UTC (permalink / raw)
  To: gcc-patches; +Cc: Piotr Trojanek

[-- Attachment #1: Type: text/plain, Size: 540 bytes --]

Respect a comment in sinfo.ads, which says: "Unchecked type conversion
nodes should be created by calling Tbuild.Unchecked_Convert_To, rather
than by directly calling Nmake.Make_Unchecked_Type_Conversion."

No test appears to be affected by this change, so this is just a
cleanup.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* exp_ch6.adb (Build_Static_Check_Helper_Call): Replace explicit
	call to Make_Unchecked_Type_Conversion with a call to
	Unchecked_Convert_To.
	* tbuild.adb (Unchecked_Convert_To): Fix whitespace.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 1069 bytes --]

diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -7578,9 +7578,7 @@ package body Exp_Ch6 is
               and then Etype (F) /= Etype (A)
             then
                Append_To (Actuals,
-                 Make_Unchecked_Type_Conversion (Loc,
-                   New_Occurrence_Of (Etype (F), Loc),
-                   New_Copy_Tree (A)));
+                 Unchecked_Convert_To (Etype (F), New_Copy_Tree (A)));
             else
                Append_To (Actuals, New_Copy_Tree (A));
             end if;


diff --git a/gcc/ada/tbuild.adb b/gcc/ada/tbuild.adb
--- a/gcc/ada/tbuild.adb
+++ b/gcc/ada/tbuild.adb
@@ -882,8 +882,8 @@ package body Tbuild is
       --  We don't really want to allow E_Void here, but existing code passes
       --  it.
 
-      Loc         : constant Source_Ptr := Sloc (Expr);
-      Result      : Node_Id;
+      Loc    : constant Source_Ptr := Sloc (Expr);
+      Result : Node_Id;
 
    begin
       --  If the expression is already of the correct type, then nothing



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-06 13:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-06 13:31 [Ada] Remove explicit call to Make_Unchecked_Type_Conversion Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).