Commit 468c6c8a by Ed Schonberg Committed by Arnaud Charlet

sem_attr.ads, [...] (Analyze_Access_Attribute): Diagnose properly an attempt to…

sem_attr.ads, [...] (Analyze_Access_Attribute): Diagnose properly an attempt to apply Unchecked_Access to a protected operation.

2006-10-31  Ed Schonberg  <schonberg@adacore.com>
	    Thomas Quinot  <quinot@adacore.com>
	    Javier Miranda  <miranda@adacore.com>
	    Gary Dismukes  <dismukes@adacore.com>

	* sem_attr.ads, sem_attr.adb (Analyze_Access_Attribute): Diagnose
	properly an attempt to apply Unchecked_Access to a protected operation.
	(OK_Self_Reference): New subprogram to check the legality of an access
	attribute whose prefix is the type of an enclosing aggregate.
	Generalizes previous mechanism to handle attribute references nested
	arbitrarily deep within the aggregate.
	(Analyze_Access_Attribute): An access attribute whose prefix is a type
	can appear in an aggregate if this is a default-initialized aggregate
	for a self-referential type.
	(Resolve_Attribute, case Access): Ditto.
	Add support for new implementation defined attribute Stub_Type.
	(Eval_Attribute, case Attribute_Stub_Type): New case.
	(Analyze_Attribute, case Attribute_Stub_Type): New case.
	(Stream_Attribute_Available): Implement using new subprogram from
	sem_cat, Has_Stream_Attribute_Definition, instead of incorrect
	Has_Specified_Stream_Attribute flag.
	Disallow Storage_Size and Storage_Pool for access to subprogram
	(Resolve_Attribute, case 'Access et al): Take into account anonymous
	access types of return subtypes in extended return statements. Remove
	accessibility checks on anonymous access types when Unchecked_Access is
	used.
	(Analyze_Attribute): Add support for the use of 'Class to convert
	a class-wide interface to a tagged type.
	Add support for the attribute Priority.
	(Resolve_Attribute, case Attribute_Access): For Ada_05, add test for
	whether the designated type is discriminated with a constrained partial
	view and require static matching in that case.
	Add local variable Des_Btyp. The Designated_Type
	of an access to incomplete subtype is either its non-limited view if
	coming from a limited with or its etype if regular incomplete subtype.

	* sem_cat.ads, sem_cat.adb (Validate_Remote_Access_To_Class_Wide_Type):
	Fix predicate to identify and allow cases of (expander-generated)
	references to tag of designated object of a RACW.
	(Validate_Static_Object_Name): In Ada 2005, a formal object is
	non-static, and therefore cannot appear as a primary in a preelaborable
	package.
	(Has_Stream_Attribute_Definition): New subprogram, abstracted from
	Has_Read_Write_Attributes.
	(Has_Read_Write_Attributes): Reimplement in termes of
	Has_Stream_Attribute_Definition.
	(Missing_Read_Write_Attributes): When checking component types in a
	record, unconditionally call Missing_Read_Write_Attributes recursively
	(remove guard checking for Is_Record_Type / Is_Access_Type).

From-SVN: r118298
parent daca8389
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- 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- --
......@@ -78,18 +78,18 @@ package Sem_Attr is
---------------
Attribute_Asm_Input => True,
-- Used only in conjunction with the Asm and Asm_Volatile subprograms
-- in package Machine_Code to construct machine instructions. See
-- documentation in package Machine_Code in file s-maccod.ads.
-- Used only in conjunction with the Asm subprograms in package
-- Machine_Code to construct machine instructions. See documentation
-- in package Machine_Code in file s-maccod.ads.
----------------
-- Asm_Output --
----------------
Attribute_Asm_Output => True,
-- Used only in conjunction with the Asm and Asm_Volatile subprograms
-- in package Machine_Code to construct machine instructions. See
-- documentation in package Machine_Code in file s-maccod.ads.
-- Used only in conjunction with the Asm subprograms in package
-- Machine_Code to construct machine instructions. See documentation
-- in package Machine_Code in file s-maccod.ads.
---------------
-- AST_Entry --
......@@ -382,6 +382,27 @@ package Sem_Attr is
-- for constructing this definition in package System (see note above
-- in Default_Bit_Order description). The is a static attribute.
---------------
-- Stub_Type --
---------------
Attribute_Stub_Type => True,
-- The GNAT implementation of remote access-to-classwide types is
-- organised as described in AARM E.4(20.t): a value of an RACW type
-- (designating a remote object) is represented as a normal access
-- value, pointing to a "stub" object which in turn contains the
-- necessary information to contact the designated remote object. A
-- call on any dispatching operation of such a stub object does the
-- remote call, if necessary, using the information in the stub object
-- to locate the target partition, etc.
--
-- For a prefix T that denotes a remote access-to-classwide type,
-- T'Stub_Type denotes the type of the corresponding stub objects.
--
-- By construction, the layout of T'Stub_Type is identical to that of
-- System.Partition_Interface.RACW_Stub_Type (see implementation notes
-- in body of Exp_Dist).
-----------------
-- Target_Name --
-----------------
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- 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- --
......@@ -36,10 +36,21 @@
-- Note that we treat Preelaborate as a categorization pragma, even though
-- strictly, according to RM E.2(2,3), the term does not apply in this case.
with Types; use Types;
with Exp_Tss; use Exp_Tss;
with Types; use Types;
package Sem_Cat is
function Has_Stream_Attribute_Definition
(Typ : Entity_Id; Nam : TSS_Name_Type) return Boolean;
-- True when there is a attribute definition clause specifying attribute
-- Nam for Typ. In Ada 2005 mode, returns True only when the attribute
-- definition clause is visible. Note that attribute definition clauses
-- inherited from parent types are taken into account by this predicate
-- (to test for presence of an attribute definition clause for one
-- specific type, excluding inherited definitions, the flags
-- Has_Specicied_Stream_* can be used instead).
function In_Preelaborated_Unit return Boolean;
-- Determines if the current scope is within a preelaborated compilation
-- unit, that is one to which one of the pragmas Preelaborate, Pure,
......@@ -137,4 +148,10 @@ package Sem_Cat is
-- are not included because the generic declaration and body are
-- preelaborable.
procedure Validate_RACW_Primitives (T : Entity_Id);
-- Enforce constraints on primitive operations of the designated type of
-- an RACW. Note that since the complete set of primitive operations of the
-- designated type needs to be known, we must defer these checks until the
-- desgianted type is frozen.
end Sem_Cat;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment