]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Simplify iteration over record component items with possible pragmas
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 20 Mar 2023 19:30:09 +0000 (20:30 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 26 May 2023 07:29:17 +0000 (09:29 +0200)
Code cleanup; semantics is unaffected.

gcc/ada/

* sem_util.adb (Is_Null_Record_Definition): Use First_Non_Pragma and
Next_Non_Pragma to ignore pragmas within component list.

gcc/ada/sem_util.adb

index 64c12cc7ecf05c5c963097ed255cfd51247d9400..e11eded398d5a73edb662b77149e87a42b60d7c2 100644 (file)
@@ -18699,19 +18699,17 @@ package body Sem_Util is
          return True;
       end if;
 
-      Item := First (Component_Items (Component_List (Record_Def)));
+      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
             null;
-         elsif Nkind (Item) = N_Pragma then
-            null;
          else
             return False;
          end if;
-         Item := Next (Item);
+         Next_Non_Pragma (Item);
       end loop;
 
       return True;