]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/testsuite/gdb.base/complex-parts.exp
Implement complex arithmetic
authorTom Tromey <tom@tromey.com>
Wed, 1 Apr 2020 20:09:52 +0000 (14:09 -0600)
committerTom Tromey <tromey@adacore.com>
Wed, 1 Apr 2020 20:09:53 +0000 (14:09 -0600)
commitc34e87146628a14cf662dca46aac893d06502f52
tree3dd1b1f4ab1cea91ed807e40b81427fb696f4ce7
parentfa649bb7d3c8fd97c1d8f01a3023094468f66ca4
Implement complex arithmetic

This adds support for complex arithmetic to gdb.  Now something like
"print 23 + 7i" will work.

Addition, subtraction, multiplication, division, and equality testing
are supported binary operations.

Unary +, negation, and complement are supported.  Following GCC, the ~
operator computes the complex conjugate.

gdb/ChangeLog
2020-04-01  Tom Tromey  <tom@tromey.com>

PR exp/25299:
* valarith.c (promotion_type, complex_binop): New functions.
(scalar_binop): Handle complex numbers.  Use promotion_type.
(value_pos, value_neg, value_complement): Handle complex numbers.

gdb/testsuite/ChangeLog
2020-04-01  Tom Tromey  <tom@tromey.com>

* gdb.base/complex-parts.exp: Add arithmetic tests.
gdb/ChangeLog
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/complex-parts.exp
gdb/valarith.c