public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] ada: Refactor: replace uses of `not Present(X)` with `No (X)`
@ 2022-11-04 13:56 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2022-11-04 13:56 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ghjuvan Lacambre

From: Ghjuvan Lacambre <lacambre@adacore.com>

`No (X)` is essentially `not Present (X)`, there's no reason for not
using this shorter form.

gcc/ada/

	* checks.adb, exp_atag.adb, exp_attr.adb, exp_ch4.adb, exp_ch6.adb,
	exp_ch7.adb, exp_dbug.adb, exp_disp.adb, exp_unst.adb, exp_util.adb,
	freeze.adb, layout.adb, pprint.adb, rtsfind.adb, sem_aggr.adb,
	sem_attr.adb, sem_case.adb, sem_ch12.adb, sem_ch13.adb, sem_ch3.adb,
	sem_ch5.adb, sem_ch6.adb, sem_ch8.adb, sem_dim.adb, sem_prag.adb,
	sem_util.adb, sem_warn.adb:
	Replace uses of `not Present (X)` with `No (X)`.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/checks.adb   |  4 ++--
 gcc/ada/exp_atag.adb |  2 +-
 gcc/ada/exp_attr.adb |  2 +-
 gcc/ada/exp_ch4.adb  |  4 ++--
 gcc/ada/exp_ch6.adb  |  4 ++--
 gcc/ada/exp_ch7.adb  |  2 +-
 gcc/ada/exp_dbug.adb |  2 +-
 gcc/ada/exp_disp.adb | 16 +++++++---------
 gcc/ada/exp_unst.adb |  2 +-
 gcc/ada/exp_util.adb |  8 ++++----
 gcc/ada/freeze.adb   | 12 ++++++------
 gcc/ada/layout.adb   |  2 +-
 gcc/ada/pprint.adb   |  4 ++--
 gcc/ada/rtsfind.adb  |  4 ++--
 gcc/ada/sem_aggr.adb |  4 ++--
 gcc/ada/sem_attr.adb |  2 +-
 gcc/ada/sem_case.adb |  2 +-
 gcc/ada/sem_ch12.adb |  2 +-
 gcc/ada/sem_ch13.adb | 14 +++++++-------
 gcc/ada/sem_ch3.adb  |  8 ++++----
 gcc/ada/sem_ch5.adb  |  3 +--
 gcc/ada/sem_ch6.adb  | 16 ++++++++--------
 gcc/ada/sem_ch8.adb  |  8 ++++----
 gcc/ada/sem_dim.adb  |  2 +-
 gcc/ada/sem_prag.adb |  4 ++--
 gcc/ada/sem_util.adb | 16 ++++++++--------
 gcc/ada/sem_warn.adb |  2 +-
 27 files changed, 74 insertions(+), 77 deletions(-)

diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index 8fa16b802de..47412948b78 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -593,7 +593,7 @@ package body Checks is
       pragma Assert (not No_Dynamic_Accessibility_Checks_Enabled (N));
 
       if Ada_Version >= Ada_2012
-         and then not Present (Param_Ent)
+         and then No (Param_Ent)
          and then Is_Entity_Name (N)
          and then Ekind (Entity (N)) in E_Constant | E_Variable
          and then Present (Effective_Extra_Accessibility (Entity (N)))
@@ -778,7 +778,7 @@ package body Checks is
          --  Note: Expr is empty if the address-clause is applied to in-mode
          --  actuals (allowed by 13.1(22)).
 
