* [PATCH] gdb/fortran: add support for legacy .xor. operator
@ 2021-02-24 17:57 Andrew Burgess
2021-02-24 19:39 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Burgess @ 2021-02-24 17:57 UTC (permalink / raw)
To: gdb-patches
gfortran supports .xor. as an alias for .neqv., see:
https://gcc.gnu.org/onlinedocs/gfortran/_002eXOR_002e-operator.html
this commit adds support for this operator to GDB.
gdb/ChangeLog:
* f-exp.y (fortran_operators): Add ".xor.".
gdb/testsuite/ChangeLog:
* gdb.fortran/dot-ops.exp (dot_operations): Test ".xor.".
---
gdb/ChangeLog | 4 ++++
gdb/f-exp.y | 1 +
gdb/testsuite/ChangeLog | 4 ++++
gdb/testsuite/gdb.fortran/dot-ops.exp | 8 ++++++++
4 files changed, 17 insertions(+)
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index e95a2c974ca..64f5fd50857 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -982,6 +982,7 @@ static const struct token fortran_operators[] =
{ ".eq.", EQUAL, BINOP_END, false },
{ ".eqv.", EQUAL, BINOP_END, false },
{ ".neqv.", NOTEQUAL, BINOP_END, false },
+ { ".xor.", NOTEQUAL, BINOP_END, false },
{ "==", EQUAL, BINOP_END, false },
{ ".ne.", NOTEQUAL, BINOP_END, false },
{ "/=", NOTEQUAL, BINOP_END, false },
diff --git a/gdb/testsuite/gdb.fortran/dot-ops.exp b/gdb/testsuite/gdb.fortran/dot-ops.exp
index cc9adf37aa4..f71a821c55d 100644
--- a/gdb/testsuite/gdb.fortran/dot-ops.exp
+++ b/gdb/testsuite/gdb.fortran/dot-ops.exp
@@ -31,6 +31,7 @@ proc test_dot_operations {} {
set not ".NOT."
set eqv ".EQV."
set neqv ".NEQV."
+ set xor ".XOR."
set eq ".EQ."
set ne ".NE."
set le ".LE."
@@ -45,6 +46,7 @@ proc test_dot_operations {} {
set not ".not."
set eqv ".eqv."
set neqv ".neqv."
+ set xor ".xor."
set eq ".eq."
set ne ".ne."
set le ".le."
@@ -81,6 +83,12 @@ proc test_dot_operations {} {
gdb_test "p $false $neqv $true" " = .TRUE."
gdb_test "p $false $neqv $false" " = .FALSE."
+ # And the legacy alias for NEQV, XOR
+ gdb_test "p $true $xor $true" " = .FALSE."
+ gdb_test "p $true $xor $false" " = .TRUE."
+ gdb_test "p $false $xor $true" " = .TRUE."
+ gdb_test "p $false $xor $false" " = .FALSE."
+
# Arithmetic EQ
gdb_test "p 5 $eq 4" " = .FALSE."
gdb_test "p 4 $eq 4" " = .TRUE."
--
2.25.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] gdb/fortran: add support for legacy .xor. operator
2021-02-24 17:57 [PATCH] gdb/fortran: add support for legacy .xor. operator Andrew Burgess
@ 2021-02-24 19:39 ` Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2021-02-24 19:39 UTC (permalink / raw)
To: Andrew Burgess; +Cc: gdb-patches
>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:
Andrew> gfortran supports .xor. as an alias for .neqv., see:
Andrew> https://gcc.gnu.org/onlinedocs/gfortran/_002eXOR_002e-operator.html
Andrew> this commit adds support for this operator to GDB.
Andrew> gdb/ChangeLog:
Andrew> * f-exp.y (fortran_operators): Add ".xor.".
FWIW, looks reasonable to me.
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-24 19:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-24 17:57 [PATCH] gdb/fortran: add support for legacy .xor. operator Andrew Burgess
2021-02-24 19:39 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox