summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_util.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-02-25 15:52:52 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-02-25 15:52:52 +0000
commita9f3e0f0fa337baf605245368404c32232506f76 (patch)
tree12a5a685674be8dfe39778e861e961ac374d255c /gcc/ada/sem_util.adb
parente3ad65fcc6ee4ee36eaf9a42e381000eecd09956 (diff)
downloadgcc-a9f3e0f0fa337baf605245368404c32232506f76.tar.gz
2014-02-25 Robert Dewar <dewar@adacore.com>
* rtsfind.adb (Is_RTE): Protect against entity with no scope field (previously this call blew up on the Standard entity). * sem_attr.adb (Analyze_Attribute, case Access): Remove test for No_Abort_Statements, this is now handled in Set_Entity_With_Checks. * exp_ch6.adb, sem_ch10.adb, sem_ch4.adb, sem_ch8.adb, sem_res.adb: Change name Set_Entity_With_Style_Check => Set_Entity_With_Checks. * sem_util.ads, sem_util.adb: Change name Set_Entity_With_Style_Check => Set_Entity_With_Checks. (Set_Entity_With_Checks): Add checks for No_Dynamic_Attachment, Add checks for No_Abort_Statements. 2014-02-25 Robert Dewar <dewar@adacore.com> * exp_ch9.adb (Expand_Entry_Barrier): Add comment that call to Check_Restriction is OK. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208148 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r--gcc/ada/sem_util.adb54
1 files changed, 47 insertions, 7 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 791bc2ebcba..6894a3ae937 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2014, 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- --
@@ -15805,19 +15805,59 @@ package body Sem_Util is
end if;
end Set_Debug_Info_Needed;
- ---------------------------------
- -- Set_Entity_With_Style_Check --
- ---------------------------------
+ ----------------------------
+ -- Set_Entity_With_Checks --
+ ----------------------------
- procedure Set_Entity_With_Style_Check (N : Node_Id; Val : Entity_Id) is
+ procedure Set_Entity_With_Checks (N : Node_Id; Val : Entity_Id) is
Val_Actual : Entity_Id;
Nod : Node_Id;
+ Post_Node : Node_Id;
begin
-- Unconditionally set the entity
Set_Entity (N, Val);
+ -- Remaining checks are only done on source nodes
+
+ if not Comes_From_Source (N) then
+ return;
+ end if;
+
+ -- The node to post on is the selector in the case of an expanded name,
+ -- and otherwise the node itself.
+
+ if Nkind (N) = N_Expanded_Name then
+ Post_Node := Selector_Name (N);
+ else
+ Post_Node := N;
+ end if;
+
+ -- Check for violation of No_Abort_Statements, which is triggered by
+ -- call to Ada.Task_Identification.Abort_Task.
+
+ if Restriction_Check_Required (No_Abort_Statements)
+ and then (Is_RTE (Val, RE_Abort_Task))
+ then
+ Check_Restriction (No_Abort_Statements, Post_Node);
+ end if;
+
+ -- Check for violation of No_Dynamic_Attachment
+
+ if Restriction_Check_Required (No_Dynamic_Attachment)
+ and then RTU_Loaded (Ada_Interrupts)
+ and then (Is_RTE (Val, RE_Is_Reserved) or else
+ Is_RTE (Val, RE_Is_Attached) or else
+ Is_RTE (Val, RE_Current_Handler) or else
+ Is_RTE (Val, RE_Attach_Handler) or else
+ Is_RTE (Val, RE_Exchange_Handler) or else
+ Is_RTE (Val, RE_Detach_Handler) or else
+ Is_RTE (Val, RE_Reference))
+ then
+ Check_Restriction (No_Dynamic_Attachment, Post_Node);
+ end if;
+
-- Check for No_Implementation_Identifiers
if Restriction_Check_Required (No_Implementation_Identifiers) then
@@ -15834,7 +15874,7 @@ package body Sem_Util is
and then not (Ekind_In (Val, E_Package, E_Generic_Package)
and then Is_Library_Level_Entity (Val))
then
- Check_Restriction (No_Implementation_Identifiers, N);
+ Check_Restriction (No_Implementation_Identifiers, Post_Node);
end if;
end if;
@@ -15877,7 +15917,7 @@ package body Sem_Util is
end if;
Set_Entity (N, Val);
- end Set_Entity_With_Style_Check;
+ end Set_Entity_With_Checks;
------------------------
-- Set_Name_Entity_Id --