public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-244] [Ada] Cleanup detection of No_Elist with No and Present
@ 2022-05-10  8:22 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-10  8:22 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:b814f0bdf1c1f6bcb628567c8e0e95fd68425657

commit r13-244-gb814f0bdf1c1f6bcb628567c8e0e95fd68425657
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Thu Jan 20 20:14:20 2022 +0100

    [Ada] Cleanup detection of No_Elist with No and Present
    
    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.

Diff:
---
 gcc/ada/exp_ch11.adb  |  4 ++--
 gcc/ada/exp_ch5.adb   |  2 +-
 gcc/ada/exp_prag.adb  |  2 +-
 gcc/ada/gnat_cuda.adb | 12 ++++++------
 gcc/ada/sem_ch12.adb  |  2 +-
 gcc/ada/sem_ch3.adb   |  2 +-
 gcc/ada/sem_ch6.adb   |  4 ++--
 gcc/ada/sem_util.adb  | 12 ++++++------
 gcc/ada/treepr.adb    |  2 +-
 9 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/gcc/ada/exp_ch11.adb b/gcc/ada/exp_ch11.adb
index 855d3038826..00b7745f7e1 100644
--- a/gcc/ada/exp_ch11.adb
+++ b/gcc/ada/exp_ch11.adb
@@ -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;
 
diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb
index 710db666e8d..ba575740a3d 100644
--- a/gcc/ada/exp_ch5.adb
+++ b/gcc/ada/exp_ch5.adb
@@ -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;
diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb
index bf2d29744c4..70b16c866d4 100644
--- a/gcc/ada/exp_prag.adb
+++ b/gcc/ada/exp_prag.adb
@@ -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;
 
diff --git a/gcc/ada/gnat_cuda.adb b/gcc/ada/gnat_cuda.adb
index dc4261a9607..2a0a450d886 100644
--- a/gcc/ada/gnat_cuda.adb
+++ b/gcc/ada/gnat_cuda.adb
@@ -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;
 
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index f01562d7cac..fa36d0f8f05 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -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);
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index a88f7f205fd..2ab273b3acf 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -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)));
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 510cad2c70a..92e48fa413b 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -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;
 
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index c58b63db924..1d915ab0f28 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -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;
diff --git a/gcc/ada/treepr.adb b/gcc/ada/treepr.adb
index a63c9bea316..2faf3f85656 100644
--- a/gcc/ada/treepr.adb
+++ b/gcc/ada/treepr.adb
@@ -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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-10  8:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10  8:22 [gcc r13-244] [Ada] Cleanup detection of No_Elist with No and Present Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).