public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-369] [Ada] Reuse collective subtype for comparison operators where possible
@ 2022-05-12 12:41 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-12 12:41 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e28064111c3c42e7b75c79c941c9fc339901f0dd
commit r13-369-ge28064111c3c42e7b75c79c941c9fc339901f0dd
Author: Piotr Trojanek <trojanek@adacore.com>
Date: Wed Feb 16 10:00:02 2022 +0100
[Ada] Reuse collective subtype for comparison operators where possible
Replace membership alternatives with N_Op_Compare. Code cleanup;
semantics is unaffected.
gcc/ada/
* sem_res.adb (Resolve_Actuals): Simplify with N_Op_Compare.
* sem_util.adb (Replace_Null_Operand,
Null_To_Null_Address_Convert_OK): Likewise.
Diff:
---
gcc/ada/sem_res.adb | 7 +------
gcc/ada/sem_util.adb | 8 ++------
2 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 125366b4973..f038a33eb55 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -4163,12 +4163,7 @@ package body Sem_Res is
-- marked with Any_Type. Since the operation has been resolved to
-- the user-defined operator, that is irrelevant, so reset Etype.
- if Nkind (Original_Node (N)) in N_Op_Eq
- | N_Op_Ge
- | N_Op_Gt
- | N_Op_Le
- | N_Op_Lt
- | N_Op_Ne
+ if Nkind (Original_Node (N)) in N_Op_Compare
and then not Is_Boolean_Type (Etype (N))
then
Set_Etype (A, Etype (F));
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 43b2c809f2c..2f1a5e05b95 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -14189,9 +14189,7 @@ package body Sem_Util is
begin
pragma Assert (Relaxed_RM_Semantics);
- pragma Assert
- (Nkind (N) in
- N_Null | N_Op_Eq | N_Op_Ge | N_Op_Gt | N_Op_Le | N_Op_Lt | N_Op_Ne);
+ pragma Assert (Nkind (N) in N_Null | N_Op_Compare);
if Nkind (N) = N_Null then
Rewrite (N, New_Occurrence_Of (RTE (RE_Null_Address), Sloc (N)));
@@ -26079,9 +26077,7 @@ package body Sem_Util is
if Nkind (N) = N_Null then
return Present (Typ) and then Is_Descendant_Of_Address (Typ);
- elsif Nkind (N) in
- N_Op_Eq | N_Op_Ge | N_Op_Gt | N_Op_Le | N_Op_Lt | N_Op_Ne
- then
+ elsif Nkind (N) in N_Op_Compare then
declare
L : constant Node_Id := Left_Opnd (N);
R : constant Node_Id := Right_Opnd (N);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-12 12:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 12:41 [gcc r13-369] [Ada] Reuse collective subtype for comparison operators where possible 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).