-         if not Present (Expr)
+         if No (Expr)
            or else
              (Is_Entity_Name (Expression (AC))
                and then Ekind (Entity (Expression (AC))) = E_Constant
diff --git a/gcc/ada/exp_atag.adb b/gcc/ada/exp_atag.adb
index 787136346c6..074ab4e9093 100644
--- a/gcc/ada/exp_atag.adb
+++ b/gcc/ada/exp_atag.adb
@@ -312,7 +312,7 @@ package body Exp_Atag is
 
          if not Is_Predefined_Dispatching_Operation (Prim)
            and then not Is_Predefined_Dispatching_Operation (E)
-           and then not Present (Interface_Alias (Prim))
+           and then No (Interface_Alias (Prim))
            and then not Is_Abstract_Subprogram (E)
            and then not Is_Eliminated (E)
            and then Prim_Pos <= CPP_Nb_Prims
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index 0e79b5d10cd..3c3f725cf27 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -6575,7 +6575,7 @@ package body Exp_Attr is
                --  If Storage_Size wasn't found (can only occur in the simple
                --  storage pool case), then simply use zero for the result.
 
-               if not Present (Alloc_Op) then
+               if No (Alloc_Op) then
                   Rewrite (N, Make_Integer_Literal (Loc, 0));
 
                --  Otherwise, rewrite the allocator as a call to pool type's
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 0b7e3911c6a..7a3a414ca0d 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -6733,7 +6733,7 @@ package body Exp_Ch4 is
         --  Skip this for predicated types, where such expressions are a
         --  reasonable way of testing if something meets the predicate.
 
-        and then not Present (Predicate_Function (Ltyp))
+        and then No (Predicate_Function (Ltyp))
       then
          Substitute_Valid_Check;
          return;
@@ -7148,7 +7148,7 @@ package body Exp_Ch4 is
                   if Is_Entity_Name (Lop) then
                      Expr_Entity := Param_Entity (Lop);
 
-                     if not Present (Expr_Entity) then
+                     if No (Expr_Entity) then
                         Expr_Entity := Entity (Lop);
                      end if;
                   end if;
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index ce1a7525fa2..cf64e82bc99 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -376,7 +376,7 @@ package body Exp_Ch6 is
 
       --  If no return object is provided, then pass null
 
-      if not Present (Return_Object) then
+      if No (Return_Object) then
          Obj_Address := Make_Null (Loc);
          Set_Parent (Obj_Address, Function_Call);
 
@@ -3223,7 +3223,7 @@ package body Exp_Ch6 is
             loop
                Aspect_Bearer := Nearest_Ancestor (Aspect_Bearer);
 
-               if not Present (Aspect_Bearer) then
+               if No (Aspect_Bearer) then
                   return False;
                end if;
 
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index fc4516dde5b..b20d7dbed5f 100644
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -4452,7 +4452,7 @@ package body Exp_Ch7 is
    begin
       if Is_Derived_Type (Typ)
         and then Comes_From_Source (E)
-        and then not Present (Overridden_Operation (E))
+        and then No (Overridden_Operation (E))
       then
          --  We know that the explicit operation on the type does not override
          --  the inherited operation of the parent, and that the derivation
diff --git a/gcc/ada/exp_dbug.adb b/gcc/ada/exp_dbug.adb
index 76f08e3619b..3ab68885bfe 100644
--- a/gcc/ada/exp_dbug.adb
+++ b/gcc/ada/exp_dbug.adb
@@ -415,7 +415,7 @@ package body Exp_Dbug is
                | N_Identifier
             =>
                if No (Entity (Ren))
-                 or else not Present (Renamed_Entity_Or_Object (Entity (Ren)))
+                 or else No (Renamed_Entity_Or_Object (Entity (Ren)))
                then
                   exit;
                end if;
diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb
index 3ac4b3b4398..43ae2e0f34d 100644
--- a/gcc/ada/exp_disp.adb
+++ b/gcc/ada/exp_disp.adb
@@ -4052,8 +4052,7 @@ package body Exp_Disp is
                     and then not Is_Abstract_Subprogram (Prim)
                     and then not Is_Eliminated (Prim)
                     and then not Generate_SCIL
-                    and then not
-                      Present (Prim_Table (UI_To_Int (DT_Position (Prim))))
+                    and then No (Prim_Table (UI_To_Int (DT_Position (Prim))))
                   then
                      if not Build_Thunks then
                         E := Ultimate_Alias (Prim);
@@ -5269,7 +5268,7 @@ package body Exp_Disp is
             E       : Entity_Id;
 
          begin
