aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/libgnat/a-cbsyqu.ads
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2020-12-02 16:04:48 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2020-12-17 05:49:20 -0500
commit11ad366da5edd79b64095d809c0e9debe80edfb2 (patch)
tree1d063573699984c20e8af1b8fb36772a9bdf4286 /gcc/ada/libgnat/a-cbsyqu.ads
parent7fbcb0c72e48e0009cfbda5391d6e3387cf3afff (diff)
downloadgcc-11ad366da5edd79b64095d809c0e9debe80edfb2.zip
gcc-11ad366da5edd79b64095d809c0e9debe80edfb2.tar.gz
gcc-11ad366da5edd79b64095d809c0e9debe80edfb2.tar.bz2
[Ada] Spurious discriminant check on bounded synchronized queue
gcc/ada/ * libgnat/a-cbsyqu.ads (Implementation): Provide a box initialization for the element array used internally to represent the queue, so that its components are properly initialized if the given element type has default initialization. Suppress warnings on the rest of the package in case the element type has no default or discriminant, because it is bound to be confusing to the user.
Diffstat (limited to 'gcc/ada/libgnat/a-cbsyqu.ads')
-rw-r--r--gcc/ada/libgnat/a-cbsyqu.ads10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ada/libgnat/a-cbsyqu.ads b/gcc/ada/libgnat/a-cbsyqu.ads
index 225db21..4037d84 100644
--- a/gcc/ada/libgnat/a-cbsyqu.ads
+++ b/gcc/ada/libgnat/a-cbsyqu.ads
@@ -71,6 +71,14 @@ is
-- Need proper heap data structure here ???
+ -- We suppress warnings here, which might otherwise be triggered
+ -- by the box initialization of the Elements array below. This
+ -- initialization is needed to preserve constraints, such as
+ -- discriminant values, that the actual for Element_Type might
+ -- carry.
+
+ pragma Warnings (Off);
+
type Element_Array is
array (Count_Type range <>) of Queue_Interfaces.Element_Type;
@@ -78,7 +86,7 @@ is
First, Last : Count_Type := 0;
Length : Count_Type := 0;
Max_Length : Count_Type := 0;
- Elements : Element_Array (1 .. Capacity);
+ Elements : Element_Array (1 .. Capacity) := (others => <>);
end record;
end Implementation;