diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2013-07-08 10:15:25 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2013-07-08 10:15:25 +0200 |
commit | 2cbac6c692b9a68e9fedaa193ae756eea8ac23c5 (patch) | |
tree | 50c5674f4b0dc7891f7116f7ee46b8a75f9b73f7 /gcc/ada/sem_ch13.adb | |
parent | d7a3e18ca87744c3bd293396952a7ff36412d1ce (diff) | |
download | gcc-2cbac6c692b9a68e9fedaa193ae756eea8ac23c5.zip gcc-2cbac6c692b9a68e9fedaa193ae756eea8ac23c5.tar.gz gcc-2cbac6c692b9a68e9fedaa193ae756eea8ac23c5.tar.bz2 |
[multiple changes]
2013-07-08 Robert Dewar <dewar@adacore.com>
* sem.ads: Minor comment updates.
* s-restri.ads, exp_ch6.adb, lib-load.ads, exp_ch3.adb, sem_ch10.adb:
Minor reformatting.
2013-07-08 Robert Dewar <dewar@adacore.com>
* exp_attr.adb (Expand_N_Attribute_Reference): Add dummy entry
for Restriction_Set.
* gnat_rm.texi: Add missing menu entry for Attribute Ref Add
documentation for attribute Restriction_Set.
* lib-writ.adb (Write_With_Lines): Generate special W lines
for Restriction_Set.
* lib-writ.ads: Document special use of W lines for
Restriction_Set.
* lib.ads (Restriction_Set_Dependences): New table.
* par-ch4.adb (Is_Parameterless_Attribute): Add Loop_Entry to
list (Scan_Name_Extension_Apostrophe): Remove kludge test for
Loop_Entry (Scan_Name_Extension_Apostrophe): Handle No_Dependence
for Restricton_Set.
* restrict.adb (Check_SPARK_Restriction): Put in Alfa order
(OK_No_Dependence_Unit_Name): New function.
* restrict.ads (OK_No_Dependence_Unit_Name): New function.
* rtsfind.adb: Minor reformatting Minor code reorganization.
* sem_attr.adb (Analyze_Attribute): Add processing for
Restriction_Set.
* sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings):
Remove Check_Unit_Name and use new function
OK_No_Dependence_Unit_Name instead.
* sinfo.ads: Minor comment updates.
* snames.ads-tmpl: Add entry for Restriction_Set attribute.
2013-07-08 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch4.adb (Apply_Accessibility_Check): Remove local constant
Pool_Id and local variable Free_Stmt. Do not deallocate the faulty
object as "free" is not available on all targets/profiles.
2013-07-08 Robert Dewar <dewar@adacore.com>
* sem_ch13.adb (Analyze_Aspect_Specifications): Handle
Storage_Size aspect for task type in case discriminant is
referenced.
(Analyze_Attribute_Definition_Clause): Do not flag Storage_Size
attribute definition clause as obsolescent if from aspect.
From-SVN: r200771
Diffstat (limited to 'gcc/ada/sem_ch13.adb')
-rw-r--r-- | gcc/ada/sem_ch13.adb | 76 |
1 files changed, 68 insertions, 8 deletions
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index abf415f..37fd722 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -1310,7 +1310,6 @@ package body Sem_Ch13 is Aspect_Small | Aspect_Simple_Storage_Pool | Aspect_Storage_Pool | - Aspect_Storage_Size | Aspect_Stream_Size | Aspect_Value_Size | Aspect_Variable_Indexing | @@ -1751,7 +1750,7 @@ package body Sem_Ch13 is Analyze_Aspect_Dimension_System (N, Id, Expr); goto Continue; - -- Case 4: Special handling for aspects + -- Case 4: Aspects requiring special handling -- Pre/Post/Test_Case/Contract_Cases whose corresponding -- pragmas take care of the delay. @@ -2028,6 +2027,62 @@ package body Sem_Ch13 is else Aitem := Empty; end if; + + -- Storage_Size + + -- This is special because for access types we need to generate + -- an attribute definition clause. This also works for single + -- task declarations, but it does not work for task type + -- declarations, because we have the case where the expression + -- references a discriminant of the task type. That can't use + -- an attribute definition clause because we would not have + -- visibility on the discriminant. For that case we must + -- generate a pragma in the task definition. + + when Aspect_Storage_Size => + + -- Task type case + + if Ekind (E) = E_Task_Type then + declare + Decl : constant Node_Id := Declaration_Node (E); + + begin + pragma Assert (Nkind (Decl) = N_Task_Type_Declaration); + + -- If no task definition, create one + + if No (Task_Definition (Decl)) then + Set_Task_Definition (Decl, + Make_Task_Definition (Loc, + Visible_Declarations => Empty_List, + End_Label => Empty)); + end if; + + -- Create a pragma and put it at the start of the + -- task definition for the task type declaration. + + Make_Aitem_Pragma + (Pragma_Argument_Associations => New_List ( + Make_Pragma_Argument_Association (Loc, + Expression => Relocate_Node (Expr))), + Pragma_Name => Name_Storage_Size); + + Prepend + (Aitem, + Visible_Declarations (Task_Definition (Decl))); + goto Continue; + end; + + -- All other cases, generate attribute definition + + else + Aitem := + Make_Attribute_Definition_Clause (Loc, + Name => Ent, + Chars => Chars (Id), + Expression => Relocate_Node (Expr)); + end if; end case; -- Attach the corresponding pragma/attribute definition clause to @@ -4067,13 +4122,18 @@ package body Sem_Ch13 is begin if Is_Task_Type (U_Ent) then - Check_Restriction (No_Obsolescent_Features, N); - if Warn_On_Obsolescent_Feature then - Error_Msg_N - ("?j?storage size clause for task is an " & - "obsolescent feature (RM J.9)", N); - Error_Msg_N ("\?j?use Storage_Size pragma instead", N); + -- Check obsolescent (but never obsolescent if from aspect!) + + if not From_Aspect_Specification (N) then + Check_Restriction (No_Obsolescent_Features, N); + + if Warn_On_Obsolescent_Feature then + Error_Msg_N + ("?j?storage size clause for task is an " & + "obsolescent feature (RM J.9)", N); + Error_Msg_N ("\?j?use Storage_Size pragma instead", N); + end if; end if; FOnly := True; |