diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-11-30 15:56:40 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-11-30 15:56:40 +0000 |
commit | f648ee3f0265eb917e18fca4383aff5c08207c72 (patch) | |
tree | dd4ffa73b828e7398f1819c24855a992282f0bfa /gcc/ada/a-crbtgo.adb | |
parent | 12c8864cbbc7b650812120f4eb5702a0d78e2b50 (diff) | |
download | gcc-f648ee3f0265eb917e18fca4383aff5c08207c72.tar.gz |
2009-11-30 Thomas Quinot <quinot@adacore.com>
* g-sechas.adb: Minor reformatting
2009-11-30 Matthew Heaney <heaney@adacore.com>
* a-crbtgo.adb (Delete_Fixup): Add comments explaining why predicates
were removed.
* a-cdlili.adb (Vet): Remove always-true predicates.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154823 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-crbtgo.adb')
-rw-r--r-- | gcc/ada/a-crbtgo.adb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/ada/a-crbtgo.adb b/gcc/ada/a-crbtgo.adb index cd14b90491d..c8ddcff02a5 100644 --- a/gcc/ada/a-crbtgo.adb +++ b/gcc/ada/a-crbtgo.adb @@ -49,6 +49,8 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is procedure Left_Rotate (Tree : in out Tree_Type; X : Node_Access); procedure Right_Rotate (Tree : in out Tree_Type; Y : Node_Access); +-- Why is all the following code commented out ??? + -- --------------------- -- -- Check_Invariant -- -- --------------------- @@ -171,8 +173,15 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is if Right (W) = null or else Color (Right (W)) = Black then + -- As a condition for setting the color of the left child to + -- black, the left child access value must be non-null. A + -- truth table analysis shows that if we arrive here, that + -- condition holds, so there's no need for an explicit test. + -- The assertion is here to document what we know is true. + pragma Assert (Left (W) /= null); Set_Color (Left (W), Black); + Set_Color (W, Red); Right_Rotate (Tree, W); W := Right (Parent (X)); @@ -206,8 +215,16 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is else if Left (W) = null or else Color (Left (W)) = Black then + + -- As a condition for setting the color of the right child + -- to black, the right child access value must be non-null. + -- A truth table analysis shows that if we arrive here, that + -- condition holds, so there's no need for an explicit test. + -- The assertion is here to document what we know is true. + pragma Assert (Right (W) /= null); Set_Color (Right (W), Black); + Set_Color (W, Red); Left_Rotate (Tree, W); W := Left (Parent (X)); @@ -246,6 +263,8 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is "attempt to tamper with cursors (container is busy)"; end if; + -- Why are these all commented out ??? + -- pragma Assert (Tree.Length > 0); -- pragma Assert (Tree.Root /= null); -- pragma Assert (Tree.First /= null); |