From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id 365073839C60; Mon, 4 Jul 2022 07:50:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 365073839C60 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-1433] [Ada] Add Ada 2022 Key function to sets containers X-Act-Checkin: gcc X-Git-Author: Bob Duff X-Git-Refname: refs/heads/master X-Git-Oldrev: cac397f3f6f29fe60d78d437c91f8a3842d567c9 X-Git-Newrev: eb6e8a7acd1b8ecf36489e01cafad61add528f23 Message-Id: <20220704075048.365073839C60@sourceware.org> Date: Mon, 4 Jul 2022 07:50:48 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jul 2022 07:50:48 -0000 https://gcc.gnu.org/g:eb6e8a7acd1b8ecf36489e01cafad61add528f23 commit r13-1433-geb6e8a7acd1b8ecf36489e01cafad61add528f23 Author: Bob Duff Date: Tue May 24 13:03:21 2022 -0400 [Ada] Add Ada 2022 Key function to sets containers This patch adds the new Generic_Keys.Key function to the set children of Ada.Containers. gcc/ada/ * libgnat/a-cbhase.ads, libgnat/a-cborse.ads, libgnat/a-cihase.ads, libgnat/a-ciorse.ads, libgnat/a-cohase.ads, libgnat/a-coorse.ads (Key): New function that takes a Container parameter, implemented as an expression function, so it is self explanatory (doesn't need a comment). Diff: --- gcc/ada/libgnat/a-cbhase.ads | 3 +++ gcc/ada/libgnat/a-cborse.ads | 3 +++ gcc/ada/libgnat/a-cihase.ads | 3 +++ gcc/ada/libgnat/a-ciorse.ads | 3 +++ gcc/ada/libgnat/a-cohase.ads | 3 +++ gcc/ada/libgnat/a-coorse.ads | 3 +++ 6 files changed, 18 insertions(+) diff --git a/gcc/ada/libgnat/a-cbhase.ads b/gcc/ada/libgnat/a-cbhase.ads index 7079c517418..351014d302f 100644 --- a/gcc/ada/libgnat/a-cbhase.ads +++ b/gcc/ada/libgnat/a-cbhase.ads @@ -403,6 +403,9 @@ is -- Applies generic formal operation Key to the element of the node -- designated by Position. + function Key (Container : Set; Position : Cursor) return Key_Type is + (Key (Element (Container, Position))); + function Element (Container : Set; Key : Key_Type) return Element_Type; -- Searches (as per the key-based Find) for the node containing Key, and -- returns the associated element. diff --git a/gcc/ada/libgnat/a-cborse.ads b/gcc/ada/libgnat/a-cborse.ads index be22c250714..53acf355a62 100644 --- a/gcc/ada/libgnat/a-cborse.ads +++ b/gcc/ada/libgnat/a-cborse.ads @@ -262,6 +262,9 @@ is function Key (Position : Cursor) return Key_Type; + function Key (Container : Set; Position : Cursor) return Key_Type is + (Key (Element (Container, Position))); + function Element (Container : Set; Key : Key_Type) return Element_Type; procedure Replace diff --git a/gcc/ada/libgnat/a-cihase.ads b/gcc/ada/libgnat/a-cihase.ads index dcd1d6a86fa..2bb452729fd 100644 --- a/gcc/ada/libgnat/a-cihase.ads +++ b/gcc/ada/libgnat/a-cihase.ads @@ -389,6 +389,9 @@ is -- Applies generic formal operation Key to the element of the node -- designated by Position. + function Key (Container : Set; Position : Cursor) return Key_Type is + (Key (Element (Container, Position))); + function Element (Container : Set; Key : Key_Type) return Element_Type; -- Searches (as per the key-based Find) for the node containing Key, and -- returns the associated element. diff --git a/gcc/ada/libgnat/a-ciorse.ads b/gcc/ada/libgnat/a-ciorse.ads index d053ac72649..51545d62e99 100644 --- a/gcc/ada/libgnat/a-ciorse.ads +++ b/gcc/ada/libgnat/a-ciorse.ads @@ -270,6 +270,9 @@ is function Key (Position : Cursor) return Key_Type; + function Key (Container : Set; Position : Cursor) return Key_Type is + (Key (Element (Container, Position))); + function Element (Container : Set; Key : Key_Type) return Element_Type; procedure Replace diff --git a/gcc/ada/libgnat/a-cohase.ads b/gcc/ada/libgnat/a-cohase.ads index 9f562d899b9..fb7dccaf931 100644 --- a/gcc/ada/libgnat/a-cohase.ads +++ b/gcc/ada/libgnat/a-cohase.ads @@ -401,6 +401,9 @@ is -- Applies generic formal operation Key to the element of the node -- designated by Position. + function Key (Container : Set; Position : Cursor) return Key_Type is + (Key (Element (Container, Position))); + function Element (Container : Set; Key : Key_Type) return Element_Type; -- Searches (as per the key-based Find) for the node containing Key, and -- returns the associated element. diff --git a/gcc/ada/libgnat/a-coorse.ads b/gcc/ada/libgnat/a-coorse.ads index 9619599a5b7..7596ed698f5 100644 --- a/gcc/ada/libgnat/a-coorse.ads +++ b/gcc/ada/libgnat/a-coorse.ads @@ -263,6 +263,9 @@ is function Key (Position : Cursor) return Key_Type; + function Key (Container : Set; Position : Cursor) return Key_Type is + (Key (Element (Container, Position))); + function Element (Container : Set; Key : Key_Type) return Element_Type; procedure Replace