From: Piotr Trojanek Date: Thu, 19 Dec 2024 14:32:56 +0000 (+0100) Subject: ada: Remove dead code in detection of null record definitions X-Git-Tag: basepoints/gcc-16~2914 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=672175768244d6962e11df5dee0cdf0fb28051ed;p=thirdparty%2Fgcc.git 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. --- 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;