Commit d2b4b3da by Arnaud Charlet

[multiple changes]

2011-08-31  Yannick Moy  <moy@adacore.com>

	* sem_ch4.adb: Code clean up.

2011-08-31  Yannick Moy  <moy@adacore.com>

	* exp_alfa.adb, exp_alfa.ads: Minor correction of copyright notice.

2011-08-31  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch7.adb (Build_Array_Deep_Procs): Do not generate Deep_Finalize
	and TSS primitive Finalize_Address if finalization is suppressed.
	(Build_Record_Deep_Procs): Do not generate Deep_Finalize and TSS
	primitive Finalize_Address if finalization is suppressed.

2011-08-31  Jose Ruiz  <ruiz@adacore.com>

	* s-mudido-affinity.adb, s-taprop-linux.adb, s-taprop-mingw.adb,
	s-taprop-solaris.adb, s-taprop-vxworks.adb (Set_Task_Affinity): Make
	sure that the underlying task has already been created before trying
	to change its affinity.
	(Set_CPU): Use the term processor instead of CPU, as we do in
	Assign_Task.

2011-08-31  Vincent Celier  <celier@adacore.com>

	* prj-attr.adb: New Compiler attribute Source_File_Switches.
	* prj-nmsc.adb (Process_Compiler): Process attribute
	Source_File_Switches.
	* prj.ads (Language_Config): New name list component
	Name_Source_File_Switches.
	* snames.ads-tmpl (Name_Source_File_Switches): New standard name.

