Commit dcbd752d by Samuel Tardieu Committed by Samuel Tardieu

a-tasatt.adb: Use 'Access instead of 'Unchecked_Access when applicable.

    gcc/ada/
	* a-tasatt.adb: Use 'Access instead of 'Unchecked_Access when
	applicable. Local lifetime is the one of the package.
	(Set_Value): W is allocated on the heap.

	* g-socket.adb: Use 'Access instead of 'Unchecked_Access when
	applicable.
	(Get_Socket_Option): Optlen formal of C_Getsockopt is of an anonymous
	access type.
	(Receive_Socket): Fromlen formal of C_Recvfrom is of an anonymous
	access type.

	* s-taasde.adb: Use 'Access instead of 'Unchecked_Access when
	applicable.
	(elaboration code): Timer_Queue lifetime is the one of the
	package.

From-SVN: r129963
parent f9d806de
...@@ -2,6 +2,21 @@ ...@@ -2,6 +2,21 @@
* a-tasatt.adb: Type Wrapper should be declared in comment instead * a-tasatt.adb: Type Wrapper should be declared in comment instead
of already declared type Node_Access. of already declared type Node_Access.
Use 'Access instead of 'Unchecked_Access when applicable. Local
lifetime is the one of the package.
(Set_Value): W is allocated on the heap.
* g-socket.adb: Use 'Access instead of 'Unchecked_Access when
applicable.
(Get_Socket_Option): Optlen formal of C_Getsockopt is of an anonymous
access type.
(Receive_Socket): Fromlen formal of C_Recvfrom is of an anonymous
access type.
* s-taasde.adb: Use 'Access instead of 'Unchecked_Access when
applicable.
(elaboration code): Timer_Queue lifetime is the one of the
package.
2007-11-07 Olivier Hainque <hainque@adacore.com> 2007-11-07 Olivier Hainque <hainque@adacore.com>
...@@ -415,7 +415,7 @@ package body Ada.Task_Attributes is ...@@ -415,7 +415,7 @@ package body Ada.Task_Attributes is
POP.Lock_RTS; POP.Lock_RTS;
while P /= null loop while P /= null loop
if P.Instance = Access_Instance'(Local'Unchecked_Access) then if P.Instance = Access_Instance'(Local'Access) then
POP.Unlock_RTS; POP.Unlock_RTS;
Undefer_Abort (Self_Id); Undefer_Abort (Self_Id);
return To_Access_Wrapper (P.Wrapper).Value'Access; return To_Access_Wrapper (P.Wrapper).Value'Access;
...@@ -429,11 +429,10 @@ package body Ada.Task_Attributes is ...@@ -429,11 +429,10 @@ package body Ada.Task_Attributes is
-- holding any other lock. -- holding any other lock.
POP.Unlock_RTS; POP.Unlock_RTS;
W := new Wrapper' W := new Wrapper'((null, Local'Access, null), Initial_Value);
((null, Local'Unchecked_Access, null), Initial_Value);
POP.Lock_RTS; POP.Lock_RTS;
P := W.Dummy_Node'Unchecked_Access; P := W.Dummy_Node'Access;
P.Wrapper := To_Access_Dummy_Wrapper (W); P.Wrapper := To_Access_Dummy_Wrapper (W);
P.Next := To_Access_Node (TT.Indirect_Attributes); P.Next := To_Access_Node (TT.Indirect_Attributes);
TT.Indirect_Attributes := To_Access_Address (P); TT.Indirect_Attributes := To_Access_Address (P);
...@@ -494,7 +493,7 @@ package body Ada.Task_Attributes is ...@@ -494,7 +493,7 @@ package body Ada.Task_Attributes is
Q := To_Access_Node (TT.Indirect_Attributes); Q := To_Access_Node (TT.Indirect_Attributes);
while Q /= null loop while Q /= null loop
if Q.Instance = Access_Instance'(Local'Unchecked_Access) then if Q.Instance = Access_Instance'(Local'Access) then
if P = null then if P = null then
TT.Indirect_Attributes := To_Access_Address (Q.Next); TT.Indirect_Attributes := To_Access_Address (Q.Next);
else else
...@@ -581,7 +580,7 @@ package body Ada.Task_Attributes is ...@@ -581,7 +580,7 @@ package body Ada.Task_Attributes is
while P /= null loop while P /= null loop
if P.Instance = Access_Instance'(Local'Unchecked_Access) then if P.Instance = Access_Instance'(Local'Access) then
To_Access_Wrapper (P.Wrapper).Value := Val; To_Access_Wrapper (P.Wrapper).Value := Val;
POP.Unlock_RTS; POP.Unlock_RTS;
Undefer_Abort (Self_Id); Undefer_Abort (Self_Id);
...@@ -595,9 +594,9 @@ package body Ada.Task_Attributes is ...@@ -595,9 +594,9 @@ package body Ada.Task_Attributes is
-- from using new (i.e the Global_Lock) while holding any other lock. -- from using new (i.e the Global_Lock) while holding any other lock.
POP.Unlock_RTS; POP.Unlock_RTS;
W := new Wrapper'((null, Local'Unchecked_Access, null), Val); W := new Wrapper'((null, Local'Access, null), Val);
POP.Lock_RTS; POP.Lock_RTS;
P := W.Dummy_Node'Unchecked_Access; P := W.Dummy_Node'Access;
P.Wrapper := To_Access_Dummy_Wrapper (W); P.Wrapper := To_Access_Dummy_Wrapper (W);
P.Next := To_Access_Node (TT.Indirect_Attributes); P.Next := To_Access_Node (TT.Indirect_Attributes);
TT.Indirect_Attributes := To_Access_Address (P); TT.Indirect_Attributes := To_Access_Address (P);
...@@ -669,7 +668,7 @@ package body Ada.Task_Attributes is ...@@ -669,7 +668,7 @@ package body Ada.Task_Attributes is
P := To_Access_Node (TT.Indirect_Attributes); P := To_Access_Node (TT.Indirect_Attributes);
while P /= null loop while P /= null loop
if P.Instance = Access_Instance'(Local'Unchecked_Access) then if P.Instance = Access_Instance'(Local'Access) then
Result := To_Access_Wrapper (P.Wrapper).Value; Result := To_Access_Wrapper (P.Wrapper).Value;
POP.Unlock_RTS; POP.Unlock_RTS;
Undefer_Abort (Self_Id); Undefer_Abort (Self_Id);
...@@ -724,8 +723,7 @@ begin ...@@ -724,8 +723,7 @@ begin
-- Add this instantiation to the list of all instantiations -- Add this instantiation to the list of all instantiations
Local.Next := System.Tasking.Task_Attributes.All_Attributes; Local.Next := System.Tasking.Task_Attributes.All_Attributes;
System.Tasking.Task_Attributes.All_Attributes := System.Tasking.Task_Attributes.All_Attributes := Local'Access;
Local'Unchecked_Access;
-- Try to find space for the attribute in the TCB -- Try to find space for the attribute in the TCB
......
...@@ -978,7 +978,7 @@ package body GNAT.Sockets is ...@@ -978,7 +978,7 @@ package body GNAT.Sockets is
(C.int (Socket), (C.int (Socket),
Levels (Level), Levels (Level),
Options (Name), Options (Name),
Add, Len'Unchecked_Access); Add, Len'Access);
if Res = Failure then if Res = Failure then
Raise_Socket_Error (Socket_Errno); Raise_Socket_Error (Socket_Errno);
...@@ -1440,7 +1440,7 @@ package body GNAT.Sockets is ...@@ -1440,7 +1440,7 @@ package body GNAT.Sockets is
Item'Length, Item'Length,
To_Int (Flags), To_Int (Flags),
Sin'Unchecked_Access, Sin'Unchecked_Access,
Len'Unchecked_Access); Len'Access);
if Res = Failure then if Res = Failure then
Raise_Socket_Error (Socket_Errno); Raise_Socket_Error (Socket_Errno);
......
...@@ -437,8 +437,8 @@ package body System.Tasking.Async_Delays is ...@@ -437,8 +437,8 @@ package body System.Tasking.Async_Delays is
------------------------------ ------------------------------
begin begin
Timer_Queue.Succ := Timer_Queue'Unchecked_Access; Timer_Queue.Succ := Timer_Queue'Access;
Timer_Queue.Pred := Timer_Queue'Unchecked_Access; Timer_Queue.Pred := Timer_Queue'Access;
Timer_Queue.Resume_Time := Duration'Last; Timer_Queue.Resume_Time := Duration'Last;
Timer_Server_ID := To_System (Timer_Server'Identity); Timer_Server_ID := To_System (Timer_Server'Identity);
end System.Tasking.Async_Delays; end System.Tasking.Async_Delays;
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