aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-05-28 12:14:38 +0200
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-17 13:17:11 -0300
commitde2f3677a5a180b58f1b743e7fc3be7b41c5a2af (patch)
treeb6d0f49c266a7ec4731c25f60321e9aa393d231d /gcc
parenteb4d288bcdf6d6e75e7cf737572529c6848fe221 (diff)
downloadgcc-de2f3677a5a180b58f1b743e7fc3be7b41c5a2af.zip
gcc-de2f3677a5a180b58f1b743e7fc3be7b41c5a2af.tar.gz
gcc-de2f3677a5a180b58f1b743e7fc3be7b41c5a2af.tar.bz2
[Ada] Cleanup excessive conditions in Check_Completion
gcc/ada/ * sem_ch3.adb (Check_Completion): Refactor chained if-then-elsif-... statement to be more like a case statement (note: we can't simply use case statement because of Is_Intrinsic_Subprogram in the first condition).
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_ch3.adb32
1 files changed, 17 insertions, 15 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index b964301..a184a87 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -11698,28 +11698,30 @@ package body Sem_Ch3 is
-- A formal incomplete type (Ada 2012) does not require a completion;
-- other incomplete type declarations do.
- elsif Ekind (E) = E_Incomplete_Type
- and then No (Underlying_Type (E))
- and then not Is_Generic_Type (E)
- then
- Post_Error;
+ elsif Ekind (E) = E_Incomplete_Type then
+ if No (Underlying_Type (E))
+ and then not Is_Generic_Type (E)
+ then
+ Post_Error;
+ end if;
- elsif Ekind_In (E, E_Task_Type, E_Protected_Type)
- and then not Has_Completion (E)
- then
- Post_Error;
+ elsif Ekind_In (E, E_Task_Type, E_Protected_Type) then
+ if not Has_Completion (E) then
+ Post_Error;
+ end if;
-- A single task declared in the current scope is a constant, verify
-- that the body of its anonymous type is in the same scope. If the
-- task is defined elsewhere, this may be a renaming declaration for
-- which no completion is needed.
- elsif Ekind (E) = E_Constant
- and then Ekind (Etype (E)) = E_Task_Type
- and then not Has_Completion (Etype (E))
- and then Scope (Etype (E)) = Current_Scope
- then
- Post_Error;
+ elsif Ekind (E) = E_Constant then
+ if Ekind (Etype (E)) = E_Task_Type
+ and then not Has_Completion (Etype (E))
+ and then Scope (Etype (E)) = Current_Scope
+ then
+ Post_Error;
+ end if;
elsif Ekind (E) = E_Record_Type then
if Is_Tagged_Type (E) then