]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Remove redundant guards for empty list
authorPiotr Trojanek <trojanek@adacore.com>
Fri, 14 Jan 2022 15:09:27 +0000 (16:09 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 9 May 2022 09:27:36 +0000 (09:27 +0000)
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.

gcc/ada/inline.adb
gcc/ada/sem_ch6.adb

index da67fd2296b4ddeb3bfbe93ff2e915fff5271ca5..5944aed0b00a5cf1a9ffb5fdb01fc77ab8e146fd 100644 (file)
@@ -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
index a672ea8c4a4591e3e864f205aca4bbfe8054440f..22faeb6afb3c2a99249791dc0b532ec243d8b2a8 100644 (file)
@@ -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