summaryrefslogtreecommitdiffstats
path: root/gcc/ada/exp_ch2.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-24 09:51:42 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-24 09:51:42 +0000
commit07c191b040bec6ff3e7855556689c53a35062f99 (patch)
tree8e1fb052842b78ff9e44ea4d0eb445b8ea8d15ee /gcc/ada/exp_ch2.adb
parent84718223174979b8bd7ced76182868713dbca37b (diff)
downloadppe42-gcc-07c191b040bec6ff3e7855556689c53a35062f99.tar.gz
ppe42-gcc-07c191b040bec6ff3e7855556689c53a35062f99.zip
2011-10-24 Ed Schonberg <schonberg@adacore.com>
* sem_ch12.adb (Earlier): make available globally. If both nodes have the same sloc, the freeze node that does not come from source is the later one. (True_Parent): Make available globally. (Previous_Instance): Subsidiary of Insert_Freeze_Node_For_Instance, to check whether the generic parent of the current instance is declared within a previous instance in the same unit or declarative part, in which case the freeze nodes of both instances must appear in order to prevent elaboration problems in gigi. * sem_ch12.adb (Insert_Freeze_Node_For_Instance): A stub is a freeze point, and the freeze node of a preceding instantiation must be inserted before it. 2011-10-24 Robert Dewar <dewar@adacore.com> * checks.ads, checks.adb: Add handling of Synchronization_Check * debug.adb: Add doc for -gnatd.d and -gnatd.e (disable/enable atomic sync). * exp_ch2.adb (Expand_Entity_Reference): Set Atomic_Sync_Required flag Minor code reorganization. * opt.ads (Warn_On_Atomic_Synchronization): New switch. * par-prag.adb: Add dummy entries for pragma Disable/Enable_Atomic_Synchronization. * sem_prag.adb (Process_Suppress_Unsuppress): Handle case of Atomic_Synchronization specially (not suppressed by All_Checks, cannot be set from Source). (Pragma Disable/Enable_Atomic_Synchronization): Add processing. * sinfo.ads, sinfo.adb: Add Atomic_Sync_Required flag * snames.ads-tmpl: Add entry for Atomic_Synchronization Add entry for pragma Disable/Enable_Atomic_Synchronization * switch-c.adb: The -gnatp switch does not disable Atomic_Synchronization Add -gnatep switch to disable Atomic_Synchronization. * types.ads: Add entry for Synchronization_Check * usage.adb: Add line for -gnated switch * warnsw.adb: Settings for Warn_On_Atomic_Synchronization git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180373 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_ch2.adb')
-rw-r--r--gcc/ada/exp_ch2.adb51
1 files changed, 49 insertions, 2 deletions
diff --git a/gcc/ada/exp_ch2.adb b/gcc/ada/exp_ch2.adb
index 68483ffb393..a71ce69602e 100644
--- a/gcc/ada/exp_ch2.adb
+++ b/gcc/ada/exp_ch2.adb
@@ -24,6 +24,7 @@
------------------------------------------------------------------------------
with Atree; use Atree;
+with Checks; use Checks;
with Debug; use Debug;
with Einfo; use Einfo;
with Elists; use Elists;
@@ -354,10 +355,10 @@ package body Exp_Ch2 is
elsif Is_Protected_Component (E) then
if No_Run_Time_Mode then
return;
+ else
+ Expand_Protected_Component (N);
end if;
- Expand_Protected_Component (N);
-
elsif Ekind (E) = E_Entry_Index_Parameter then
Expand_Entry_Index_Parameter (N);
@@ -398,6 +399,52 @@ package body Exp_Ch2 is
Write_Eol;
end if;
+ -- Set Atomic_Sync_Required if necessary for atomic variable
+
+ if Is_Atomic (E) then
+ declare
+ Set : Boolean;
+ MLoc : Node_Id;
+
+ begin
+ -- Always set if debug flag d.e is set
+
+ if Debug_Flag_Dot_E then
+ Set := True;
+
+ -- Never set if debug flag d.d is set
+
+ elsif Debug_Flag_Dot_D then
+ Set := False;
+
+ -- Otherwise setting comes from Atomic_Synchronization state
+
+ else
+ Set := not Atomic_Synchronization_Disabled (E);
+ end if;
+
+ -- Set flag if required
+
+ if Set then
+
+ -- Generate info message if requested
+
+ if Warn_On_Atomic_Synchronization then
+ if Nkind (N) = N_Identifier then
+ MLoc := N;
+ else
+ MLoc := Selector_Name (N);
+ end if;
+
+ Error_Msg_N
+ ("?info: atomic synchronization set for &", MLoc);
+ end if;
+
+ Set_Atomic_Sync_Required (N);
+ end if;
+ end;
+ end if;
+
-- Interpret possible Current_Value for variable case
if Is_Assignable (E)
OpenPOWER on IntegriCloud