mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-12 12:16:04 +08:00
c04da66c26
In the expression rewrite, I neglected to carry over support for Ada operator overloading. It turns out that there were no tests for this in-tree. This patch adds support for operator overloading, and adds the missing test. gdb/ChangeLog 2021-03-15 Tom Tromey <tromey@adacore.com> * ada-lang.c (numeric_type_p, integer_type_p): Return true for fixed-point. * ada-exp.y (maybe_overload): New function. (ada_wrap_overload): New function. (ada_un_wrap2, ada_wrap2, ada_wrap_op): Use maybe_overload. (exp1, simple_exp, relation, and_exp, and_then_exp, or_exp) (or_else_exp, xor_exp, primary): Update. gdb/testsuite/ChangeLog 2021-03-15 Tom Tromey <tromey@adacore.com> * gdb.ada/operator_call/twovecs.ads: New file. * gdb.ada/operator_call/twovecs.adb: New file. * gdb.ada/operator_call/opcall.adb: New file. * gdb.ada/operator_call.exp: New file.
56 lines
1.9 KiB
Ada
56 lines
1.9 KiB
Ada
-- Copyright 2021 Free Software Foundation, Inc.
|
|
--
|
|
-- This program is free software; you can redistribute it and/or modify
|
|
-- it under the terms of the GNU General Public License as published by
|
|
-- the Free Software Foundation; either version 3 of the License, or
|
|
-- (at your option) any later version.
|
|
--
|
|
-- This program is distributed in the hope that it will be useful,
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
-- GNU General Public License for more details.
|
|
--
|
|
-- You should have received a copy of the GNU General Public License
|
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
package Twovecs is
|
|
type My_Integer is mod 2**16 ;
|
|
|
|
type Twovec is private;
|
|
|
|
function Pt (X, Y : My_Integer) return Twovec;
|
|
|
|
function "+" (P0, P1 : Twovec) return Twovec;
|
|
function "-" (P0, P1 : Twovec) return Twovec;
|
|
function "*" (P0, P1 : Twovec) return Twovec;
|
|
function "/" (P0, P1 : Twovec) return Twovec;
|
|
function "mod" (P0, P1 : Twovec) return Twovec;
|
|
function "rem" (P0, P1 : Twovec) return Twovec;
|
|
function "**" (P0, P1 : Twovec) return Twovec;
|
|
|
|
function "<" (P0, P1 : Twovec) return Boolean;
|
|
function "<=" (P0, P1 : Twovec) return Boolean;
|
|
function ">" (P0, P1 : Twovec) return Boolean;
|
|
function ">=" (P0, P1 : Twovec) return Boolean;
|
|
function "=" (P0, P1 : Twovec) return Boolean;
|
|
|
|
function "and" (P0, P1 : Twovec) return Twovec;
|
|
function "or" (P0, P1 : Twovec) return Twovec;
|
|
function "xor" (P0, P1 : Twovec) return Twovec;
|
|
function "&" (P0, P1 : Twovec) return Twovec;
|
|
|
|
function "abs" (P0 : Twovec) return Twovec;
|
|
function "not" (P0 : Twovec) return Twovec;
|
|
function "+" (P0 : Twovec) return Twovec;
|
|
function "-" (P0 : Twovec) return Twovec;
|
|
|
|
procedure Do_Nothing (P : Twovec);
|
|
|
|
private
|
|
|
|
type Twovec is record
|
|
X, Y : My_Integer;
|
|
end record;
|
|
|
|
end Twovecs;
|