public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] ada: Minor tweaks for comparison operators
@ 2023-11-07  9:20 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-11-07  9:20 UTC (permalink / raw)
  To: gcc-patches; +Cc: Eric Botcazou

From: Eric Botcazou <ebotcazou@adacore.com>

No functional changes.

gcc/ada/

	* gen_il-gen-gen_nodes.adb (N_Op_Boolean): Fix description.
	* sem_ch4.adb (Analyze_Comparison_Equality_Op): Tidy up.
	* sem_ch12.adb (Copy_Generic_Node): Use N_Op_Compare subtype.

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

---
 gcc/ada/gen_il-gen-gen_nodes.adb | 3 +--
 gcc/ada/sem_ch12.adb             | 8 +-------
 gcc/ada/sem_ch4.adb              | 9 ++++-----
 3 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/gcc/ada/gen_il-gen-gen_nodes.adb b/gcc/ada/gen_il-gen-gen_nodes.adb
index 2ad6e60dae8..0d2a68ea681 100644
--- a/gcc/ada/gen_il-gen-gen_nodes.adb
+++ b/gcc/ada/gen_il-gen-gen_nodes.adb
@@ -255,8 +255,7 @@ begin -- Gen_IL.Gen.Gen_Nodes
         Sm (Do_Division_Check, Flag)));
 
    Ab (N_Op_Boolean, N_Binary_Op);
-   --  Binary operators that take operands of a boolean type, and yield a
-   --  result of a boolean type.
+   --  Binary operators that yield a result of a boolean type
 
    Cc (N_Op_And, N_Op_Boolean,
        (Sm (Chars, Name_Id),
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index c264f2a8283..80b3e16ea75 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -8196,13 +8196,7 @@ package body Sem_Ch12 is
                      --  if one of the operands is of a universal type, we need
                      --  to manually restore the full view of private types.
 
-                     if Nkind (N) in N_Op_Eq
-                                   | N_Op_Ge
-                                   | N_Op_Gt
-                                   | N_Op_Le
-                                   | N_Op_Lt
-                                   | N_Op_Ne
-                     then
+                     if Nkind (N) in N_Op_Compare then
                         if Yields_Universal_Type (Left_Opnd (Assoc)) then
                            if Present (Etype (Right_Opnd (Assoc)))
                              and then
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index e3badc3e19d..78249258f55 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -2099,16 +2099,15 @@ package body Sem_Ch4 is
          end loop;
       end if;
 
-      --  If there was no match, and the operator is inequality, this may be
+      --  If there was no match and the operator is inequality, this may be
       --  a case where inequality has not been made explicit, as for tagged
       --  types. Analyze the node as the negation of an equality operation.
-      --  This cannot be done earlier, because before analysis we cannot rule
+      --  This cannot be done earlier because, before analysis, we cannot rule
       --  out the presence of an explicit inequality.
 
-      if Etype (N) = Any_Type
-        and then Nkind (N) = N_Op_Ne
-      then
+      if Etype (N) = Any_Type and then Nkind (N) = N_Op_Ne then
          Op_Id := Get_Name_Entity_Id (Name_Op_Eq);
+
          while Present (Op_Id) loop
             if Ekind (Op_Id) = E_Operator then
                Find_Comparison_Equality_Types (L, R, Op_Id, N);
-- 
2.42.0


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

only message in thread, other threads:[~2023-11-07  9:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-07  9:20 [COMMITTED] ada: Minor tweaks for comparison operators 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).