public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-587] [Ada] Minor efficiency improvement in containers
@ 2021-05-07  9:38 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-05-07  9:38 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0e1e07728074a7162c8173abd10bc32e814ea254

commit r12-587-g0e1e07728074a7162c8173abd10bc32e814ea254
Author: Bob Duff <duff@adacore.com>
Date:   Mon Jan 25 10:18:08 2021 -0500

    [Ada] Minor efficiency improvement in containers
    
    gcc/ada/
    
            * libgnat/a-conhel.adb (TC_Check): Move the Assert into the
            'if'.

Diff:
---
 gcc/ada/libgnat/a-conhel.adb | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/gcc/ada/libgnat/a-conhel.adb b/gcc/ada/libgnat/a-conhel.adb
index 60928451adb..e7d82ac1636 100644
--- a/gcc/ada/libgnat/a-conhel.adb
+++ b/gcc/ada/libgnat/a-conhel.adb
@@ -122,17 +122,20 @@ package body Ada.Containers.Helpers is
 
       procedure TC_Check (T_Counts : Tamper_Counts) is
       begin
-         if T_Check and then T_Counts.Busy > 0 then
-            raise Program_Error with
-              "attempt to tamper with cursors";
+         if T_Check then
+            if T_Counts.Busy > 0 then
+               raise Program_Error with
+                 "attempt to tamper with cursors";
+            end if;
+
+            --  The lock status (which monitors "element tampering") always
+            --  implies that the busy status (which monitors "cursor
+            --  tampering") is set too; this is a representation invariant.
+            --  Thus if the busy count is zero, then the lock count
+            --  must also be zero.
+
+            pragma Assert (T_Counts.Lock = 0);
          end if;
-
-         --  The lock status (which monitors "element tampering") always
-         --  implies that the busy status (which monitors "cursor tampering")
-         --  is set too; this is a representation invariant. Thus if the busy
-         --  bit is not set, then the lock bit must not be set either.
-
-         pragma Assert (T_Counts.Lock = 0);
       end TC_Check;
 
       --------------


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

only message in thread, other threads:[~2021-05-07  9:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07  9:38 [gcc r12-587] [Ada] Minor efficiency improvement in containers 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).