From 672175768244d6962e11df5dee0cdf0fb28051ed Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Thu, 19 Dec 2024 15:32:56 +0100 Subject: [PATCH] ada: Remove dead code in detection of null record definitions Code cleanup; behavior is unaffected. gcc/ada/ChangeLog: * sem_util.adb (Is_Null_Record_Definition): Remove check for Component_List being present after using it; replace check for component item being a component declaration with an assertion; fix style in comment. --- gcc/ada/sem_util.adb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index a11afa8be2d3..55e9979a2155 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -18984,22 +18984,19 @@ package body Sem_Util is function Is_Null_Record_Definition (Record_Def : Node_Id) return Boolean is Item : Node_Id; begin - -- Testing Null_Present is just an optimization, not required. + -- Testing Null_Present is just an optimization, not required if Null_Present (Record_Def) then return True; elsif Present (Variant_Part (Component_List (Record_Def))) then return False; - elsif No (Component_List (Record_Def)) then - return True; end if; Item := First_Non_Pragma (Component_Items (Component_List (Record_Def))); while Present (Item) loop - if Nkind (Item) = N_Component_Declaration - and then Is_Internal_Name (Chars (Defining_Identifier (Item))) - then + pragma Assert (Nkind (Item) = N_Component_Declaration); + if Is_Internal_Name (Chars (Defining_Identifier (Item))) then null; else return False; -- 2.47.2