]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Remove redundant guards from calls to Move_Aspects
authorPiotr Trojanek <trojanek@adacore.com>
Fri, 3 Mar 2023 16:27:40 +0000 (17:27 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 25 May 2023 07:44:16 +0000 (09:44 +0200)
Routine Move_Aspects does nothing if its From parameter has no aspects.
There is no need to check this at the call sites.

Code cleanup related to changes in handling of expressions functions in
GNATprove; semantics is unaffected.

gcc/ada/

* par-ch7.adb (P_Package): Remove redundant guard from call to
Move_Aspects.
* par-ch9.adb (P_Task): Likewise.
* sem_ch6.adb (Analyze_Expression_Function, Is_Inline_Pragma): Likewise.

gcc/ada/par-ch7.adb
gcc/ada/par-ch9.adb
gcc/ada/sem_ch6.adb

index e8a765bbac1e9040c168c3a8fce48698048d2d1c..fc96ce89f6c330f3d466ad6e2364041cd4b829c2 100644 (file)
@@ -162,9 +162,7 @@ package body Ch7 is
 
             --  Move the aspect specifications to the body node
 
-            if Has_Aspects (Dummy_Node) then
-               Move_Aspects (From => Dummy_Node, To => Package_Node);
-            end if;
+            Move_Aspects (From => Dummy_Node, To => Package_Node);
 
             Parse_Decls_Begin_End (Package_Node);
          end if;
index 752b28bd0921bd420e14a0e347cb4464c0e91cb4..d6526de0b36591089a69fbbab7d3c982c2e116a1 100644 (file)
@@ -140,9 +140,7 @@ package body Ch9 is
 
             --  Move the aspect specifications to the body node
 
-            if Has_Aspects (Dummy_Node) then
-               Move_Aspects (From => Dummy_Node, To => Task_Node);
-            end if;
+            Move_Aspects (From => Dummy_Node, To => Task_Node);
 
             Parse_Decls_Begin_End (Task_Node);
 
index 48b363e077cd9c7342931ba5ed1aa32f24aba03b..135d8ab7f0b33786bf30c3974531b693443d6d00 100644 (file)
@@ -390,9 +390,7 @@ package body Sem_Ch6 is
          --  function to the proper body when the expression function acts
          --  as a completion.
 
-         if Has_Aspects (N) then
-            Move_Aspects (N, To => New_Body);
-         end if;
+         Move_Aspects (N, To => New_Body);
 
          Relocate_Pragmas_To_Body (New_Body);
 
@@ -2875,9 +2873,7 @@ package body Sem_Ch6 is
 
                   --  Move aspects to the new spec
 
-                  if Has_Aspects (N) then
-                     Move_Aspects (N, To => Decl);
-                  end if;
+                  Move_Aspects (N, To => Decl);
 
                   Insert_Before (N, Decl);
                   Analyze (Decl);