]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Cleanup detection of No_Elist with No and Present
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 20 Jan 2022 19:14:20 +0000 (20:14 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 10 May 2022 08:19:27 +0000 (08:19 +0000)
Replace equality and inequality operators with calls to No and Present.
Offending occurrences found with:

$ grep -n " /\?= No_Elist" *.adb

Code cleanup only; semantics is unaffected.

gcc/ada/

* exp_ch11.adb, exp_ch5.adb, exp_prag.adb, gnat_cuda.adb,
sem_ch12.adb, sem_ch3.adb, sem_ch6.adb, sem_util.adb,
treepr.adb: Replace /= and = operators with No and Present,
respectively.

gcc/ada/exp_ch11.adb
gcc/ada/exp_ch5.adb
gcc/ada/exp_prag.adb
gcc/ada/gnat_cuda.adb
gcc/ada/sem_ch12.adb
gcc/ada/sem_ch3.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_util.adb
gcc/ada/treepr.adb

index 855d30388269b7f328c169525ce7130b8aa1d4e4..00b7745f7e1b14d3a652eff90da4fa98a927ddc5 100644 (file)
@@ -813,7 +813,7 @@ package body Exp_Ch11 is
                   --  case we have to generate possible diagnostics.
 
                elsif Has_Local_Raise (Handler)
-                 and then Local_Raise_Statements (Handler) /= No_Elist
+                 and then Present (Local_Raise_Statements (Handler))
                then
                   Relmt := First_Elmt (Local_Raise_Statements (Handler));
                   while Present (Relmt) loop
@@ -1528,7 +1528,7 @@ package body Exp_Ch11 is
             H := Find_Local_Handler (Entity (Name (N)), N);
 
             if Present (H) then
-               if Local_Raise_Statements (H) = No_Elist then
+               if No (Local_Raise_Statements (H)) then
                   Set_Local_Raise_Statements (H, New_Elmt_List);
                end if;
 
index 710db666e8d31f3b191a74c4b46605a4c1a61a52..ba575740a3ddfd098201cb800f6ded33e924a000 100644 (file)
@@ -2101,7 +2101,7 @@ package body Exp_Ch5 is
             --  from the Rhs by selected component because they are invisible
             --  in the type of the right-hand side.
 
-            if Stored_Constraint (R_Typ) /= No_Elist then
+            if Present (Stored_Constraint (R_Typ)) then
                declare
                   Assign    : Node_Id;
                   Discr_Val : Elmt_Id;
index bf2d29744c41646edc8ab1c5740ee0f5967cbbb8..70b16c866d448bd700841a3b8a4f4723a87980b0 100644 (file)
@@ -1054,7 +1054,7 @@ package body Exp_Prag is
          Result : constant List_Id := New_List;
          Elmt   : Elmt_Id;
       begin
-         if Elmts = No_Elist then
+         if No (Elmts) then
             return Result;
          end if;
 
index dc4261a960726eb7a4be929c9f524502ad9921b4..2a0a450d886fba49f7274db641d90bdc22ee07d5 100644 (file)
@@ -149,7 +149,7 @@ package body GNAT_CUDA is
    is
       Device_Entities : Elist_Id := Get_CUDA_Device_Entities (Pack_Id);
    begin
-      if Device_Entities = No_Elist then
+      if No (Device_Entities) then
          Device_Entities := New_Elmt_List;
          Set_CUDA_Device_Entities (Pack_Id, Device_Entities);
       end if;
@@ -166,7 +166,7 @@ package body GNAT_CUDA is
    is
       Kernels : Elist_Id := Get_CUDA_Kernels (Pack_Id);
    begin
-      if Kernels = No_Elist then
+      if No (Kernels) then
          Kernels := New_Elmt_List;
          Set_CUDA_Kernels (Pack_Id, Kernels);
       end if;
@@ -687,7 +687,7 @@ package body GNAT_CUDA is
    --  Start of processing for Build_And_Insert_CUDA_Initialization
 
    begin
-      if CUDA_Node_List = No_Elist then
+      if No (CUDA_Node_List) then
          return;
       end if;
 
@@ -745,7 +745,7 @@ package body GNAT_CUDA is
    begin
       pragma Assert (Debug_Flag_Underscore_C);
 
-      if Device_Entities = No_Elist then
+      if No (Device_Entities) then
          return;
       end if;
 
@@ -789,7 +789,7 @@ package body GNAT_CUDA is
       E       : Elist_Id)
    is
    begin
