This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] AI-318 and 419


Tested on i686-linux, committed on HEAD

This is a set of changes for one part of the implementation of Ada 2005
AI-318-02 (limited and anonymous access return types), namely the part
that allows a function result type to be an anonymous access type. This
includes accessibility checks ensuring that the accessibility level of
an access value returned by such a function is not deeper than the level
of the function's declaration. A limitation of the current implementation
is that anonymous access-to-subprogram types are not yet handled as
function result types (only anonymous access-to-object types are supported
at this point).

Thse changes also implement the Ada 2005 AI-419 feature
which allows the keyword limited for derived types.

The following package compiles quietly with switch -gnat05

package Q is
   type Rx is record
      X : Integer;
   end record;
   type Rx1 is limited new Rx;
end;

2005-09-01  Gary Dismukes  <dismukes@adacore.com>
	    Robert Dewar  <dewar@adacore.com>
	    Hristian Kirtchev  <kirtchev@adacore.com>

	* layout.adb (SO_Ref_From_Expr): Change Subtype_Mark to
	Result_Definition.

	* par-ch6.adb (P_Subprogram): Handle parsing of Access_Definitions in
	function specs.
	Call Set_Result_Definition instead of Set_Subtype_Mark.
	(P_Subprogram_Specification): Add parsing of anonymous access result
	plus null exclusions. Call Set_Result_Definition instead of
	Set_Subtype_Mark.

	* par-ch3.adb: Add support for LIMITED NEW for Ada 2005 AI-419
	(P_Access_Type_Definition): Add parsing for an anonymous access result
	subtype, plus parsing for null exclusions. Call Set_Result_Definition
	instead of Set_Subtype_Mark.

	* sinfo.adb: Add support for LIMITED NEW for Ada 2005 AI-419
	(Null_Exclusion_Present): Allow this flag for N_Function_Specification.
	(Result_Definition): New function for N_Function_Specifications.
	(Subtype_Mark): No longer allowed for N_Access_Function_Definition and
	N_Function_Specification.
	(Set_Null_Exclusion_Present): Allow this flag for
	N_Function_Specification.
	(Set_Result_Definition): New procedure for N_Function_Specifications.
	(Set_Subtype_Mark): No longer allowed for N_Access_Function_Definition
	and N_Function_Specification.

	* sinfo.ads: Update grammar rules for 9.7.2: Entry_Call_Alternative,
	Procedure_Or_Entry_Call; 9.7.4: Triggering_Statement.
	Add support for LIMITED NEW for Ada 2005 AI-419
	Update the syntax of PARAMETER_AND_RESULT_PROFILE to reflect the new
	syntax for anonymous access results.
	Replace Subtype_Mark field by Result_Definition in
	N_Function_Specification and N_Access_Definition specs.
	Add Null_Exclusion_Present to spec of N_Function_Specification.
	(Result_Definition): New function for N_Function_Specification and
	N_Access_Function_Definition.
	(Set_Result_Definition): New procedure for N_Function_Specification and
	N_Access_Function_Definition.

	* sprint.adb (S_Print_Node_Actual): Change Subtype_Mark calls to
	Result_Definition for cases of N_Access_Function_Definition and
	N_Function_Specification.
	Print "not null" if Null_Exclusion_Present on N_Function_Specification.

Attachment: difs.23
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]