https://gcc.gnu.org/g:672175768244d6962e11df5dee0cdf0fb28051ed

commit r15-6639-g672175768244d6962e11df5dee0cdf0fb28051ed
Author: Piotr Trojanek <troja...@adacore.com>
Date:   Thu Dec 19 15:32:56 2024 +0100

    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:
---
 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;

Reply via email to