-            if not Present (Def)
+            if No (Def)
               or else Entity (Name (Def)) /= First_Subtype (Typ)
             then
                New_Node :=
@@ -5872,8 +5871,7 @@ package body Exp_Disp is
                     and then not Is_Abstract_Subprogram (Prim)
                     and then not Is_Eliminated (Prim)
                     and then not Generate_SCIL
-                    and then not Present (Prim_Table
-                                           (UI_To_Int (DT_Position (Prim))))
+                    and then No (Prim_Table (UI_To_Int (DT_Position (Prim))))
                   then
                      E := Ultimate_Alias (Prim);
                      pragma Assert (not Is_Abstract_Subprogram (E));
@@ -6038,7 +6036,7 @@ package body Exp_Disp is
                     --  those are only required to build secondary dispatch
                     --  tables.
 
-                    and then not Present (Interface_Alias (Prim))
+                    and then No (Interface_Alias (Prim))
 
                     --  Skip abstract and eliminated primitives
 
@@ -7496,7 +7494,7 @@ package body Exp_Disp is
 
       --  Primitive associated with a tagged type
 
-      if not Present (Interface_Alias (Prim)) then
+      if No (Interface_Alias (Prim)) then
          Tag_Typ := Scope (DTC_Entity (Prim));
          Pos     := DT_Position (Prim);
          Tag     := First_Tag_Component (Tag_Typ);
@@ -8023,7 +8021,7 @@ package body Exp_Disp is
             --  same dispatch table slot, but if it renames an operation in a
             --  nested package it's a new primitive and will have its own slot.
 
-            elsif not Present (Interface_Alias (Prim))
+            elsif No (Interface_Alias (Prim))
               and then Present (Alias (Prim))
               and then Chars (Prim) = Chars (Alias (Prim))
               and then Nkind (Unit_Declaration_Node (Prim)) /=
@@ -8191,7 +8189,7 @@ package body Exp_Disp is
            and then Present (Alias (Prim))
            and then not Is_Interface
                           (Find_Dispatching_Type (Ultimate_Alias (Prim)))
-           and then not Present (Interface_Alias (Prim))
+           and then No (Interface_Alias (Prim))
            and then Is_Derived_Type (Typ)
            and then In_Private_Part (Current_Scope)
            and then
diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb
index 91646447475..fd4c543ddfc 100644
--- a/gcc/ada/exp_unst.adb
+++ b/gcc/ada/exp_unst.adb
@@ -2225,7 +2225,7 @@ package body Exp_Unst is
 
             if No (UPJ.Ref)
               or else not Is_Entity_Name (UPJ.Ref)
-              or else not Present (Entity (UPJ.Ref))
+              or else No (Entity (UPJ.Ref))
               or else not Opt.Generate_C_Code
             then
                goto Continue;
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index f569d2ef583..6c87debe456 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -1700,7 +1700,7 @@ package body Exp_Util is
          --  type attributes.
 
       begin
-         if not Present (Priv_Typ) and then not Present (Full_Typ) then
+         if No (Priv_Typ) and then No (Full_Typ) then
             return;
          end if;
 
@@ -1787,7 +1787,7 @@ package body Exp_Util is
                --  full type doesn't have its own DIC, but is inherited from
                --  a type with DIC), get the full DIC procedure.
 
-               if not Present (Par_Proc) then
+               if No (Par_Proc) then
                   Par_Proc := DIC_Procedure (Par_Typ);
                end if;
 
@@ -2745,7 +2745,7 @@ package body Exp_Util is
          --  type attributes.
 
       begin
-         if not Present (Priv_Typ) and then not Present (Full_Typ) then
+         if No (Priv_Typ) and then No (Full_Typ) then
             return;
          end if;
 
@@ -3072,7 +3072,7 @@ package body Exp_Util is
          Prag_Typ_Arg  : Node_Id;
 
       begin
