public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Fix iteration on formal vectors
@ 2022-06-02  9:08 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-06-02  9:08 UTC (permalink / raw)
  To: gcc-patches; +Cc: Claire Dross

[-- Attachment #1: Type: text/plain, Size: 446 bytes --]

We need to use Extended_Index for the Position parameter of the Element
function in formal vectors so it is compatible with other primitives of
the Iterable aspect.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* libgnat/a-cfinve.ads (Element): Change the type of the
	Position parameter to Extended_Index.
	* libgnat/a-cfinve.adb (Element): Idem.
	* libgnat/a-cofove.ads (Element): Idem.
	* libgnat/a-cofove.adb (Element): Idem.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 1620 bytes --]

diff --git a/gcc/ada/libgnat/a-cfinve.adb b/gcc/ada/libgnat/a-cfinve.adb
--- a/gcc/ada/libgnat/a-cfinve.adb
+++ b/gcc/ada/libgnat/a-cfinve.adb
@@ -432,7 +432,7 @@ is
 
    function Element
      (Container : Vector;
-      Index     : Index_Type) return Element_Type
+      Index     : Extended_Index) return Element_Type
    is
    begin
       if Index > Container.Last then


diff --git a/gcc/ada/libgnat/a-cfinve.ads b/gcc/ada/libgnat/a-cfinve.ads
--- a/gcc/ada/libgnat/a-cfinve.ads
+++ b/gcc/ada/libgnat/a-cfinve.ads
@@ -284,7 +284,7 @@ is
 
    function Element
      (Container : Vector;
-      Index     : Index_Type) return Element_Type
+      Index     : Extended_Index) return Element_Type
    with
      Global => null,
      Pre    => Index in First_Index (Container) .. Last_Index (Container),


diff --git a/gcc/ada/libgnat/a-cofove.adb b/gcc/ada/libgnat/a-cofove.adb
--- a/gcc/ada/libgnat/a-cofove.adb
+++ b/gcc/ada/libgnat/a-cofove.adb
@@ -370,7 +370,7 @@ is
 
    function Element
      (Container : Vector;
-      Index     : Index_Type) return Element_Type
+      Index     : Extended_Index) return Element_Type
    is
    begin
       if Index > Container.Last then


diff --git a/gcc/ada/libgnat/a-cofove.ads b/gcc/ada/libgnat/a-cofove.ads
--- a/gcc/ada/libgnat/a-cofove.ads
+++ b/gcc/ada/libgnat/a-cofove.ads
@@ -263,7 +263,7 @@ is
 
    function Element
      (Container : Vector;
-      Index     : Index_Type) return Element_Type
+      Index     : Extended_Index) return Element_Type
    with
      Global => null,
      Pre    => Index in First_Index (Container) .. Last_Index (Container),



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-02  9:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02  9:08 [Ada] Fix iteration on formal vectors 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).