diff mbox

[Ada] Default-initialize Nodes component

Message ID 20110804135950.GA18330@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Aug. 4, 2011, 1:59 p.m. UTC
When manipulating bounded hash-table based container objects,
that do not otherwise have any explicit initialization expression,
the compiler would emit a warning about the object not being
initialized, because the Nodes component of the hash table
type had not been given an initialization expression.

This warning is a false positive, because the logical state of the
object is empty, and other components of the hash table record type
are initialized, in a manner that establishes the representation
invariant of the object.

In order to eliminate the warning, the Nodes component of the hash
table type was given an initialization expression.

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

2011-08-04  Matthew Heaney  <heaney@adacore.com>

	* a-cohata.ads (Hash_Table_Type): default-initialize the Nodes
	component.
diff mbox

Patch

Index: a-cohata.ads
===================================================================
--- a-cohata.ads	(revision 177274)
+++ a-cohata.ads	(working copy)
@@ -6,7 +6,7 @@ 
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 2004-2010, Free Software Foundation, Inc.         --
+--          Copyright (C) 2004-2011, 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- --
@@ -66,7 +66,7 @@ 
          Busy    : Natural := 0;
          Lock    : Natural := 0;
          Free    : Count_Type'Base := -1;
-         Nodes   : Nodes_Type (1 .. Capacity);
+         Nodes   : Nodes_Type (1 .. Capacity) := (others => <>);
          Buckets : Buckets_Type (1 .. Modulus) := (others => 0);
       end record;
    end Generic_Bounded_Hash_Table_Types;