-      pragma Assert (Get_CUDA_Device_Entities (Pack_Id) = No_Elist);
+      pragma Assert (No (Get_CUDA_Device_Entities (Pack_Id)));
       CUDA_Device_Entities_Table.Set (Pack_Id, E);
    end Set_CUDA_Device_Entities;
 
@@ -802,7 +802,7 @@ package body GNAT_CUDA is
       Kernels : Elist_Id)
    is
    begin
-      pragma Assert (Get_CUDA_Kernels (Pack_Id) = No_Elist);
+      pragma Assert (No (Get_CUDA_Kernels (Pack_Id)));
       CUDA_Kernels_Table.Set (Pack_Id, Kernels);
    end Set_CUDA_Kernels;
 
index f01562d7cac0d87343c567eaf83f74474a2cef55..fa36d0f8f0577b1dc857cac332d3b3911015e0ab 100644 (file)
@@ -10224,7 +10224,7 @@ package body Sem_Ch12 is
       Prim      : Node_Id;
 
    begin
-      if Prims_List /= No_Elist then
+      if Present (Prims_List) then
          Prim_Elmt := First_Elmt (Prims_List);
          while Present (Prim_Elmt) loop
             Prim := Node (Prim_Elmt);
index a88f7f205fdc2a4dbc901d86a93772d2ee1a7dc1..2ab273b3acf460ed6f4fb632a8da8182110c2b01 100644 (file)
@@ -5849,7 +5849,7 @@ package body Sem_Ch3 is
          --  Inherit Subprograms_For_Type from the full view, if present
 
          if Present (Full_View (T))
-           and then Subprograms_For_Type (Full_View (T)) /= No_Elist
+           and then Present (Subprograms_For_Type (Full_View (T)))
          then
             Set_Subprograms_For_Type
               (Id, Subprograms_For_Type (Full_View (T)));
index 510cad2c70a98ee4b2a611ba7c602efcf9e1b49f..92e48fa413b852d31e45f7b0d99282a7bb082a43 100644 (file)
@@ -5473,11 +5473,11 @@ package body Sem_Ch6 is
       --  Restore the limited views in the spec, if any, to let the back end
       --  process it without running into circularities.
 
-      if Exch_Views /= No_Elist then
+      if Present (Exch_Views) then
          Restore_Limited_Views (Exch_Views);
       end if;
 
-      if Mask_Types /= No_Elist then
+      if Present (Mask_Types) then
          Unmask_Unfrozen_Types (Mask_Types);
       end if;
 
index c58b63db924c009c4e9181b4604f6ce37ce1c687..1d915ab0f28db5a44056ef57e69680ee0ee79a18 100644 (file)
@@ -3414,7 +3414,7 @@ package body Sem_Util is
                   end if;
 
                else
-                  if Identifiers_List = No_Elist then
+                  if No (Identifiers_List) then
                      Identifiers_List := New_Elmt_List;
                   end if;
 
@@ -3438,7 +3438,7 @@ package body Sem_Util is
             Elmt : Elmt_Id;
 
          begin
-            if List = No_Elist then
+            if No (List) then
                return False;
             end if;
 
@@ -3745,7 +3745,7 @@ package body Sem_Util is
 
                            Collect_Identifiers (Comp_Expr);
 
-                           if Writable_Actuals_List /= No_Elist then
+                           if Present (Writable_Actuals_List) then
 
                               --  As suggested by Robert, at current stage we
                               --  report occurrences of this case as warnings.
@@ -3908,7 +3908,7 @@ package body Sem_Util is
       --  Check violation of RM 6.20/3 in aggregates
 
       if Present (Aggr_Error_Node)
-        and then Writable_Actuals_List /= No_Elist
+        and then Present (Writable_Actuals_List)
       then
          Error_Msg_N
            ("value may be affected by call in other component because they "
@@ -3919,8 +3919,8 @@ package body Sem_Util is
 
       --  Check if some writable argument of a function is referenced
 
-      if Writable_Actuals_List /= No_Elist
-        and then Identifiers_List /= No_Elist
+      if Present (Writable_Actuals_List)
+        and then Present (Identifiers_List)
       then
          declare
             Elmt_1 : Elmt_Id;
index a63c9bea316f958f557f66a704c91885d23170c4..2faf3f85656e914dc553b0a3487a2682dbd34853 100644 (file)
@@ -539,7 +539,7 @@ package body Treepr is
          return;
       end if;
 
-      if E = No_Elist then
+      if No (E) then
          Write_Str ("<no elist>");
 
       elsif Is_Empty_Elmt_List (E) then