From d7f5bfe407cfeae17ab059387adcf88346ccbba8 Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Fri, 14 Jan 2022 16:09:27 +0100 Subject: [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. --- gcc/ada/inline.adb | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'gcc/ada/inline.adb') diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index da67fd2..5944aed 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 -- cgit v1.1