public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1209] ada: Remove redundant guards from calls to Move_Aspects
@ 2023-05-25  8:05 Marc Poulhi?s
  0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2023-05-25  8:05 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d1e196d39e592d053d2528b11874a6c228932431

commit r14-1209-gd1e196d39e592d053d2528b11874a6c228932431
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Fri Mar 3 17:27:40 2023 +0100

    ada: Remove redundant guards from calls to Move_Aspects
    
    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.

Diff:
---
 gcc/ada/par-ch7.adb | 4 +---
 gcc/ada/par-ch9.adb | 4 +---
 gcc/ada/sem_ch6.adb | 8 ++------
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/gcc/ada/par-ch7.adb b/gcc/ada/par-ch7.adb
index e8a765bbac1..fc96ce89f6c 100644
--- a/gcc/ada/par-ch7.adb
+++ b/gcc/ada/par-ch7.adb
@@ -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;
diff --git a/gcc/ada/par-ch9.adb b/gcc/ada/par-ch9.adb
index 752b28bd092..d6526de0b36 100644
--- a/gcc/ada/par-ch9.adb
+++ b/gcc/ada/par-ch9.adb
@@ -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);
 
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 48b363e077c..135d8ab7f0b 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -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);

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

only message in thread, other threads:[~2023-05-25  8:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-25  8:05 [gcc r14-1209] ada: Remove redundant guards from calls to Move_Aspects Marc Poulhi?s

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).