public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-194] [Ada] Remove redundant guards for empty list
@ 2022-05-09  9:31 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-09  9:31 UTC (permalink / raw)
  To: gcc-cvs

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

commit r13-194-gd7f5bfe407cfeae17ab059387adcf88346ccbba8
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Fri Jan 14 16:09:27 2022 +0100

    [Ada] Remove redundant guards for empty list
    
    Routine Has_Excluded_Declaration iterates over declarations with
    First/Present/Next, which is safe when declarations are No_List.
    
    Cleanup related to excessive inlining-for-proof by GNATprove.
    
    gcc/ada/
    
            * inline.adb (Build_Body_To_Inline): Remove redundant guards.
            * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Likewise.

Diff:
---
 gcc/ada/inline.adb  | 12 +++---------
 gcc/ada/sem_ch6.adb |  4 +---
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb
index da67fd2296b..5944aed0b00 100644
--- a/gcc/ada/inline.adb
+++ b/gcc/ada/inline.adb
@@ -1330,9 +1330,7 @@ package body Inline is
          return;
       end if;
 
-      if Present (Declarations (N))
-        and then Has_Excluded_Declaration (Spec_Id, Declarations (N))
-      then
+      if Has_Excluded_Declaration (Spec_Id, Declarations (N)) then
          return;
       end if;
 
@@ -2622,9 +2620,7 @@ package body Inline is
 
       --  Check excluded declarations
 
-      elsif Present (Declarations (N))
-        and then Has_Excluded_Declaration (Spec_Id, Declarations (N))
-      then
+      elsif Has_Excluded_Declaration (Spec_Id, Declarations (N)) then
          return;
 
       --  Check excluded statements. There is no need to protect us against
@@ -4388,9 +4384,7 @@ package body Inline is
             return True;
 
          elsif Nkind (S) = N_Block_Statement then
-            if Present (Declarations (S))
-              and then Has_Excluded_Declaration (Subp, Declarations (S))
-            then
+            if Has_Excluded_Declaration (Subp, Declarations (S)) then
                return True;
 
             elsif Present (Handled_Statement_Sequence (S)) then
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index a672ea8c4a4..22faeb6afb3 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -4931,9 +4931,7 @@ package body Sem_Ch6 is
                      --  by the GCC backend (ie. "function might not be
                      --  inlinable").
 
-                     if Present (Subp_Decl)
-                       and then Has_Excluded_Declaration (Spec_Id, Subp_Decl)
-                     then
+                     if Has_Excluded_Declaration (Spec_Id, Subp_Decl) then
                         null;
 
                      elsif Has_Excluded_Statement


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

only message in thread, other threads:[~2022-05-09  9:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09  9:31 [gcc r13-194] [Ada] Remove redundant guards for empty list 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).