aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Dismukes <dismukes@adacore.com>2007-08-14 10:50:18 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2007-08-14 10:50:18 +0200
commit6027ad8b260a9d274fb366a3fa45dcad67241f59 (patch)
treeeda8d606169fdc4bcc633e594aeab1852c61f241
parent20dedfc175c0b382713e74e5f349e5aacd131f9b (diff)
downloadgcc-6027ad8b260a9d274fb366a3fa45dcad67241f59.zip
gcc-6027ad8b260a9d274fb366a3fa45dcad67241f59.tar.gz
gcc-6027ad8b260a9d274fb366a3fa45dcad67241f59.tar.bz2
s-veboop.adb (SU): New named number initialized to System.Storage_Unit.
2007-08-14 Gary Dismukes <dismukes@adacore.com> * s-veboop.adb (SU): New named number initialized to System.Storage_Unit. (True_Val): The initialization expression is revised to use SU (= Storage_Unit) rather than assuming 8 for the component size of an unpacked Boolean array. From-SVN: r127465
-rw-r--r--gcc/ada/s-veboop.adb30
1 files changed, 18 insertions, 12 deletions
diff --git a/gcc/ada/s-veboop.adb b/gcc/ada/s-veboop.adb
index 177a944..27f68a2 100644
--- a/gcc/ada/s-veboop.adb
+++ b/gcc/ada/s-veboop.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2007, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -33,24 +33,30 @@
package body System.Vectors.Boolean_Operations is
+ SU : constant := Storage_Unit;
+ -- Convenient short hand, used throughout
+
+ -- The coding of this unit depends on the fact that the Component_Size
+ -- of a normally declared array of Boolean is equal to Storage_Unit. We
+ -- can't use the Component_Size directly since it is non-static. The
+ -- following declaration checks that this declaration is correct
+
type Boolean_Array is array (Integer range <>) of Boolean;
- pragma Assert (Boolean_Array'Component_Size = 8);
- -- Unfortunately Boolean_Array'Component_Size is not a compile-time-known
- -- value, so assume it is 8 in order to be able to determine True_Val at
- -- compile time.
+ pragma Compile_Time_Error
+ (Boolean_Array'Component_Size /= SU, "run time compile failure");
-- NOTE: The boolean literals must be qualified here to avoid visibility
-- anomalies when this package is compiled through Rtsfind, in a context
-- that includes a user-defined type derived from boolean.
True_Val : constant Vector := Standard.True'Enum_Rep
- + Standard.True'Enum_Rep * 2**8
- + Standard.True'Enum_Rep * 2**(8 * 2)
- + Standard.True'Enum_Rep * 2**(8 * 3)
- + Standard.True'Enum_Rep * 2**(8 * 4)
- + Standard.True'Enum_Rep * 2**(8 * 5)
- + Standard.True'Enum_Rep * 2**(8 * 6)
- + Standard.True'Enum_Rep * 2**(8 * 7);
+ + Standard.True'Enum_Rep * 2**SU
+ + Standard.True'Enum_Rep * 2**(SU * 2)
+ + Standard.True'Enum_Rep * 2**(SU * 3)
+ + Standard.True'Enum_Rep * 2**(SU * 4)
+ + Standard.True'Enum_Rep * 2**(SU * 5)
+ + Standard.True'Enum_Rep * 2**(SU * 6)
+ + Standard.True'Enum_Rep * 2**(SU * 7);
-- This constant represents the bits to be flipped to perform a logical
-- "not" on a vector of booleans, independent of the actual
-- representation of True.