-         if not Present (T) then
+         if No (T) then
             return;
          end if;
 
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 346904ee0a4..888e2ecb7af 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -3793,7 +3793,7 @@ package body Freeze is
                      --  Set component size if not already set by a component
                      --  size clause.
 
-                     if not Present (Comp_Size_C) then
+                     if No (Comp_Size_C) then
                         Set_Component_Size (Arr, Csiz);
                      end if;
 
@@ -3805,7 +3805,7 @@ package body Freeze is
                      --  explicitly, then generate a warning.
 
                      if Has_Pragma_Pack (Arr)
-                       and then not Present (Comp_Size_C)
+                       and then No (Comp_Size_C)
                        and then (Csiz = 7 or else Csiz = 15 or else Csiz = 31)
                        and then Known_Esize (Base_Type (Ctyp))
                        and then Esize (Base_Type (Ctyp)) = Csiz + 1
@@ -7059,7 +7059,7 @@ package body Freeze is
             --  end of a declarative part.
 
             if Is_Library_Level_Tagged_Type (E)
-              and then not Present (Full_View (E))
+              and then No (Full_View (E))
             then
                Set_Is_Frozen (E, False);
                goto Leave;
@@ -7467,7 +7467,7 @@ package body Freeze is
                      --  If no formal is passed in, then issue an error for a
                      --  missing formal.
 
-                     elsif not Present (Pool_Op_Formal) then
+                     elsif No (Pool_Op_Formal) then
                         Error_Msg_NE
                           ("simple storage pool op missing formal " &
                            Formal_Name & " of type&", Pool_Op, Expected_Type);
@@ -7599,7 +7599,7 @@ package body Freeze is
                            --  and no excess formals are present, then this
                            --  operation has been validated, so record it.
 
-                           if not Present (Formal) and then Is_OK then
+                           if No (Formal) and then Is_OK then
                               Found_Op := Op;
                            end if;
                         end if;
@@ -7611,7 +7611,7 @@ package body Freeze is
                      --  so issue an error if none was found.
 
                      if Op_Name = Name_Allocate
-                       and then not Present (Found_Op)
+                       and then No (Found_Op)
                      then
                         Error_Msg_N ("missing % operation for simple " &
                                      "storage pool type", Pool_Type);
diff --git a/gcc/ada/layout.adb b/gcc/ada/layout.adb
index e4187dd9ce5..4f764bf0e75 100644
--- a/gcc/ada/layout.adb
+++ b/gcc/ada/layout.adb
@@ -500,7 +500,7 @@ package body Layout is
          if Is_Array_Type (E)
            and then Present (First_Index (E))  --  Skip types in error
            and then Number_Dimensions (E) = 1
-           and then not Present (Packed_Array_Impl_Type (E))
+           and then No (Packed_Array_Impl_Type (E))
            and then Has_Pragma_Pack (E)
            and then Is_Constrained (E)
            and then Compile_Time_Known_Bounds (E)
diff --git a/gcc/ada/pprint.adb b/gcc/ada/pprint.adb
index 983a90bb78e..43939a23197 100644
--- a/gcc/ada/pprint.adb
+++ b/gcc/ada/pprint.adb
@@ -114,7 +114,7 @@ package body Pprint is
             Num       : Natural := 1) return String
          is
          begin
-            if not Present (List) then
+            if No (List) then
                if First or else not Add_Paren then
                   return "";
                else
@@ -229,7 +229,7 @@ package body Pprint is
                --  is not prepared to deal with a zero-length result.
 
                elsif Null_Record_Present (Expr)
-                 or else not Present (First (Component_Associations (Expr)))
+                 or else No (First (Component_Associations (Expr)))
                then
                   return ("(null record)");
 
diff --git a/gcc/ada/rtsfind.adb b/gcc/ada/rtsfind.adb
index cda13d4bf4c..2c2293812ee 100644
--- a/gcc/ada/rtsfind.adb
+++ b/gcc/ada/rtsfind.adb
@@ -1668,7 +1668,7 @@ package body Rtsfind is
 
       --  Load unit if unit not previously loaded
 
