diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-10-11 12:34:53 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-10-11 12:34:53 +0200 |
commit | 0f1a6a0b83ac281cb77b7432154626b4e78b8171 (patch) | |
tree | b9165152a01271a67b69f898053fabda93f4ff3c /gcc/ada/aspects.ads | |
parent | 1237d6ef3c2a5994c7d633b2de2b6db525c92d7b (diff) | |
download | gcc-0f1a6a0b83ac281cb77b7432154626b4e78b8171.tar.gz |
[multiple changes]
2010-10-11 Robert Dewar <dewar@adacore.com>
* aspects.ads, aspects.adb: Major revision of this package for 2nd
stage of aspects implementation.
* gcc-interface/Make-lang.in: Add entry for aspects.o
* gcc-interface/Makefile.in: Add aspects.o to GNATMAKE_OBJS
* par-ch13.adb (Aspect_Specifications_Present): New function
(P_Aspect_Specifications): New procedure
* par-ch3.adb (P_Type_Declaration): Handle aspect specifications
(P_Derived_Type_Def_Or_Private_Ext_Decl): Handle aspect specifications
(P_Identifier_Declarations): Handle aspect specifications
(P_Component_Items): Handle aspect specifications
(P_Subtype_Declaration): Handle aspect specifications
* par-ch6.adb (P_Subprogram): Handle aspect specifications
* par-ch9.adb (P_Entry_Declaration): Handle aspect specifications
* par.adb (Aspect_Specifications_Present): New function
(P_Aspect_Specifications): New procedure
* sem.adb (Analyze_Full_Type_Declaration): New name for
Analyze_Type_Declaration.
(Analyze_Formal_Package_Declaration): New name (add _Declaration)
(Analyze_Formal_Subprogram_Declaration): New name (add _Declaration)
(Analyze_Protected_Type_Declaration): New name (add _Declaration)
(Analyze_Single_Protected_Declaration): New name (add _Declaration)
(Analyze_Single_Task_Declaration): New name (add _Declaration)
(Analyze_Task_Type_Declaration): New name (add _Declaration)
* sem_cat.adb (Analyze_Full_Type_Declaration): New name for
Analyze_Type_Declaration.
* sem_ch11.adb (Analyze_Exception_Declaration): Analyze aspect
specifications.
* sem_ch12.adb (Analyze_Formal_Object_Declaration): Handle aspect
specifications.
(Analyze_Formal_Package_Declaration): New name (add _Declaration)
(Analyze_Formal_Package_Declaration): Handle aspect specifications
(Analyze_Formal_Subprogram_Declaration): New name (add _Declaration)
(Analyze_Formal_Subprogram_Declaration): Handle aspect specifications
(Analyze_Formal_Type_Declaration): Handle aspect specifications
(Analyze_Generic_Package_Declaration): Handle aspect specifications
(Analyze_Generic_Subprogram_Declaration): Handle aspect specifications
(Analyze_Package_Instantiation): Handle aspect specifications
(Analyze_Subprogram_Instantiation): Handle aspect specifications
* sem_ch12.ads (Analyze_Formal_Package_Declaration): New name (add
_Declaration).
(Analyze_Formal_Subprogram_Declaration): New name (add _Declaration)
* sem_ch13.adb (Analyze_Aspect_Specifications): New procedure
(Duplicate_Clause): New function, calls to this function are added to
processing for all aspects.
* sem_ch13.ads (Analyze_Aspect_Specifications): New procedure
* sem_ch3.adb (Analyze_Full_Type_Declaration): New name for
Analyze_Type_Declaration.
* sem_ch3.ads (Analyze_Full_Type_Declaration): New name for
Analyze_Type_Declaration.
* sem_ch6.adb (Analyze_Abstract_Subprogram_Declaration): Analyze aspect
specifications.
(Analyze_Subprogram_Declaration): Analyze aspect specifications
* sem_ch7.adb (Analyze_Package_Declaration): Analyze aspect
specifications.
(Analyze_Private_Type_Declaration): Analyze aspect specifications
* sem_ch9.adb (Analyze_Protected_Type_Declaration): Analyze aspect
specifications.
(Analyze_Protected_Type_Declaration): New name (add _Declaration)
(Analyze_Single_Protected_Declaration): Analyze aspect specifications
(Analyze_Single_Protected_Declaration): New name (add _Declaration)
(Analyze_Single_Task_Declaration): Analyze aspect specifications
(Analyze_Single_Task_Declaration): New name (add _Declaration)
(Analyze_Task_Type_Declaration): Analyze aspect specifications
(Analyze_Task_Type_Declaration): New name (add _Declaration)
* sem_ch9.ads (Analyze_Protected_Type_Declaration): New name (add
_Declaration).
(Analyze_Single_Protected_Declaration): New name (add _Declaration)
(Analyze_Single_Task_Declaration): New name (add _Declaration)
(Analyze_Task_Type_Declaration): New name (add _Declaration)
* sem_prag.adb: Use Get_Pragma_Arg systematically so that we do not
have to generate unnecessary pragma argument associations (this matches
the doc).
Throughout do changes to accomodate aspect specifications, including
specializing messages, handling the case of not going through all
homonyms, and allowing for cancellation.
* sinfo.ads, sinfo.adb: Clean up obsolete documentation for Flag1,2,3
(Aspect_Cancel): New flag
(From_Aspect_Specification): New flag
(First_Aspect): Removed flag
(Last_Aspect): Removed flag
* sprint.adb (Sprint_Aspect_Specifications): New procedure
(Sprint_Node_Actual): Add calls to Sprint_Aspect_Specifications
2010-10-11 Bob Duff <duff@adacore.com>
* sem_res.adb (Resolve_Actuals): Minor change to warning messages so
they match in Ada 95, 2005, and 2012 modes, in the case where the
language didn't change. Same thing for the run-time exception message.
2010-10-11 Javier Miranda <miranda@adacore.com>
* debug.adb Document that switch -gnatd.p enables the CIL verifier.
2010-10-11 Robert Dewar <dewar@adacore.com>
* s-htable.adb: Minor reformatting.
From-SVN: r165299
Diffstat (limited to 'gcc/ada/aspects.ads')
-rwxr-xr-x | gcc/ada/aspects.ads | 75 |
1 files changed, 54 insertions, 21 deletions
diff --git a/gcc/ada/aspects.ads b/gcc/ada/aspects.ads index ac9e231de57..b8ee3888a20 100755 --- a/gcc/ada/aspects.ads +++ b/gcc/ada/aspects.ads @@ -29,25 +29,27 @@ -- -- ------------------------------------------------------------------------------ --- This package defines the aspects that are recognized in aspect --- specifications. We separate this off in its own packages to that --- it can be accessed by the parser without dragging in Sem_Asp +-- This package defines the aspects that are recognized by GNAT in aspect +-- specifications. It also contains the subprograms for storing/retrieving +-- aspect speciciations from the tree. The semantic processing for aspect +-- specifications is found in Sem_Ch13.Analyze_Aspect_Specifications. with Namet; use Namet; +with Types; use Types; package Aspects is + -- Type defining recognized aspects + type Aspect_Id is (No_Aspect, -- Dummy entry for no aspect Aspect_Ada_2005, -- GNAT Aspect_Ada_2012, -- GNAT Aspect_Address, - Aspect_Aliased, Aspect_Alignment, Aspect_Atomic, Aspect_Atomic_Components, Aspect_Bit_Order, - Aspect_C_Pass_By_Copy, Aspect_Component_Size, Aspect_Discard_Names, Aspect_External_Tag, @@ -56,16 +58,14 @@ package Aspects is Aspect_Inline_Always, -- GNAT Aspect_Invariant, Aspect_Machine_Radix, + Aspect_No_Return, Aspect_Object_Size, -- GNAT Aspect_Pack, Aspect_Persistent_BSS, -- GNAT Aspect_Post, - Aspect_Postcondition, -- GNAT (equivalent to Post) Aspect_Pre, - Aspect_Precondition, -- GNAT (equivalent to Pre) Aspect_Predicate, -- GNAT??? Aspect_Preelaborable_Initialization, - Aspect_Psect_Object, -- GNAT Aspect_Pure_Function, -- GNAT Aspect_Shared, -- GNAT (equivalent to Atomic) Aspect_Size, @@ -83,17 +83,15 @@ package Aspects is Aspect_Value_Size, -- GNAT Aspect_Volatile, Aspect_Volatile_Components, - Aspect_Warnings, -- GNAT - Aspect_Weak_External); -- GNAT + Aspect_Warnings); -- GNAT -- The following array indicates aspects that accept 'Class Class_Aspect_OK : constant array (Aspect_Id) of Boolean := (Aspect_Invariant => True, Aspect_Pre => True, - Aspect_Precondition => True, + Aspect_Predicate => True, Aspect_Post => True, - Aspect_Postcondition => True, others => False); -- The following type is used for indicating allowed expression forms @@ -110,12 +108,10 @@ package Aspects is Aspect_Ada_2005 => Optional, Aspect_Ada_2012 => Optional, Aspect_Address => Expression, - Aspect_Aliased => Optional, Aspect_Alignment => Expression, Aspect_Atomic => Optional, Aspect_Atomic_Components => Optional, Aspect_Bit_Order => Expression, - Aspect_C_Pass_By_Copy => Optional, Aspect_Component_Size => Expression, Aspect_Discard_Names => Optional, Aspect_External_Tag => Expression, @@ -124,20 +120,18 @@ package Aspects is Aspect_Inline_Always => Optional, Aspect_Invariant => Expression, Aspect_Machine_Radix => Expression, + Aspect_No_Return => Optional, Aspect_Object_Size => Expression, - Aspect_Pack => Optional, Aspect_Persistent_BSS => Optional, + Aspect_Pack => Optional, Aspect_Post => Expression, - Aspect_Postcondition => Expression, Aspect_Pre => Expression, - Aspect_Precondition => Expression, Aspect_Predicate => Expression, Aspect_Preelaborable_Initialization => Optional, - Aspect_Psect_Object => Optional, Aspect_Pure_Function => Optional, Aspect_Shared => Optional, Aspect_Size => Expression, - Aspect_Storage_Pool => Expression, + Aspect_Storage_Pool => Name, Aspect_Storage_Size => Expression, Aspect_Stream_Size => Expression, Aspect_Suppress => Name, @@ -151,11 +145,50 @@ package Aspects is Aspect_Value_Size => Expression, Aspect_Volatile => Optional, Aspect_Volatile_Components => Optional, - Aspect_Warnings => Name, - Aspect_Weak_External => Optional); + Aspect_Warnings => Name); function Get_Aspect_Id (Name : Name_Id) return Aspect_Id; + pragma Inline (Get_Aspect_Id); -- Given a name Nam, returns the corresponding aspect id value. If the name -- does not match any aspect, then No_Aspect is returned as the result. + --------------------------------------------------- + -- Handling of Aspect Specifications in the Tree -- + --------------------------------------------------- + + -- Several kinds of declaration node permit aspect specifications in Ada + -- 2012 mode. If there was room in all the corresponding declaration nodes, + -- we could just have a field Aspect_Specifications pointing to a list of + -- nodes for the aspects (N_Aspect_Specification nodes). But there isn't + -- room, so we adopt a different approach. + + -- The following subprograms provide access to a specialized interface + -- implemented internally with a hash table in the body, that provides + -- access to aspect specifications. + + function Permits_Aspect_Specifications (N : Node_Id) return Boolean; + -- Returns True if the node N is a declaration node that permits aspect + -- specifications. All such nodes have the Has_Aspect_Specifications + -- flag defined. Returns False for all other nodes. + + function Aspect_Specifications (N : Node_Id) return List_Id; + -- Given a node N, returns the list of N_Aspect_Specification nodes that + -- are attached to this declaration node. If the node is in the class of + -- declaration nodes that permit aspect specifications, as defined by the + -- predicate above, and if their Has_Aspect_Specifications flag is set to + -- True, then this will always be a non-empty list. If this flag is set to + -- False, or the node is not in the declaration class permitting aspect + -- specifications, then No_List is returned. + + procedure Set_Aspect_Specifications (N : Node_Id; L : List_Id); + -- The node N must be in the class of declaration nodes that permit aspect + -- specifications and the Has_Aspect_Specifications flag must be False on + -- entry. L must be a non-empty list of N_Aspect_Specification nodes. This + -- procedure sets the Has_Aspect_Specifications flag to True, and makes an + -- entry that can be retrieved by a subsequent Aspect_Specifications call. + -- The parent of list L is set to reference the declaration node N. It is + -- an error to call this procedure with a node that does not permit aspect + -- specifications, or a node that has its Has_Aspect_Specifications flag + -- set True on entry, or with L being an empty list or No_List. + end Aspects; |