summaryrefslogtreecommitdiff
path: root/gcc/ada/aspects.ads
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-10 12:10:58 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-10 12:10:58 +0000
commit7179006e1b271d9e4c3ec8b3d2420082606a77de (patch)
tree33b0b66fb30d3aa482ca82a0cb0342e91e27b07b /gcc/ada/aspects.ads
parent30d42e5ac33a5e6df6bcc9ef7fd5ee4a4f691448 (diff)
downloadgcc-7179006e1b271d9e4c3ec8b3d2420082606a77de.tar.gz
2013-10-10 Ed Schonberg <schonberg@adacore.com>
* par-ch13.adb (Aspect_Specifications_Present)): In earlier than Ada2012 mode, assume that a legal aspect name following "with" keyword is an older gnat switch and not a misplaced with_clause. 2013-10-10 Hristian Kirtchev <kirtchev@adacore.com> * aspects.adb: Add an entry for Aspect_Refined_Pre in table Canonical_Aspect. (Aspects_On_Body_OK): Renamed to Aspects_On_Body_Or_Stub_OK. (Aspects_On_Body_Or_Stub_OK): Update the query in table Aspect_On_Body_OK. * aspects.ads: Add an entry for Aspect_Refined_Pre in tables Aspect_Id, Aspect_Argument, Aspect_Names, Aspect_Delay, Aspect_On_Body_Or_Stub_OK. Table Aspect_On_Body_OK is now known as Aspect_On_Body_Or_Stub_OK. Add a section of aspect specifications that apply to body stubs. (Aspects_On_Body_OK): Renamed to Aspects_On_Body_Or_Stub_OK. (Aspects_On_Body_Or_Stub_OK): Update the comment on usage. * par-prag.adb: Add pragma Refined_Pre to the list of pragmas that do not require special processing by the parser. * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Delay the analysis of aspect specifications that apply to a body stub until the proper body is analyzed. * sem_ch10.adb: Add with and use clause for Sem_Ch13. (Analyze_Package_Body_Stub): Set the corresponding spec of the stub. (Analyze_Proper_Body): Relocate all pragmas that apply to a subprogram body stub to the declarations of the proper body. Analyze the aspect specifications of the stub when the proper body is not present. (Analyze_Protected_Body_Stub): Set the corresponding spec of the stub. (Analyze_Task_Body_Stub): Set the corresponding spec of the stub. (Move_Stub_Pragmas_To_Body): New routine. * sem_ch13.adb (Analyze_Aspect_Specifications): Add processing for aspect Refined_Pre. (Check_Aspect_At_Freeze_Point): Aspect Refined_Pre does not need delayed processing at the freeze point. * sem_prag.adb: Remove with and use clause for Snames. Add an entry for Pragma_Refined_Pre in table Sig_Flags. (Analyze_Pragma): Add processing for pragma Refined_Pre. * sem_prag.ads: Add with and use clause for Snames. Add table Pragma_On_Stub_OK. * sinfo.adb (Corresponding_Spec_Of_Stub): New routine. (Set_Corresponding_Spec_Of_Stub): New routine. * sinfo.ads: Add new attribute Corresponding_Spec_Of_Stub along with comment on usage and occurrences in nodes. (Corresponding_Spec_Of_Stub): New routine along with pragma Inline. (Set_Corresponding_Spec_Of_Stub): New routine along with pragma Inline. * snames.ads-tmpl: Add new predefined name for Refined_Pre. Add new Pragma_Id for Refined_Pre. 2013-10-10 Ed Schonberg <schonberg@adacore.com> * sem_ch12.adb (Analyze_Package_Instantiation, Analyze_Subprogram_Instantiation): Improve error message when name in instantiation does not designate a generic unit of the right kind. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203355 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/aspects.ads')
-rw-r--r--gcc/ada/aspects.ads47
1 files changed, 40 insertions, 7 deletions
diff --git a/gcc/ada/aspects.ads b/gcc/ada/aspects.ads
index 5e8046d1ad0..66c4b857da0 100644
--- a/gcc/ada/aspects.ads
+++ b/gcc/ada/aspects.ads
@@ -111,6 +111,7 @@ package Aspects is
Aspect_Predicate, -- GNAT
Aspect_Priority,
Aspect_Read,
+ Aspect_Refined_Pre, -- GNAT
Aspect_Relative_Deadline,
Aspect_Scalar_Storage_Order, -- GNAT
Aspect_Simple_Storage_Pool, -- GNAT
@@ -319,6 +320,7 @@ package Aspects is
Aspect_Predicate => Expression,
Aspect_Priority => Expression,
Aspect_Read => Name,
+ Aspect_Refined_Pre => Expression,
Aspect_Relative_Deadline => Expression,
Aspect_Scalar_Storage_Order => Expression,
Aspect_Simple_Storage_Pool => Name,
@@ -415,6 +417,7 @@ package Aspects is
Aspect_Pure_12 => Name_Pure_12,
Aspect_Pure_Function => Name_Pure_Function,
Aspect_Read => Name_Read,
+ Aspect_Refined_Pre => Name_Refined_Pre,
Aspect_Relative_Deadline => Name_Relative_Deadline,
Aspect_Remote_Access_Type => Name_Remote_Access_Type,
Aspect_Remote_Call_Interface => Name_Remote_Call_Interface,
@@ -636,6 +639,7 @@ package Aspects is
Aspect_Convention => Never_Delay,
Aspect_Dimension => Never_Delay,
Aspect_Dimension_System => Never_Delay,
+ Aspect_Refined_Pre => Never_Delay,
Aspect_SPARK_Mode => Never_Delay,
Aspect_Synchronization => Never_Delay,
Aspect_Test_Case => Never_Delay,
@@ -657,15 +661,44 @@ package Aspects is
Aspect_Volatile => Rep_Aspect,
Aspect_Volatile_Components => Rep_Aspect);
- -- The following table indicates which aspects can apply simultaneously to
- -- both subprogram/package specs and bodies. For instance, the following is
- -- legal:
+ ------------------------------------------------
+ -- Handling of Aspect Specifications on Stubs --
+ ------------------------------------------------
+
+ -- Aspects that appear on the following stub nodes
+
+ -- N_Package_Body_Stub
+ -- N_Protected_Body_Stub
+ -- N_Subprogram_Body_Stub
+ -- N_Task_Body_Stub
+
+ -- are treated as if they apply to the corresponding proper body. Their
+ -- analysis is postponed until the analysis of the proper body takes place
+ -- (see Analyze_Proper_Body). The delay is required because the analysis
+ -- may generate extra code which would be harder to relocate to the body.
+ -- If the proper body is present, the aspect specifications are relocated
+ -- to the corresponding body node:
+
+ -- N_Package_Body
+ -- N_Protected_Body
+ -- N_Subprogram_Body
+ -- N_Task_Body
+
+ -- The subsequent analysis takes care of the aspect-to-pragma conversions
+ -- and verification of pragma legality. In the case where the proper body
+ -- is not available, the aspect specifications are analyzed on the spot
+ -- (see Analyze_Proper_Body) to catch potential errors.
+
+ -- The following table lists all aspects that can apply to a subprogram
+ -- body [stub]. For instance, the following example is legal:
-- package P with SPARK_Mode ...;
-- package body P with SPARK_Mode is ...;
- Aspect_On_Body_OK : constant array (Aspect_Id) of Boolean :=
- (Aspect_SPARK_Mode => True,
+ Aspect_On_Body_Or_Stub_OK : constant array (Aspect_Id) of Boolean :=
+ (Aspect_Refined_Pre => True,
+ Aspect_SPARK_Mode => True,
+ Aspect_Warnings => True,
others => False);
---------------------------------------------------
@@ -696,9 +729,9 @@ package Aspects is
-- Replace calls, and this function may be used to retrieve the aspect
-- specifications for the original rewritten node in such cases.
- function Aspects_On_Body_OK (N : Node_Id) return Boolean;
+ function Aspects_On_Body_Or_Stub_OK (N : Node_Id) return Boolean;
-- N denotes a body [stub] with aspects. Determine whether all aspects of N
- -- can appear simultaneously in bodies and specs.
+ -- are allowed to appear on a body [stub].
function Find_Aspect (Id : Entity_Id; A : Aspect_Id) return Node_Id;
-- Find the aspect specification of aspect A associated with entity I.