Patchwork [Ada] default-initialize all components of type Cursor

login
register
mail settings
Submitter Arnaud Charlet
Date Aug. 29, 2011, 2:17 p.m.
Message ID <20110829141758.GA26957@adacore.com>
Download mbox | patch
Permalink /patch/112064/
State New
Headers show

Comments

Arnaud Charlet - Aug. 29, 2011, 2:17 p.m.
If an object of type Cursor does not have an explicit initialization
expression, then it must default-initialize to the same value as constant
No_Element. The Node component of type Cursor has scalar type Count_Type, so it
requires an explicit initialization expression of its own declaration, in order
for objects of record type Cursor to properly initialize.

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

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

	* a-cbhama.ads, a-cbhase.ads (Cursor): Default-initialize all
	components of record type.

Patch

Index: a-cbhama.ads
===================================================================
--- a-cbhama.ads	(revision 178155)
+++ a-cbhama.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.         --
 --                                                                          --
 -- This specification is derived from the Ada Reference Manual for use with --
 -- GNAT. The copyright notice above, and the license provisions that follow --
@@ -320,7 +320,7 @@ 
 
    type Cursor is record
       Container : Map_Access;
-      Node      : Count_Type;
+      Node      : Count_Type := 0;
    end record;
 
    procedure Read
Index: a-cbhase.ads
===================================================================
--- a-cbhase.ads	(revision 178155)
+++ a-cbhase.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.         --
 --                                                                          --
 -- This specification is derived from the Ada Reference Manual for use with --
 -- GNAT. The copyright notice above, and the license provisions that follow --
@@ -431,7 +431,7 @@ 
 
    type Cursor is record
       Container : Set_Access;
-      Node      : Count_Type;
+      Node      : Count_Type := 0;
    end record;
 
    procedure Write