-      if not Present (U.Entity) then
+      if No (U.Entity) then
          Load_RTU (U_Id, Id => E);
       end if;
 
@@ -1687,7 +1687,7 @@ package body Rtsfind is
             E1 := First_Entity (Pkg_Ent);
             while Present (E1) loop
                if Ename = Chars (E1) then
-                  pragma Assert (not Present (Found_E));
+                  pragma Assert (No (Found_E));
                   Found_E := E1;
                end if;
 
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 5db1fce01b0..87a8c1a3c40 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -2355,7 +2355,7 @@ package body Sem_Aggr is
                --  duplicate the expression tree to analyze the copy and
                --  perform the required check.
 
-               elsif not Present (Etype (Expression (Assoc))) then
+               elsif No (Etype (Expression (Assoc))) then
                   declare
                      Save_Analysis : constant Boolean := Full_Analysis;
                      Expr          : constant Node_Id :=
@@ -5747,7 +5747,7 @@ package body Sem_Aggr is
             --  Ignore hidden components associated with the position of the
             --  interface tags: these are initialized dynamically.
 
-            if not Present (Related_Type (Component)) then
+            if No (Related_Type (Component)) then
                Error_Msg_NE
                  ("no value supplied for component &!", N, Component);
             end if;
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index d518aca3758..299ea04959c 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -6425,7 +6425,7 @@ package body Sem_Attr is
             --  type to the pool object's type.
 
             else
