[Ada] Remove redundant guard in expansion of dispatching calls

Message ID 20211025150914.GA346573@adacore.com
State Committed
Commit 6888031123ed16ccf01dd803207362b4500db624
Series [Ada] Remove redundant guard in expansion of dispatching calls |

Commit Message

Pierre-Marie de Rodat Oct. 25, 2021, 3:09 p.m. UTC
  Routine Predefined_Primitive_Bodies, which create predefined primitives
for derived tagged types, is only called with non-interface types
entities (which is even enforced with an assertion at the very start of
its body). There is no need to recheck this condition when creating
individual primitive operations related to tasking and equality.

Code cleanup related to handling of dispatching equality in SPARK.

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


	* exp_ch3.adb (Predefined_Primitive_Bodies): Remove redundant
	conditions related to interface types.


diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -11102,7 +11102,6 @@  package body Exp_Ch3 is
       --  they may be ancestors of synchronized interface types).
       if Ada_Version >= Ada_2005
-        and then not Is_Interface (Tag_Typ)
         and then
           ((Is_Interface (Etype (Tag_Typ))
              and then Is_Limited_Record (Etype (Tag_Typ)))
@@ -11123,7 +11122,7 @@  package body Exp_Ch3 is
          Append_To (Res, Make_Disp_Timed_Select_Body        (Tag_Typ));
       end if;
-      if not Is_Limited_Type (Tag_Typ) and then not Is_Interface (Tag_Typ) then
+      if not Is_Limited_Type (Tag_Typ) then
          --  Body for equality