[Ada] Fix handling of streams in Ada 05

Arnaud Charlet charlet@adacore.com
Wed Feb 15 10:15:00 GMT 2006


Tested on i686-linux, committed on trunk

In Ada 2005, streams are null-excluding. When creating the stream
subprograms for remote types, we first create the bodies, and then
create specs by copying the signatures generated for the body. The
copying process must now propagate the null_exclusion flag for the
access parameter of these operations, to prevent conformance errors.
The following must compile quietly in Ada_05 mode:
--
package Params is
  pragma Remote_Types;
  subtype Inp1_Type is Positive;       -- input parameter types
  subtype Out1_Type is String(1..256); -- output parameter types
  type Ricochet_Type is abstract tagged limited private;
  type Ref_Ricochet  is access all Ricochet_Type'Class;
private
  type Ricochet_Type is abstract tagged limited null record;
end Params;

2006-02-13  Ed Schonberg  <schonberg@adacore.com>

	* exp_dist.adb (Copy_Specification): For access parameters, copy
	Null_Exclusion flag, which will have been set for stream subprograms
	in Ada2005 mode.

-------------- next part --------------
Index: exp_dist.adb
===================================================================
--- exp_dist.adb	(revision 110833)
+++ exp_dist.adb	(working copy)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2005, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2006, 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- --
@@ -1880,7 +1880,7 @@
       For_RAS         : Boolean := False;
 
    begin
-      if not Present (Parameter_Specifications (Spec)) then
+      if No (Parameter_Specifications (Spec)) then
          return New_List;
       end if;
 
@@ -2255,12 +2255,17 @@
                     Root_Type (Current_Etype) = Root_Type (Object_Type));
                   Current_Type :=
                     Make_Access_Definition (Loc,
-                      Subtype_Mark => New_Occurrence_Of (Stub_Type, Loc));
+                      Subtype_Mark => New_Occurrence_Of (Stub_Type, Loc),
+                      Null_Exclusion_Present =>
+                        Null_Exclusion_Present (Current_Type));
+
                else
                   Current_Type :=
                     Make_Access_Definition (Loc,
                       Subtype_Mark =>
-                        New_Occurrence_Of (Current_Etype, Loc));
+                        New_Occurrence_Of (Current_Etype, Loc),
+                      Null_Exclusion_Present =>
+                         Null_Exclusion_Present (Current_Type));
                end if;
 
             else


More information about the Gcc-patches mailing list