-               if not Present (Get_Rep_Pragma (Etype (Entity (N)),
+               if No (Get_Rep_Pragma (Etype (Entity (N)),
                                                Name_Simple_Storage_Pool_Type))
                then
                   Error_Attr_P
diff --git a/gcc/ada/sem_case.adb b/gcc/ada/sem_case.adb
index 5042c9ecab0..bb732b76eb9 100644
--- a/gcc/ada/sem_case.adb
+++ b/gcc/ada/sem_case.adb
@@ -1611,7 +1611,7 @@ package body Sem_Case is
                   begin
                      while Present (Comp) loop
                         if Chars (First (Choices (Comp))) = Orig_Name then
-                           pragma Assert (not Present (Matching_Comp));
+                           pragma Assert (No (Matching_Comp));
                            Matching_Comp := Comp;
                         end if;
 
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index ab2e1825679..6781e5ee5b6 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -14086,7 +14086,7 @@ package body Sem_Ch12 is
             --  a full view, then we'll retrieve that.
 
             if Ekind (A_Gen_T) = E_Incomplete_Type
-              and then not Present (Full_View (Act_T))
+              and then No (Full_View (Act_T))
             then
                null;
 
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 0dea4d4f03d..6f4d33b6d55 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -1271,7 +1271,7 @@ package body Sem_Ch13 is
                                   | Aspect_Full_Access_Only
                                   | Aspect_Import
                        and then (A_Id /= Aspect_Preelaborable_Initialization
-                                  or else not Present (Expression (ASN)))
+                                  or else No (Expression (ASN)))
                      then
                         Make_Pragma_From_Boolean_Aspect (ASN);
                      end if;
@@ -1327,7 +1327,7 @@ package body Sem_Ch13 is
                      if not Is_Entity_Name (Expression (ASN))
                        or else not Is_Object (Entity (Expression (ASN)))
                        or else
-                         not Present (Find_Aspect (Etype (Expression (ASN)),
+                         No (Find_Aspect (Etype (Expression (ASN)),
                                                    Aspect_Storage_Model_Type))
                      then
                         Error_Msg_N
@@ -1915,7 +1915,7 @@ package body Sem_Ch13 is
                --  aspects are replaced with pragmas at the freeze point in
                --  Make_Pragma_From_Boolean_Aspect.
 
-               if not Present (Expr)
+               if No (Expr)
                  or else Is_True (Static_Boolean (Expr))
                then
                   if A_Id = Aspect_Import then
@@ -7547,7 +7547,7 @@ package body Sem_Ch13 is
             else
                Analyze_And_Resolve (Expr);
 
-               if not Present (Get_Rep_Pragma
+               if No (Get_Rep_Pragma
                                  (Etype (Expr), Name_Simple_Storage_Pool_Type))
                then
                   Error_Msg_N
@@ -16511,7 +16511,7 @@ package body Sem_Ch13 is
 
       begin
          for FP of Profiles loop
-            if not Present (Formal) then
+            if No (Formal) then
                Is_Error := True;
                Report_Argument_Error ("missing formal of }", Subt => FP.Subt);
                exit;
@@ -16582,7 +16582,7 @@ package body Sem_Ch13 is
       --  If Addr_Type is not present as the first association, then we default
       --  it to System.Address.
 
-      elsif not Present (Addr_Type) then
+      elsif No (Addr_Type) then
          Addr_Type := RTE (RE_Address);
       end if;
 
@@ -17251,7 +17251,7 @@ package body Sem_Ch13 is
          Param_Type := Standard_String;
       end if;
 
-      if not Overloaded and then not Present (Entity (Func_Name)) then
+      if not Overloaded and then No (Entity (Func_Name)) then
          --  The aspect is specified by a subprogram name, which
          --  may be an operator name given originally by a string.
 
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 766290144ab..90af32091e9 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -2668,7 +2668,7 @@ package body Sem_Ch3 is
                   --  Is_Conjunction_Of_Formal_Preelab_Init_Attributes goes to
                   --  Original_Node if needed, hence test for Standard_False.)
 
-                  if not Present (Expr)
+                  if No (Expr)
                     or else (Is_Entity_Name (Expr)
                               and then Entity (Expr) = Standard_True)
                     or else
@@ -11050,7 +11050,7 @@ package body Sem_Ch3 is
             --  with the aliased entity (otherwise we generate a duplicated
             --  error message).
 
-           and then not Present (Interface_Alias (Subp))
+           and then No (Interface_Alias (Subp))
          then
             if Present (Alias_Subp) then
 
@@ -14541,7 +14541,7 @@ package body Sem_Ch3 is
          --  in various places for an Empty upper bound, and in any case it
          --  accurately characterizes the index's range of values.
 
-         if Nkind (S) = N_Range and then not Present (High_Bound (S)) then
+         if Nkind (S) = N_Range and then No (High_Bound (S)) then
             Is_FLB_Index := True;
             Set_High_Bound (S, Type_High_Bound (T));
          end if;
@@ -16784,7 +16784,7 @@ package body Sem_Ch3 is
             --   have such primitives.
 
             if Present (Generic_Actual)
-              and then not Present (Act_Subp)
+              and then No (Act_Subp)
               and then Is_Limited_Interface (Parent_Base)
               and then Is_Predefined_Interface_Primitive (Subp)
             then
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index ac495231156..5f0629d32b3 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -1042,8 +1042,7 @@ package body Sem_Ch5 is
                         if Ekind (Comp_Id) = E_Component
                           and then Nkind (Parent (Comp_Id))
                                      = N_Component_Declaration
-                          and then
-                            not Present (Expression (Parent (Comp_Id)))
+                          and then No (Expression (Parent (Comp_Id)))
                         then
                            return True;
                         end if;
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 7ad6408af81..228adcff5cd 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -264,7 +264,7 @@ package body Sem_Ch6 is
 
       elsif Warn_On_Redundant_Constructs
         and then not Is_Dispatching_Operation (Subp_Id)
-        and then not Present (Overridden_Operation (Subp_Id))
+        and then No (Overridden_Operation (Subp_Id))
         and then (not Is_Operator_Symbol_Name (Chars (Subp_Id))
                    or else Scop /= Scope (Etype (First_Formal (Subp_Id))))
       then
@@ -4070,7 +4070,7 @@ package body Sem_Ch6 is
             --  an instance that may have manipulated the flag during
             --  expansion. As a result, we add an exception for this case.
 
-            elsif not Present (Overridden_Operation (Spec_Id))
+            elsif No (Overridden_Operation (Spec_Id))
               and then not (Chars (Spec_Id) in Name_Adjust
                                              | Name_Finalize
                                              | Name_Initialize
@@ -6795,7 +6795,7 @@ package body Sem_Ch6 is
                   Error_Msg_Sloc   := Sloc (Op);
 
                   if Comes_From_Source (Op) or else No (Alias (Op)) then
-                     if not Present (Overridden_Operation (Op)) then
+                     if No (Overridden_Operation (Op)) then
                         Error_Msg_N ("\\primitive % defined #", Typ);
                      else
                         Error_Msg_N
@@ -8366,7 +8366,7 @@ package body Sem_Ch6 is
               or else not Is_Overloadable (Subp)
               or else not Is_Primitive (Subp)
               or else not Is_Dispatching_Operation (Subp)
-              or else not Present (Find_Dispatching_Type (Subp))
+              or else No (Find_Dispatching_Type (Subp))
               or else not Is_Interface (Find_Dispatching_Type (Subp))
             then
                null;
@@ -11389,7 +11389,7 @@ package body Sem_Ch6 is
                   return False;
                end if;
 
-               if not Present (Partial_View) then
+               if No (Partial_View) then
                   return True;
                end if;
 
@@ -11403,7 +11403,7 @@ package body Sem_Ch6 is
                begin
                   loop
                      H := Homonym (H);
-                     exit when not Present (H) or else Scope (H) /= Scope (S);
+                     exit when No (H) or else Scope (H) /= Scope (S);
 
                      if Nkind (Parent (H)) in
                         N_Private_Extension_Declaration |
@@ -11451,7 +11451,7 @@ package body Sem_Ch6 is
 
                         if ((Present (Partial_View)
                               and then Is_Tagged_Type (Partial_View))
-                          or else (not Present (Partial_View)
+                          or else (No (Partial_View)
                                     and then Is_Tagged_Type (T)))
                           and then T = Base_Type (Etype (S))
                         then
@@ -12947,7 +12947,7 @@ package body Sem_Ch6 is
 
             --  No need to continue if we already notified errors
 
-            if not Present (Formal_Type) then
+            if No (Formal_Type) then
                return;
             end if;
 
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index e555de915e6..62b9cc03643 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -960,7 +960,7 @@ package body Sem_Ch8 is
             Set_Etype (Nam, T);
          end if;
       elsif Present (Subtype_Mark (N))
-        or else not Present (Access_Definition (N))
+        or else No (Access_Definition (N))
       then
          if Present (Subtype_Mark (N)) then
             Find_Type (Subtype_Mark (N));
@@ -4702,7 +4702,7 @@ package body Sem_Ch8 is
       --  want to deal with AST_Handler in ZFP mode.
 
       if not Configurable_Run_Time_Mode
-        and then not Present (Corresponding_Formal_Spec (N))
+        and then No (Corresponding_Formal_Spec (N))
         and then not Is_RTE (Etype (Nam), RE_AST_Handler)
       then
          declare
@@ -9272,9 +9272,9 @@ package body Sem_Ch8 is
          Scope1 := Scope (Scope1);
          Scope2 := Scope (Scope2);
 
-         if not Present (Scope1) then
+         if No (Scope1) then
             return Clause1;
-         elsif not Present (Scope2) then
+         elsif No (Scope2) then
             return Clause2;
          end if;
       end loop;
diff --git a/gcc/ada/sem_dim.adb b/gcc/ada/sem_dim.adb
index a24b9d72db6..801339aeca2 100644
--- a/gcc/ada/sem_dim.adb
+++ b/gcc/ada/sem_dim.adb
@@ -1316,7 +1316,7 @@ package body Sem_Dim is
 
          --  Look at the named components right after the positional components
 
-         if not Present (Next (Comp))
+         if No (Next (Comp))
            and then List_Containing (Comp) = Exps
          then
             Comp := First (Comp_Ass);
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index cdf4cbcccd4..60ea681001a 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -15408,12 +15408,12 @@ package body Sem_Prag is
             --  aspect/pragma from parent types (see Build_DIC_Procedure_Body),
             --  though that extra argument isn't documented for the pragma.
 
-            if not Present (Arg2) then
+            if No (Arg2) then
                --  When the pragma has no arguments, create an argument with
                --  the value Empty, so the type name argument can be appended
                --  following it (since it's expected as the second argument).
 
-               if not Present (Arg1) then
+               if No (Arg1) then
                   Set_Pragma_Argument_Associations (N, New_List (
                     Make_Pragma_Argument_Association (Sloc (Typ),
                       Expression => Empty)));
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 2736286d60d..9eeaf7cc05b 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -651,7 +651,7 @@ package body Sem_Util is
             --  been generated when one should have ???
 
             elsif Is_Formal (E)
-              and then not Present (Get_Dynamic_Accessibility (E))
+              and then No (Get_Dynamic_Accessibility (E))
               and then Ekind (Etype (E)) = E_Anonymous_Access_Type
             then
                return Make_Level_Literal (Scope_Depth (Standard_Standard));
@@ -1335,7 +1335,7 @@ package body Sem_Util is
             end if;
 
             return
-              not Present (Etype (Constr)) -- previous error
+              No (Etype (Constr)) -- previous error
                 or else not Is_Discrete_Type (Etype (Constr))
                 or else Is_OK_Static_Expression (Constr);
 
@@ -4449,7 +4449,7 @@ package body Sem_Util is
             pragma Assert (Present (Ifc_Ancestors (Idx)));
             Ifc := Next (Ifc);
          end loop;
-         pragma Assert (not Present (Ifc));
+         pragma Assert (No (Ifc));
          if Present (Parent_Type) then
             return Parent_Type & Ifc_Ancestors;
          else
@@ -11573,7 +11573,7 @@ package body Sem_Util is
       --  entry families with no Max_Queue_Length aspect or pragma default to
       --  it.
 
-      if not Present (Prag) then
+      if No (Prag) then
          return Uint_0;
       end if;
 
@@ -13092,7 +13092,7 @@ package body Sem_Util is
          Typ := Corresponding_Record_Type (Typ);
       end if;
 
-      if not Present (Typ)
+      if No (Typ)
         or else not Is_Record_Type (Typ)
         or else not Is_Tagged_Type (Typ)
       then
@@ -19458,7 +19458,7 @@ package body Sem_Util is
          return True;
       elsif Present (Variant_Part (Component_List (Record_Def))) then
          return False;
-      elsif not Present (Component_List (Record_Def)) then
+      elsif No (Component_List (Record_Def)) then
          return True;
       end if;
 
@@ -31575,7 +31575,7 @@ package body Sem_Util is
                   Next (Range_Or_Expr);
                end loop;
 
-               pragma Assert (not Present (Range_Or_Expr));
+               pragma Assert (No (Range_Or_Expr));
                Check_Consistency (Result);
                return Result;
             end;
@@ -31825,7 +31825,7 @@ package body Sem_Util is
                        and then Is_Non_Empty_List (Alternatives (Par))
                        and then Trailer /= First (Alternatives (Par))
                      then
-                        pragma Assert (not Present (Right_Opnd (Par)));
+                        pragma Assert (No (Right_Opnd (Par)));
                         pragma Assert
                           (Is_List_Member (Trailer)
                            and then List_Containing (Trailer)
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index 1d73f21e7de..509efa50af3 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -4282,7 +4282,7 @@ package body Sem_Warn is
          if Ekind (Form) = E_Out_Parameter
            and then Never_Set_In_Source_Check_Spec (Form)
            and then Is_Scalar_Type (Etype (Form))
-           and then not Present (Unset_Reference (Form))
+           and then No (Unset_Reference (Form))
          then
             --  Here all conditions are met, record possible unset reference
 
-- 
2.34.1


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

only message in thread, other threads:[~2022-11-04 13:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04 13:56 [COMMITTED] ada: Refactor: replace uses of `not Present(X)` with `No (X)` Marc Poulhiès

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).