public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <derodat@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Claire Dross <dross@adacore.com>
Subject: [Ada] Fix style issues in functional maps
Date: Wed, 18 Sep 2019 08:40:00 -0000	[thread overview]
Message-ID: <20190918083944.GA145003@adacore.com> (raw)

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

Rename global constants from I to J. No functional changes.

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

2019-09-18  Claire Dross  <dross@adacore.com>

gcc/ada/

	* libgnat/a-cofuma.adb (Remove, Elements_Equal_Except,
	Keys_Included, Keys_Included_Except): Rename loop indexes and
	global constants from I to J.

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

--- gcc/ada/libgnat/a-cofuma.adb
+++ gcc/ada/libgnat/a-cofuma.adb
@@ -88,15 +88,15 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is
       New_Key : Key_Type) return Boolean
    is
    begin
-      for I in 1 .. Length (Left.Keys) loop
+      for J in 1 .. Length (Left.Keys) loop
          declare
-            K : constant Key_Type := Get (Left.Keys, I);
+            K : constant Key_Type := Get (Left.Keys, J);
          begin
             if not Equivalent_Keys (K, New_Key)
               and then
                 (Find (Right.Keys, K) = 0
                   or else Get (Right.Elements, Find (Right.Keys, K)) /=
-                          Get (Left.Elements, I))
+                          Get (Left.Elements, J))
             then
                return False;
             end if;
@@ -112,16 +112,16 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is
       Y     : Key_Type) return Boolean
    is
    begin
-      for I in 1 .. Length (Left.Keys) loop
+      for J in 1 .. Length (Left.Keys) loop
          declare
-            K : constant Key_Type := Get (Left.Keys, I);
+            K : constant Key_Type := Get (Left.Keys, J);
          begin
             if not Equivalent_Keys (K, X)
               and then not Equivalent_Keys (K, Y)
               and then
                 (Find (Right.Keys, K) = 0
                   or else Get (Right.Elements, Find (Right.Keys, K)) /=
-                          Get (Left.Elements, I))
+                          Get (Left.Elements, J))
             then
                return False;
             end if;
@@ -173,9 +173,9 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is
 
    function Keys_Included (Left : Map; Right : Map) return Boolean is
    begin
-      for I in 1 .. Length (Left.Keys) loop
+      for J in 1 .. Length (Left.Keys) loop
          declare
-            K : constant Key_Type := Get (Left.Keys, I);
+            K : constant Key_Type := Get (Left.Keys, J);
          begin
             if Find (Right.Keys, K) = 0 then
                return False;
@@ -196,9 +196,9 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is
       New_Key : Key_Type) return Boolean
    is
    begin
-      for I in 1 .. Length (Left.Keys) loop
+      for J in 1 .. Length (Left.Keys) loop
          declare
-            K : constant Key_Type := Get (Left.Keys, I);
+            K : constant Key_Type := Get (Left.Keys, J);
          begin
             if not Equivalent_Keys (K, New_Key)
               and then Find (Right.Keys, K) = 0
@@ -218,9 +218,9 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is
       Y     : Key_Type) return Boolean
    is
    begin
-      for I in 1 .. Length (Left.Keys) loop
+      for J in 1 .. Length (Left.Keys) loop
          declare
-            K : constant Key_Type := Get (Left.Keys, I);
+            K : constant Key_Type := Get (Left.Keys, J);
          begin
             if not Equivalent_Keys (K, X)
               and then not Equivalent_Keys (K, Y)
@@ -248,11 +248,11 @@ package body Ada.Containers.Functional_Maps with SPARK_Mode => Off is
    ------------
 
    function Remove (Container : Map; Key : Key_Type) return Map is
-      I : constant Extended_Index := Find (Container.Keys, Key);
+      J : constant Extended_Index := Find (Container.Keys, Key);
    begin
       return
-        (Keys     => Remove (Container.Keys, I),
-         Elements => Remove (Container.Elements, I));
+        (Keys     => Remove (Container.Keys, J),
+         Elements => Remove (Container.Elements, J));
    end Remove;
 
    ---------------


                 reply	other threads:[~2019-09-18  8:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190918083944.GA145003@adacore.com \
    --to=derodat@adacore.com \
    --cc=dross@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).