2011-08-31  Ed Schonberg  <schonberg@adacore.com>

	* sem_attr.adb (Analyze_Attribute, case 'Old): If prefix may be a
	discriminated component of an actual, expand at once to prevent
	ouf-of-order references with generated subtypes.

2011-08-31  Yannick Moy  <moy@adacore.com>

	* lib-xref-alfa.adb (Add_Alfa_Xrefs): Do not take into account read
	reference to operator in Alfa xrefs.

2011-08-31  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch12.adb (Freeze_Subprogram_Body): Add code to handle the case
	where the parent instance was frozen before the current instance due to
	the presence of a source body. Update calls to Insert_After_Last_Decl.
	(Insert_After_Last_Decl): Renamed to Insert_Freeze_Node_For_Instance.
	Update the comment which illustrates the purpose of the routine.
	Package instances are now frozen by source bodies which appear after
	the instance. This ensures that entities coming from within the
	instance are available for use in the said bodies.
	(Install_Body): Add code to handle the case where the parent instance
	was frozen before the current instance due to the presence of a source
	body. Update calls to Insert_After_Last_Decl.

From-SVN: r178360
parent 16c3301a
2011-08-31 Yannick Moy <moy@adacore.com>
* sem_ch4.adb: Code clean up.
2011-08-31 Yannick Moy <moy@adacore.com>
* exp_alfa.adb, exp_alfa.ads: Minor correction of copyright notice.
2011-08-31 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch7.adb (Build_Array_Deep_Procs): Do not generate Deep_Finalize
and TSS primitive Finalize_Address if finalization is suppressed.
(Build_Record_Deep_Procs): Do not generate Deep_Finalize and TSS
primitive Finalize_Address if finalization is suppressed.
2011-08-31 Jose Ruiz <ruiz@adacore.com>
* s-mudido-affinity.adb, s-taprop-linux.adb, s-taprop-mingw.adb,
s-taprop-solaris.adb, s-taprop-vxworks.adb (Set_Task_Affinity): Make
sure that the underlying task has already been created before trying
to change its affinity.
(Set_CPU): Use the term processor instead of CPU, as we do in
Assign_Task.
2011-08-31 Vincent Celier <celier@adacore.com>
* prj-attr.adb: New Compiler attribute Source_File_Switches.
* prj-nmsc.adb (Process_Compiler): Process attribute
Source_File_Switches.
* prj.ads (Language_Config): New name list component
Name_Source_File_Switches.
* snames.ads-tmpl (Name_Source_File_Switches): New standard name.
2011-08-31 Ed Schonberg <schonberg@adacore.com>
* sem_attr.adb (Analyze_Attribute, case 'Old): If prefix may be a
discriminated component of an actual, expand at once to prevent
ouf-of-order references with generated subtypes.
2011-08-31 Yannick Moy <moy@adacore.com>
* lib-xref-alfa.adb (Add_Alfa_Xrefs): Do not take into account read
reference to operator in Alfa xrefs.
2011-08-31 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch12.adb (Freeze_Subprogram_Body): Add code to handle the case
where the parent instance was frozen before the current instance due to
the presence of a source body. Update calls to Insert_After_Last_Decl.
(Insert_After_Last_Decl): Renamed to Insert_Freeze_Node_For_Instance.
Update the comment which illustrates the purpose of the routine.
Package instances are now frozen by source bodies which appear after
the instance. This ensures that entities coming from within the
instance are available for use in the said bodies.
(Install_Body): Add code to handle the case where the parent instance
was frozen before the current instance due to the presence of a source
body. Update calls to Insert_After_Last_Decl.
2011-08-31 Jose Ruiz <ruiz@adacore.com> 2011-08-31 Jose Ruiz <ruiz@adacore.com>
* s-taprop-linux.adb (Set_Task_Affinity): Avoid the use of anonymous * s-taprop-linux.adb (Set_Task_Affinity): Avoid the use of anonymous
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2011, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2011, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
......
...@@ -434,21 +434,26 @@ package body Exp_Ch7 is ...@@ -434,21 +434,26 @@ package body Exp_Ch7 is
Stmts => Make_Deep_Array_Body (Adjust_Case, Typ))); Stmts => Make_Deep_Array_Body (Adjust_Case, Typ)));
end if; end if;
Set_TSS (Typ, -- Do not generate Deep_Finalize and Finalize_Address if finalization is
Make_Deep_Proc -- suppressed since these routine will not be used.
(Prim => Finalize_Case,
Typ => Typ,
Stmts => Make_Deep_Array_Body (Finalize_Case, Typ)));
-- Create TSS primitive Finalize_Address for non-VM targets. JVM and if not Restriction_Active (No_Finalization) then
-- .NET do not support address arithmetic and unchecked conversions.
if VM_Target = No_VM then
Set_TSS (Typ, Set_TSS (Typ,
Make_Deep_Proc Make_Deep_Proc
(Prim => Address_Case, (Prim => Finalize_Case,
Typ => Typ, Typ => Typ,
Stmts => Make_Deep_Array_Body (Address_Case, Typ))); Stmts => Make_Deep_Array_Body (Finalize_Case, Typ)));
-- Create TSS primitive Finalize_Address for non-VM targets. JVM and
-- .NET do not support address arithmetic and unchecked conversions.
if VM_Target = No_VM then
Set_TSS (Typ,
Make_Deep_Proc
(Prim => Address_Case,
Typ => Typ,
Stmts => Make_Deep_Array_Body (Address_Case, Typ)));
end if;
end if; end if;
end Build_Array_Deep_Procs; end Build_Array_Deep_Procs;
...@@ -3090,21 +3095,26 @@ package body Exp_Ch7 is ...@@ -3090,21 +3095,26 @@ package body Exp_Ch7 is
Stmts => Make_Deep_Record_Body (Adjust_Case, Typ))); Stmts => Make_Deep_Record_Body (Adjust_Case, Typ)));
end if; end if;
Set_TSS (Typ, -- Do not generate Deep_Finalize and Finalize_Address if finalization is
Make_Deep_Proc -- suppressed since these routine will not be used.
(Prim => Finalize_Case,
Typ => Typ,
Stmts => Make_Deep_Record_Body (Finalize_Case, Typ)));
-- Create TSS primitive Finalize_Address for non-VM targets. JVM and if not Restriction_Active (No_Finalization) then
-- .NET do not support address arithmetic and unchecked conversions.
if VM_Target = No_VM then
Set_TSS (Typ, Set_TSS (Typ,
Make_Deep_Proc Make_Deep_Proc
(Prim => Address_Case, (Prim => Finalize_Case,
Typ => Typ, Typ => Typ,
Stmts => Make_Deep_Record_Body (Address_Case, Typ))); Stmts => Make_Deep_Record_Body (Finalize_Case, Typ)));
-- Create TSS primitive Finalize_Address for non-VM targets. JVM and
-- .NET do not support address arithmetic and unchecked conversions.
if VM_Target = No_VM then
Set_TSS (Typ,
Make_Deep_Proc
(Prim => Address_Case,
Typ => Typ,
Stmts => Make_Deep_Record_Body (Address_Case, Typ)));
end if;
end if; end if;
end Build_Record_Deep_Procs; end Build_Record_Deep_Procs;
......
...@@ -576,6 +576,11 @@ package body Alfa is ...@@ -576,6 +576,11 @@ package body Alfa is
Eliminate_Before_Sort : declare Eliminate_Before_Sort : declare
NR : Nat; NR : Nat;
function Is_Alfa_Reference
(E : Entity_Id;
Typ : Character) return Boolean;
-- Return whether the reference is adequate for this entity
function Is_Alfa_Scope (E : Entity_Id) return Boolean; function Is_Alfa_Scope (E : Entity_Id) return Boolean;
-- Return whether the entity or reference scope is adequate -- Return whether the entity or reference scope is adequate
...@@ -583,6 +588,25 @@ package body Alfa is ...@@ -583,6 +588,25 @@ package body Alfa is
-- Return True if E is a global constant for which we should ignore -- Return True if E is a global constant for which we should ignore
-- reads in Alfa. -- reads in Alfa.
-----------------------
-- Is_Alfa_Reference --
-----------------------
function Is_Alfa_Reference
(E : Entity_Id;
Typ : Character) return Boolean is
begin
-- The only references of interest on callable entities are calls.
-- On non-callable entities, the only references of interest are
-- reads and writes.
if Ekind (E) in Overloadable_Kind then
return Typ = 's';
else
return Typ = 'r' or else Typ = 'm';
end if;
end Is_Alfa_Reference;
------------------- -------------------
-- Is_Alfa_Scope -- -- Is_Alfa_Scope --
------------------- -------------------
...@@ -617,6 +641,8 @@ package body Alfa is ...@@ -617,6 +641,8 @@ package body Alfa is
and then Is_Alfa_Scope (Xrefs.Table (Rnums (J)).Ent_Scope) and then Is_Alfa_Scope (Xrefs.Table (Rnums (J)).Ent_Scope)
and then Is_Alfa_Scope (Xrefs.Table (Rnums (J)).Ref_Scope) and then Is_Alfa_Scope (Xrefs.Table (Rnums (J)).Ref_Scope)
and then not Is_Global_Constant (Xrefs.Table (Rnums (J)).Ent) and then not Is_Global_Constant (Xrefs.Table (Rnums (J)).Ent)
and then Is_Alfa_Reference (Xrefs.Table (Rnums (J)).Ent,
Xrefs.Table (Rnums (J)).Typ)
then then
Nrefs := Nrefs + 1; Nrefs := Nrefs + 1;
Rnums (Nrefs) := Rnums (J); Rnums (Nrefs) := Rnums (J);
......
...@@ -190,6 +190,7 @@ package body Prj.Attr is ...@@ -190,6 +190,7 @@ package body Prj.Attr is
"Latrailing_required_switches#" & "Latrailing_required_switches#" &
"Lapic_option#" & "Lapic_option#" &
"Sapath_syntax#" & "Sapath_syntax#" &
"Sasource_file_switches#" &
"Saobject_file_suffix#" & "Saobject_file_suffix#" &
"Laobject_file_switches#" & "Laobject_file_switches#" &
"Lamulti_unit_switches#" & "Lamulti_unit_switches#" &
......
...@@ -1470,6 +1470,12 @@ package body Prj.Nmsc is ...@@ -1470,6 +1470,12 @@ package body Prj.Nmsc is
Element.Value.Location, Project); Element.Value.Location, Project);
end; end;
when Name_Source_File_Switches =>
Put (Into_List =>
Lang_Index.Config.Source_File_Switches,
From_List => Element.Value.Values,
In_Tree => Data.Tree);
when Name_Object_File_Suffix => when Name_Object_File_Suffix =>
if Get_Name_String (Element.Value.Value) = "" then if Get_Name_String (Element.Value.Value) = "" then
Error_Msg Error_Msg
......
...@@ -447,6 +447,11 @@ package Prj is ...@@ -447,6 +447,11 @@ package Prj is
-- Value may be Canonical (Unix style) or Host (host syntax, for example -- Value may be Canonical (Unix style) or Host (host syntax, for example
-- on VMS for DEC C). -- on VMS for DEC C).
Source_File_Switches : Name_List_Index := No_Name_List;
-- Optional switches to be put before the source file. The source file
-- path name is appended to the last switch in the list.
-- Example: ("-i", "");
Object_File_Suffix : Name_Id := No_Name; Object_File_Suffix : Name_Id := No_Name;
-- Optional alternate object file suffix -- Optional alternate object file suffix
...@@ -580,6 +585,7 @@ package Prj is ...@@ -580,6 +585,7 @@ package Prj is
Multi_Unit_Switches => No_Name_List, Multi_Unit_Switches => No_Name_List,
Multi_Unit_Object_Separator => ' ', Multi_Unit_Object_Separator => ' ',
Path_Syntax => Canonical, Path_Syntax => Canonical,
Source_File_Switches => No_Name_List,
Object_File_Suffix => No_Name, Object_File_Suffix => No_Name,
Object_File_Switches => No_Name_List, Object_File_Switches => No_Name_List,
Compilation_PIC_Option => No_Name_List, Compilation_PIC_Option => No_Name_List,
......
...@@ -337,7 +337,7 @@ package body System.Multiprocessors.Dispatching_Domains is ...@@ -337,7 +337,7 @@ package body System.Multiprocessors.Dispatching_Domains is
not Target.Common.Domain (CPU)) not Target.Common.Domain (CPU))
then then
raise Dispatching_Domain_Error with raise Dispatching_Domain_Error with
"CPU does not belong to the task's dispatching domain"; "processor does not belong to the task's dispatching domain";
end if; end if;
Unchecked_Set_Affinity (Target.Common.Domain, CPU, Target); Unchecked_Set_Affinity (Target.Common.Domain, CPU, Target);
......
...@@ -38,7 +38,6 @@ pragma Polling (Off); ...@@ -38,7 +38,6 @@ pragma Polling (Off);
-- Turn off polling, we do not want ATC polling to take place during tasking -- Turn off polling, we do not want ATC polling to take place during tasking
-- operations. It causes infinite loops and other problems. -- operations. It causes infinite loops and other problems.
with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation; with Ada.Unchecked_Deallocation;
with Interfaces.C; with Interfaces.C;
...@@ -113,6 +112,10 @@ package body System.Task_Primitives.Operations is ...@@ -113,6 +112,10 @@ package body System.Task_Primitives.Operations is
Abort_Handler_Installed : Boolean := False; Abort_Handler_Installed : Boolean := False;
-- True if a handler for the abort signal is installed -- True if a handler for the abort signal is installed
Null_Thread_Id : constant pthread_t := pthread_t'Last;
-- Constant to indicate that the thread identifier has not yet been
-- initialized.
-------------------- --------------------
-- Local Packages -- -- Local Packages --
-------------------- --------------------
...@@ -154,13 +157,8 @@ package body System.Task_Primitives.Operations is ...@@ -154,13 +157,8 @@ package body System.Task_Primitives.Operations is
-- Local Subprograms -- -- Local Subprograms --
----------------------- -----------------------
subtype unsigned_long is Interfaces.C.unsigned_long;
procedure Abort_Handler (signo : Signal); procedure Abort_Handler (signo : Signal);
function To_pthread_t is new Ada.Unchecked_Conversion
(unsigned_long, System.OS_Interface.pthread_t);
------------------- -------------------
-- Abort_Handler -- -- Abort_Handler --
------------------- -------------------
...@@ -773,7 +771,7 @@ package body System.Task_Primitives.Operations is ...@@ -773,7 +771,7 @@ package body System.Task_Primitives.Operations is
Next_Serial_Number := Next_Serial_Number + 1; Next_Serial_Number := Next_Serial_Number + 1;
pragma Assert (Next_Serial_Number /= 0); pragma Assert (Next_Serial_Number /= 0);
Self_ID.Common.LL.Thread := To_pthread_t (-1); Self_ID.Common.LL.Thread := Null_Thread_Id;
if not Single_Lock then if not Single_Lock then
Result := pthread_mutex_init (Self_ID.Common.LL.L'Access, Result := pthread_mutex_init (Self_ID.Common.LL.L'Access,
...@@ -1363,7 +1361,14 @@ package body System.Task_Primitives.Operations is ...@@ -1363,7 +1361,14 @@ package body System.Task_Primitives.Operations is
use type System.Multiprocessors.CPU_Range; use type System.Multiprocessors.CPU_Range;
begin begin
if pthread_setaffinity_np'Address /= System.Null_Address then -- Do nothing if there is no support for setting affinities or the
-- underlying thread has not yet been created. If the thread has not
-- yet been created then the proper affinity will be set during its
-- creation.
if pthread_setaffinity_np'Address /= System.Null_Address
and then T.Common.LL.Thread /= Null_Thread_Id
then
declare declare
type cpu_set_t_ptr is access all cpu_set_t; type cpu_set_t_ptr is access all cpu_set_t;
......
...@@ -131,6 +131,10 @@ package body System.Task_Primitives.Operations is ...@@ -131,6 +131,10 @@ package body System.Task_Primitives.Operations is
Annex_D : Boolean := False; Annex_D : Boolean := False;
-- Set to True if running with Annex-D semantics -- Set to True if running with Annex-D semantics
Null_Thread_Id : constant Thread_Id := 0;
-- Constant to indicate that the thread identifier has not yet been
-- initialized.
------------------------------------ ------------------------------------
-- The thread local storage index -- -- The thread local storage index --
------------------------------------ ------------------------------------
...@@ -853,7 +857,7 @@ package body System.Task_Primitives.Operations is ...@@ -853,7 +857,7 @@ package body System.Task_Primitives.Operations is
-- Initialize thread ID to 0, this is needed to detect threads that -- Initialize thread ID to 0, this is needed to detect threads that
-- are not yet activated. -- are not yet activated.
Self_ID.Common.LL.Thread := 0; Self_ID.Common.LL.Thread := Null_Thread_Id;
Initialize_Cond (Self_ID.Common.LL.CV'Access); Initialize_Cond (Self_ID.Common.LL.CV'Access);
...@@ -1362,9 +1366,16 @@ package body System.Task_Primitives.Operations is ...@@ -1362,9 +1366,16 @@ package body System.Task_Primitives.Operations is
use type System.Multiprocessors.CPU_Range; use type System.Multiprocessors.CPU_Range;
begin begin
-- Do nothing if the underlying thread has not yet been created. If the
-- thread has not yet been created then the proper affinity will be set
-- during its creation.
if T.Common.LL.Thread = Null_Thread_Id then
null;
-- pragma CPU -- pragma CPU
if T.Common.Base_CPU /= System.Multiprocessors.Not_A_Specific_CPU then elsif T.Common.Base_CPU /= Multiprocessors.Not_A_Specific_CPU then
-- The CPU numbering in pragma CPU starts at 1 while the subprogram -- The CPU numbering in pragma CPU starts at 1 while the subprogram
-- to set the affinity starts at 0, therefore we must substract 1. -- to set the affinity starts at 0, therefore we must substract 1.
......
...@@ -101,6 +101,10 @@ package body System.Task_Primitives.Operations is ...@@ -101,6 +101,10 @@ package body System.Task_Primitives.Operations is
Abort_Handler_Installed : Boolean := False; Abort_Handler_Installed : Boolean := False;
-- True if a handler for the abort signal is installed -- True if a handler for the abort signal is installed
Null_Thread_Id : constant Thread_Id := Thread_Id'Last;
-- Constant to indicate that the thread identifier has not yet been
-- initialized.
---------------------- ----------------------
-- Priority Support -- -- Priority Support --
---------------------- ----------------------
...@@ -917,7 +921,7 @@ package body System.Task_Primitives.Operations is ...@@ -917,7 +921,7 @@ package body System.Task_Primitives.Operations is
Next_Serial_Number := Next_Serial_Number + 1; Next_Serial_Number := Next_Serial_Number + 1;
pragma Assert (Next_Serial_Number /= 0); pragma Assert (Next_Serial_Number /= 0);
Self_ID.Common.LL.Thread := To_thread_t (-1); Self_ID.Common.LL.Thread := Null_Thread_Id;
if not Single_Lock then if not Single_Lock then
Result := Result :=
...@@ -1021,7 +1025,7 @@ package body System.Task_Primitives.Operations is ...@@ -1021,7 +1025,7 @@ package body System.Task_Primitives.Operations is
Ada.Unchecked_Deallocation (Ada_Task_Control_Block, Task_Id); Ada.Unchecked_Deallocation (Ada_Task_Control_Block, Task_Id);
begin begin
T.Common.LL.Thread := To_thread_t (0); T.Common.LL.Thread := Null_Thread_Id;
if not Single_Lock then if not Single_Lock then
Result := mutex_destroy (T.Common.LL.L.L'Access); Result := mutex_destroy (T.Common.LL.L.L'Access);
...@@ -1944,9 +1948,16 @@ package body System.Task_Primitives.Operations is ...@@ -1944,9 +1948,16 @@ package body System.Task_Primitives.Operations is
use type System.Multiprocessors.CPU_Range; use type System.Multiprocessors.CPU_Range;
begin begin
-- Do nothing if the underlying thread has not yet been created. If the
-- thread has not yet been created then the proper affinity will be set
-- during its creation.
if T.Common.LL.Thread = Null_Thread_Id then
null;
-- pragma CPU -- pragma CPU
if T.Common.Base_CPU /= elsif T.Common.Base_CPU /=
System.Multiprocessors.Not_A_Specific_CPU System.Multiprocessors.Not_A_Specific_CPU
then then
-- The CPU numbering in pragma CPU starts at 1 while the subprogram -- The CPU numbering in pragma CPU starts at 1 while the subprogram
......
...@@ -105,6 +105,10 @@ package body System.Task_Primitives.Operations is ...@@ -105,6 +105,10 @@ package body System.Task_Primitives.Operations is
Time_Slice_Val : Integer; Time_Slice_Val : Integer;
pragma Import (C, Time_Slice_Val, "__gl_time_slice_val"); pragma Import (C, Time_Slice_Val, "__gl_time_slice_val");
Null_Thread_Id : constant Thread_Id := 0;
-- Constant to indicate that the thread identifier has not yet been
-- initialized.
-------------------- --------------------
-- Local Packages -- -- Local Packages --
-------------------- --------------------
...@@ -859,7 +863,7 @@ package body System.Task_Primitives.Operations is ...@@ -859,7 +863,7 @@ package body System.Task_Primitives.Operations is
procedure Initialize_TCB (Self_ID : Task_Id; Succeeded : out Boolean) is procedure Initialize_TCB (Self_ID : Task_Id; Succeeded : out Boolean) is
begin begin
Self_ID.Common.LL.CV := semBCreate (SEM_Q_PRIORITY, SEM_EMPTY); Self_ID.Common.LL.CV := semBCreate (SEM_Q_PRIORITY, SEM_EMPTY);
Self_ID.Common.LL.Thread := 0; Self_ID.Common.LL.Thread := Null_Thread_Id;
if Self_ID.Common.LL.CV = 0 then if Self_ID.Common.LL.CV = 0 then
Succeeded := False; Succeeded := False;
...@@ -952,7 +956,7 @@ package body System.Task_Primitives.Operations is ...@@ -952,7 +956,7 @@ package body System.Task_Primitives.Operations is
Set_Task_Affinity (T); Set_Task_Affinity (T);
if T.Common.LL.Thread <= 0 then if T.Common.LL.Thread <= Null_Thread_Id then
Succeeded := False; Succeeded := False;
else else
Succeeded := True; Succeeded := True;
...@@ -979,7 +983,7 @@ package body System.Task_Primitives.Operations is ...@@ -979,7 +983,7 @@ package body System.Task_Primitives.Operations is
pragma Assert (Result = 0); pragma Assert (Result = 0);
end if; end if;
T.Common.LL.Thread := 0; T.Common.LL.Thread := Null_Thread_Id;
Result := semDelete (T.Common.LL.CV); Result := semDelete (T.Common.LL.CV);
pragma Assert (Result = 0); pragma Assert (Result = 0);
...@@ -1254,7 +1258,7 @@ package body System.Task_Primitives.Operations is ...@@ -1254,7 +1258,7 @@ package body System.Task_Primitives.Operations is
Thread_Self : Thread_Id) return Boolean Thread_Self : Thread_Id) return Boolean
is is
begin begin
if T.Common.LL.Thread /= 0 if T.Common.LL.Thread /= Null_Thread_Id
and then T.Common.LL.Thread /= Thread_Self and then T.Common.LL.Thread /= Thread_Self
then then
return taskSuspend (T.Common.LL.Thread) = 0; return taskSuspend (T.Common.LL.Thread) = 0;
...@@ -1272,7 +1276,7 @@ package body System.Task_Primitives.Operations is ...@@ -1272,7 +1276,7 @@ package body System.Task_Primitives.Operations is
Thread_Self : Thread_Id) return Boolean Thread_Self : Thread_Id) return Boolean
is is
begin begin
if T.Common.LL.Thread /= 0 if T.Common.LL.Thread /= Null_Thread_Id
and then T.Common.LL.Thread /= Thread_Self and then T.Common.LL.Thread /= Thread_Self
then then
return taskResume (T.Common.LL.Thread) = 0; return taskResume (T.Common.LL.Thread) = 0;
...@@ -1298,7 +1302,7 @@ package body System.Task_Primitives.Operations is ...@@ -1298,7 +1302,7 @@ package body System.Task_Primitives.Operations is
C := All_Tasks_List; C := All_Tasks_List;
while C /= null loop while C /= null loop
if C.Common.LL.Thread /= 0 if C.Common.LL.Thread /= Null_Thread_Id
and then C.Common.LL.Thread /= Thread_Self and then C.Common.LL.Thread /= Thread_Self
then then
Dummy := Task_Stop (C.Common.LL.Thread); Dummy := Task_Stop (C.Common.LL.Thread);
...@@ -1316,7 +1320,7 @@ package body System.Task_Primitives.Operations is ...@@ -1316,7 +1320,7 @@ package body System.Task_Primitives.Operations is
function Stop_Task (T : ST.Task_Id) return Boolean is function Stop_Task (T : ST.Task_Id) return Boolean is
begin begin
if T.Common.LL.Thread /= 0 then if T.Common.LL.Thread /= Null_Thread_Id then
return Task_Stop (T.Common.LL.Thread) = 0; return Task_Stop (T.Common.LL.Thread) = 0;
else else
return True; return True;
...@@ -1330,7 +1334,7 @@ package body System.Task_Primitives.Operations is ...@@ -1330,7 +1334,7 @@ package body System.Task_Primitives.Operations is
function Continue_Task (T : ST.Task_Id) return Boolean function Continue_Task (T : ST.Task_Id) return Boolean
is is
begin begin
if T.Common.LL.Thread /= 0 then if T.Common.LL.Thread /= Null_Thread_Id then
return Task_Cont (T.Common.LL.Thread) = 0; return Task_Cont (T.Common.LL.Thread) = 0;
else else
return True; return True;
...@@ -1408,9 +1412,16 @@ package body System.Task_Primitives.Operations is ...@@ -1408,9 +1412,16 @@ package body System.Task_Primitives.Operations is
use type System.Multiprocessors.CPU_Range; use type System.Multiprocessors.CPU_Range;
begin begin
-- Do nothing if the underlying thread has not yet been created. If the
-- thread has not yet been created then the proper affinity will be set
-- during its creation.
if T.Common.LL.Thread = Null_Thread_Id then
null;
-- pragma CPU -- pragma CPU
if T.Common.Base_CPU /= System.Multiprocessors.Not_A_Specific_CPU then elsif T.Common.Base_CPU /= Multiprocessors.Not_A_Specific_CPU then
-- Ada 2012 pragma CPU uses CPU numbers starting from 1, while on -- Ada 2012 pragma CPU uses CPU numbers starting from 1, while on
-- VxWorks the first CPU is identified by a 0, so we need to adjust. -- VxWorks the first CPU is identified by a 0, so we need to adjust.
......
...@@ -1939,7 +1939,7 @@ package body Sem_Attr is ...@@ -1939,7 +1939,7 @@ package body Sem_Attr is
-- Analyze prefix and exit if error in analysis. If the prefix is an -- Analyze prefix and exit if error in analysis. If the prefix is an
-- incomplete type, use full view if available. Note that there are -- incomplete type, use full view if available. Note that there are
-- some attributes for which we do not analyze the prefix, since the -- some attributes for which we do not analyze the prefix, since the
-- prefix is not a normal name. -- prefix is not a normal name, or else needs special handling.
if Aname /= Name_Elab_Body if Aname /= Name_Elab_Body
and then and then
...@@ -1950,6 +1950,8 @@ package body Sem_Attr is ...@@ -1950,6 +1950,8 @@ package body Sem_Attr is
Aname /= Name_UET_Address Aname /= Name_UET_Address
and then and then
Aname /= Name_Enabled Aname /= Name_Enabled
and then
Aname /= Name_Old
then then
Analyze (P); Analyze (P);
P_Type := Etype (P); P_Type := Etype (P);
...@@ -3772,6 +3774,12 @@ package body Sem_Attr is ...@@ -3772,6 +3774,12 @@ package body Sem_Attr is
end if; end if;
Check_E0; Check_E0;
-- Prefix has not been analyzed yet, and its full analysis will take
-- place during expansion (see below).
Preanalyze_And_Resolve (P);
P_Type := Etype (P);
Set_Etype (N, P_Type); Set_Etype (N, P_Type);
if No (Current_Subprogram) then if No (Current_Subprogram) then
...@@ -3852,6 +3860,24 @@ package body Sem_Attr is ...@@ -3852,6 +3860,24 @@ package body Sem_Attr is
end if; end if;
end Check_Local; end Check_Local;
-- The attribute ppears within a pre/postcondition, but refers to
-- an entity in the enclosing subprogram. If it is a component of a
-- formal its expansion might generate actual subtypes that may be
-- referenced in an inner context, and which must be elaborated
-- within the subprogram itself. As a result we create a declaration
-- for it and insert it at the start of the enclosing subprogram
-- This is properly an expansion activity but it has to be performed
-- now to prevent out-of-order issues.
if Nkind (P) = N_Selected_Component
and then Has_Discriminants (Etype (Prefix (P)))
then
P_Type := Base_Type (P_Type);
Set_Etype (N, P_Type);
Set_Etype (P, P_Type);
Expand (N);
end if;
------------ ------------
-- Output -- -- Output --
------------ ------------
......
...@@ -3357,10 +3357,12 @@ package body Sem_Ch4 is ...@@ -3357,10 +3357,12 @@ package body Sem_Ch4 is
Check_SPARK_Restriction ("quantified expression is not allowed", N); Check_SPARK_Restriction ("quantified expression is not allowed", N);
-- If expansion is enabled, the condition is analyzed after rewritten -- If expansion is enabled (and not in Alfa mode), the condition is
-- as a loop. Otherwise we only need to set the type. -- analyzed after rewritten as a loop. So we only need to set the type.
if Operating_Mode /= Check_Semantics then if Operating_Mode /= Check_Semantics
and then not Alfa_Mode
then
Set_Etype (N, Standard_Boolean); Set_Etype (N, Standard_Boolean);
return; return;
end if; end if;
......
...@@ -1193,6 +1193,7 @@ package Snames is ...@@ -1193,6 +1193,7 @@ package Snames is
Name_Shared_Library_Suffix : constant Name_Id := N + $; Name_Shared_Library_Suffix : constant Name_Id := N + $;
Name_Separate_Suffix : constant Name_Id := N + $; Name_Separate_Suffix : constant Name_Id := N + $;
Name_Source_Dirs : constant Name_Id := N + $; Name_Source_Dirs : constant Name_Id := N + $;
Name_Source_File_Switches : constant Name_Id := N + $;
Name_Source_Files : constant Name_Id := N + $; Name_Source_Files : constant Name_Id := N + $;
Name_Source_List_File : constant Name_Id := N + $; Name_Source_List_File : constant Name_Id := N + $;
Name_Spec : constant Name_Id := N + $; Name_Spec : constant Name_Id := N + $;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment