Commit def46b54 by Robert Dewar Committed by Arnaud Charlet

s-osinte-lynxos-3.ads, [...]: Add missing pragma Convention C for subprogram pointers.

2007-12-06  Robert Dewar  <dewar@adacore.com>

	* s-osinte-lynxos-3.ads, s-osinte-hpux.ads, s-osinte-solaris-posix.ads, 
	s-osinte-freebsd.ads, s-osinte-lynxos.ads, s-osinte-tru64.ads, 
	s-osinte-mingw.ads, s-osinte-aix.ads, s-osinte-hpux-dce.ads, 
	s-osinte-irix.ads, s-osinte-solaris.ads, s-intman-vms.adb,
	s-osinte-vms.ads, s-osinte-vxworks6.ads, s-osinte-vxworks.ads,
	s-auxdec.ads, s-auxdec-vms_64.ads, s-osinte-darwin.ads, 
	s-taprop-vms.adb, s-interr-sigaction.adb, s-osinte-linux-hppa.ads, 
	i-vxwork-x86.ads, s-tpopde-vms.ads: Add missing pragma Convention C
	for subprogram pointers.

	* g-ctrl_c.adb: New file.

	* g-ctrl_c.ads (Install_Handler): New body.

	* freeze.adb (Freeze_Subprogram): Use new flag Has_Pragma_Inline_Always
	instead of obsolete function Is_Always_Inlined.
	(Freeze_Entity): check for tagged type in imported C subprogram
	(Freeze_Entity): check for 8-bit boolean in imported C subprogram
	(Freeze_Entity): check for convention Ada subprogram pointer in
	imported C subprogram.
	(Freeze_Fixed_Point_Type): In the case of a base type where the low
	bound would be chopped off and go from negative to zero, force
	Loval_Excl_EP to be the same as Loval_Incl_EP (the included lower
	bound) so that the size computation for the base type will take
	negative values into account.

From-SVN: r130813
parent b41ab480
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . C T R L _ C --
-- --
-- B o d y --
-- --
-- Copyright (C) 2002-2007, AdaCore --
-- --
-- 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- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body GNAT.Ctrl_C is
type C_Handler_Type is access procedure;
pragma Convention (C, C_Handler_Type);
Ada_Handler : Handler_Type;
procedure C_Handler;
pragma Convention (C, C_Handler);
procedure C_Handler is
begin
Ada_Handler.all;
end C_Handler;
procedure Install_Handler (Handler : Handler_Type) is
procedure Internal (Handler : C_Handler_Type);
pragma Import (C, Internal, "__gnat_install_int_handler");
begin
Ada_Handler := Handler;
Internal (C_Handler'Access);
end Install_Handler;
end GNAT.Ctrl_C;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2002-2006, AdaCore -- -- Copyright (C) 2002-2007, AdaCore --
-- -- -- --
-- 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- --
...@@ -42,12 +42,6 @@ ...@@ -42,12 +42,6 @@
-- The behavior of this package when using tasking depends on the interaction -- The behavior of this package when using tasking depends on the interaction
-- between sigaction() and the thread library. -- between sigaction() and the thread library.
-- On most implementations, the interaction will be no different whether
-- tasking is involved or not. An exception is GNU/Linux systems where
-- each task/thread is considered as a separate process by the kernel,
-- meaning in particular that a Ctrl-C from the keyboard will be sent to
-- all tasks instead of only one, resulting in multiple calls to the handler.
package GNAT.Ctrl_C is package GNAT.Ctrl_C is
type Handler_Type is access procedure; type Handler_Type is access procedure;
...@@ -63,6 +57,5 @@ package GNAT.Ctrl_C is ...@@ -63,6 +57,5 @@ package GNAT.Ctrl_C is
-- If Install_Handler has never been called, this procedure has no effect. -- If Install_Handler has never been called, this procedure has no effect.
private private
pragma Import (C, Install_Handler, "__gnat_install_int_handler");
pragma Import (C, Uninstall_Handler, "__gnat_uninstall_int_handler"); pragma Import (C, Uninstall_Handler, "__gnat_uninstall_int_handler");
end GNAT.Ctrl_C; end GNAT.Ctrl_C;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1999-2006, AdaCore -- -- Copyright (C) 1999-2007, AdaCore --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL 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- --
...@@ -47,6 +47,9 @@ ...@@ -47,6 +47,9 @@
-- For complete documentation of the operations in this package, please -- For complete documentation of the operations in this package, please
-- consult the VxWorks Programmer's Manual and VxWorks Reference Manual. -- consult the VxWorks Programmer's Manual and VxWorks Reference Manual.
pragma Warnings (Off, "*foreign convention*");
pragma Warnings (Off, "*add Convention pragma*");
with System.VxWorks; with System.VxWorks;
package Interfaces.VxWorks is package Interfaces.VxWorks is
......
...@@ -465,28 +465,109 @@ private ...@@ -465,28 +465,109 @@ private
pragma Inline_Always (Fetch_From_Address); pragma Inline_Always (Fetch_From_Address);
pragma Inline_Always (Assign_To_Address); pragma Inline_Always (Assign_To_Address);
-- Synchronization related subprograms. These are declared to have -- Synchronization related subprograms. Mechanism is explicitly set
-- convention C so that the critical parameters are passed by reference. -- so that the critical parameters are passed by reference.
-- Without this, the parameters are passed by copy, creating load/store -- Without this, the parameters are passed by copy, creating load/store
-- race conditions. We also inline them, since this seems more in the -- race conditions. We also inline them, since this seems more in the
-- spirit of the original (hardware intrinsic) routines. -- spirit of the original (hardware intrinsic) routines.
pragma Convention (C, Clear_Interlocked); pragma Export_Procedure
(Clear_Interlocked,
External => "system__aux_dec__clear_interlocked__1",
Parameter_Types => (Boolean, Boolean),
Mechanism => (Reference, Reference));
pragma Export_Procedure
(Clear_Interlocked,
External => "system__aux_dec__clear_interlocked__2",
Parameter_Types => (Boolean, Boolean, Natural, Boolean),
Mechanism => (Reference, Reference, Value, Reference));
pragma Inline_Always (Clear_Interlocked); pragma Inline_Always (Clear_Interlocked);
pragma Convention (C, Set_Interlocked); pragma Export_Procedure
(Set_Interlocked,
External => "system__aux_dec__set_interlocked__1",
Parameter_Types => (Boolean, Boolean),
Mechanism => (Reference, Reference));
pragma Export_Procedure
(Set_Interlocked,
External => "system__aux_dec__set_interlocked__2",
Parameter_Types => (Boolean, Boolean, Natural, Boolean),
Mechanism => (Reference, Reference, Value, Reference));
pragma Inline_Always (Set_Interlocked); pragma Inline_Always (Set_Interlocked);
pragma Convention (C, Add_Interlocked); pragma Export_Procedure
(Add_Interlocked,
External => "system__aux_dec__add_interlocked__1",
Mechanism => (Value, Reference, Reference));
pragma Inline_Always (Add_Interlocked); pragma Inline_Always (Add_Interlocked);
pragma Convention (C, Add_Atomic); pragma Export_Procedure
(Add_Atomic,
External => "system__aux_dec__add_atomic__1",
Parameter_Types => (Aligned_Integer, Integer),
Mechanism => (Reference, Value));
pragma Export_Procedure
(Add_Atomic,
External => "system__aux_dec__add_atomic__2",
Parameter_Types => (Aligned_Integer, Integer, Natural, Integer, Boolean),
Mechanism => (Reference, Value, Value, Reference, Reference));
pragma Export_Procedure
(Add_Atomic,
External => "system__aux_dec__add_atomic__3",
Parameter_Types => (Aligned_Long_Integer, Long_Integer),
Mechanism => (Reference, Value));
pragma Export_Procedure
(Add_Atomic,
External => "system__aux_dec__add_atomic__4",
Parameter_Types => (Aligned_Long_Integer, Long_Integer, Natural,
Long_Integer, Boolean),
Mechanism => (Reference, Value, Value, Reference, Reference));
pragma Inline_Always (Add_Atomic); pragma Inline_Always (Add_Atomic);
pragma Convention (C, And_Atomic); pragma Export_Procedure
(And_Atomic,
External => "system__aux_dec__and_atomic__1",
Parameter_Types => (Aligned_Integer, Integer),
Mechanism => (Reference, Value));
pragma Export_Procedure
(And_Atomic,
External => "system__aux_dec__and_atomic__2",
Parameter_Types => (Aligned_Integer, Integer, Natural, Integer, Boolean),
Mechanism => (Reference, Value, Value, Reference, Reference));
pragma Export_Procedure
(And_Atomic,
External => "system__aux_dec__and_atomic__3",
Parameter_Types => (Aligned_Long_Integer, Long_Integer),
Mechanism => (Reference, Value));
pragma Export_Procedure
(And_Atomic,
External => "system__aux_dec__and_atomic__4",
Parameter_Types => (Aligned_Long_Integer, Long_Integer, Natural,
Long_Integer, Boolean),
Mechanism => (Reference, Value, Value, Reference, Reference));
pragma Inline_Always (And_Atomic); pragma Inline_Always (And_Atomic);
pragma Convention (C, Or_Atomic); pragma Export_Procedure
(Or_Atomic,
External => "system__aux_dec__or_atomic__1",
Parameter_Types => (Aligned_Integer, Integer),
Mechanism => (Reference, Value));
pragma Export_Procedure
(Or_Atomic,
External => "system__aux_dec__or_atomic__2",
Parameter_Types => (Aligned_Integer, Integer, Natural, Integer, Boolean),
Mechanism => (Reference, Value, Value, Reference, Reference));
pragma Export_Procedure
(Or_Atomic,
External => "system__aux_dec__or_atomic__3",
Parameter_Types => (Aligned_Long_Integer, Long_Integer),
Mechanism => (Reference, Value));
pragma Export_Procedure
(Or_Atomic,
External => "system__aux_dec__or_atomic__4",
Parameter_Types => (Aligned_Long_Integer, Long_Integer, Natural,
Long_Integer, Boolean),
Mechanism => (Reference, Value, Value, Reference, Reference));
pragma Inline_Always (Or_Atomic); pragma Inline_Always (Or_Atomic);
-- Provide proper unchecked conversion definitions for transfer -- Provide proper unchecked conversion definitions for transfer
......
...@@ -455,28 +455,109 @@ private ...@@ -455,28 +455,109 @@ private
pragma Inline_Always (Fetch_From_Address); pragma Inline_Always (Fetch_From_Address);
pragma Inline_Always (Assign_To_Address); pragma Inline_Always (Assign_To_Address);
-- Synchronization related subprograms. These are declared to have -- Synchronization related subprograms. Mechanism is explicitly set
-- convention C so that the critical parameters are passed by reference. -- so that the critical parameters are passed by reference.
-- Without this, the parameters are passed by copy, creating load/store -- Without this, the parameters are passed by copy, creating load/store
-- race conditions. We also inline them, since this seems more in the -- race conditions. We also inline them, since this seems more in the
-- spirit of the original (hardware intrinsic) routines. -- spirit of the original (hardware intrinsic) routines.
pragma Convention (C, Clear_Interlocked); pragma Export_Procedure
(Clear_Interlocked,
External => "system__aux_dec__clear_interlocked__1",
Parameter_Types => (Boolean, Boolean),
Mechanism => (Reference, Reference));
pragma Export_Procedure
(Clear_Interlocked,
External => "system__aux_dec__clear_interlocked__2",
Parameter_Types => (Boolean, Boolean, Natural, Boolean),
Mechanism => (Reference, Reference, Value, Reference));
pragma Inline_Always (Clear_Interlocked); pragma Inline_Always (Clear_Interlocked);
pragma Convention (C, Set_Interlocked); pragma Export_Procedure
(Set_Interlocked,
External => "system__aux_dec__set_interlocked__1",
Parameter_Types => (Boolean, Boolean),
Mechanism => (Reference, Reference));
pragma Export_Procedure
(Set_Interlocked,
External => "system__aux_dec__set_interlocked__2",
Parameter_Types => (Boolean, Boolean, Natural, Boolean),
Mechanism => (Reference, Reference, Value, Reference));
pragma Inline_Always (Set_Interlocked); pragma Inline_Always (Set_Interlocked);
pragma Convention (C, Add_Interlocked); pragma Export_Procedure
(Add_Interlocked,
External => "system__aux_dec__add_interlocked__1",
Mechanism => (Value, Reference, Reference));
pragma Inline_Always (Add_Interlocked); pragma Inline_Always (Add_Interlocked);
pragma Convention (C, Add_Atomic); pragma Export_Procedure
(Add_Atomic,
External => "system__aux_dec__add_atomic__1",
Parameter_Types => (Aligned_Integer, Integer),
Mechanism => (Reference, Value));
pragma Export_Procedure
(Add_Atomic,
External => "system__aux_dec__add_atomic__2",
Parameter_Types => (Aligned_Integer, Integer, Natural, Integer, Boolean),
Mechanism => (Reference, Value, Value, Reference, Reference));
pragma Export_Procedure
(Add_Atomic,
External => "system__aux_dec__add_atomic__3",
Parameter_Types => (Aligned_Long_Integer, Long_Integer),
Mechanism => (Reference, Value));
pragma Export_Procedure
(Add_Atomic,
External => "system__aux_dec__add_atomic__4",
Parameter_Types => (Aligned_Long_Integer, Long_Integer, Natural,
Long_Integer, Boolean),
Mechanism => (Reference, Value, Value, Reference, Reference));
pragma Inline_Always (Add_Atomic); pragma Inline_Always (Add_Atomic);
pragma Convention (C, And_Atomic); pragma Export_Procedure
(And_Atomic,
External => "system__aux_dec__and_atomic__1",
Parameter_Types => (Aligned_Integer, Integer),
Mechanism => (Reference, Value));
pragma Export_Procedure
(And_Atomic,
External => "system__aux_dec__and_atomic__2",
Parameter_Types => (Aligned_Integer, Integer, Natural, Integer, Boolean),
Mechanism => (Reference, Value, Value, Reference, Reference));
pragma Export_Procedure
(And_Atomic,
External => "system__aux_dec__and_atomic__3",
Parameter_Types => (Aligned_Long_Integer, Long_Integer),
Mechanism => (Reference, Value));
pragma Export_Procedure
(And_Atomic,
External => "system__aux_dec__and_atomic__4",
Parameter_Types => (Aligned_Long_Integer, Long_Integer, Natural,
Long_Integer, Boolean),
Mechanism => (Reference, Value, Value, Reference, Reference));
pragma Inline_Always (And_Atomic); pragma Inline_Always (And_Atomic);
pragma Convention (C, Or_Atomic); pragma Export_Procedure
(Or_Atomic,
External => "system__aux_dec__or_atomic__1",
Parameter_Types => (Aligned_Integer, Integer),
Mechanism => (Reference, Value));
pragma Export_Procedure
(Or_Atomic,
External => "system__aux_dec__or_atomic__2",
Parameter_Types => (Aligned_Integer, Integer, Natural, Integer, Boolean),
Mechanism => (Reference, Value, Value, Reference, Reference));
pragma Export_Procedure
(Or_Atomic,
External => "system__aux_dec__or_atomic__3",
Parameter_Types => (Aligned_Long_Integer, Long_Integer),
Mechanism => (Reference, Value));
pragma Export_Procedure
(Or_Atomic,
External => "system__aux_dec__or_atomic__4",
Parameter_Types => (Aligned_Long_Integer, Long_Integer, Natural,
Long_Integer, Boolean),
Mechanism => (Reference, Value, Value, Reference, Reference));
pragma Inline_Always (Or_Atomic); pragma Inline_Always (Or_Atomic);
-- Provide proper unchecked conversion definitions for transfer -- Provide proper unchecked conversion definitions for transfer
......
...@@ -117,6 +117,7 @@ package body System.Interrupts is ...@@ -117,6 +117,7 @@ package body System.Interrupts is
-- that contain interrupt handlers. -- that contain interrupt handlers.
procedure Signal_Handler (Sig : Interrupt_ID); procedure Signal_Handler (Sig : Interrupt_ID);
pragma Convention (C, Signal_Handler);
-- This procedure is used to handle all the signals -- This procedure is used to handle all the signals
-- Type and Head, Tail of the list containing Registered Interrupt -- Type and Head, Tail of the list containing Registered Interrupt
...@@ -142,6 +143,7 @@ package body System.Interrupts is ...@@ -142,6 +143,7 @@ package body System.Interrupts is
-- Always consider a null handler as registered. -- Always consider a null handler as registered.
type Handler_Ptr is access procedure (Sig : Interrupt_ID); type Handler_Ptr is access procedure (Sig : Interrupt_ID);
pragma Convention (C, Handler_Ptr);
function TISR is new Ada.Unchecked_Conversion (Handler_Ptr, isr_address); function TISR is new Ada.Unchecked_Conversion (Handler_Ptr, isr_address);
......
...@@ -59,7 +59,7 @@ package body System.Interrupt_Management is ...@@ -59,7 +59,7 @@ package body System.Interrupt_Management is
Sys_Crembx Sys_Crembx
(Status => Status, (Status => Status,
Prmflg => False, Prmflg => 0,
Chan => Rcv_Interrupt_Chan, Chan => Rcv_Interrupt_Chan,
Maxmsg => Interrupt_ID'Size, Maxmsg => Interrupt_ID'Size,
Bufquo => Interrupt_Bufquo, Bufquo => Interrupt_Bufquo,
......
...@@ -266,6 +266,7 @@ package System.OS_Interface is ...@@ -266,6 +266,7 @@ package System.OS_Interface is
type Thread_Body is access type Thread_Body is access
function (arg : System.Address) return System.Address; function (arg : System.Address) return System.Address;
pragma Convention (C, Thread_Body);
function Thread_Body_Access is new function Thread_Body_Access is new
Ada.Unchecked_Conversion (System.Address, Thread_Body); Ada.Unchecked_Conversion (System.Address, Thread_Body);
...@@ -506,8 +507,8 @@ package System.OS_Interface is ...@@ -506,8 +507,8 @@ package System.OS_Interface is
function pthread_getspecific (key : pthread_key_t) return System.Address; function pthread_getspecific (key : pthread_key_t) return System.Address;
pragma Import (C, pthread_getspecific, "pthread_getspecific"); pragma Import (C, pthread_getspecific, "pthread_getspecific");
type destructor_pointer is access type destructor_pointer is access procedure (arg : System.Address);
procedure (arg : System.Address); pragma Convention (C, destructor_pointer);
function pthread_key_create function pthread_key_create
(key : access pthread_key_t; (key : access pthread_key_t;
......
...@@ -239,6 +239,8 @@ package System.OS_Interface is ...@@ -239,6 +239,8 @@ package System.OS_Interface is
type Thread_Body is access type Thread_Body is access
function (arg : System.Address) return System.Address; function (arg : System.Address) return System.Address;
pragma Convention (C, Thread_Body);
type pthread_t is private; type pthread_t is private;
subtype Thread_Id is pthread_t; subtype Thread_Id is pthread_t;
...@@ -475,6 +477,7 @@ package System.OS_Interface is ...@@ -475,6 +477,7 @@ package System.OS_Interface is
pragma Import (C, pthread_getspecific, "pthread_getspecific"); pragma Import (C, pthread_getspecific, "pthread_getspecific");
type destructor_pointer is access procedure (arg : System.Address); type destructor_pointer is access procedure (arg : System.Address);
pragma Convention (C, destructor_pointer);
function pthread_key_create function pthread_key_create
(key : access pthread_key_t; (key : access pthread_key_t;
......
...@@ -267,6 +267,7 @@ package System.OS_Interface is ...@@ -267,6 +267,7 @@ package System.OS_Interface is
type Thread_Body is access type Thread_Body is access
function (arg : System.Address) return System.Address; function (arg : System.Address) return System.Address;
pragma Convention (C, Thread_Body);
function Thread_Body_Access is new function Thread_Body_Access is new
Ada.Unchecked_Conversion (System.Address, Thread_Body); Ada.Unchecked_Conversion (System.Address, Thread_Body);
...@@ -572,8 +573,8 @@ package System.OS_Interface is ...@@ -572,8 +573,8 @@ package System.OS_Interface is
function pthread_getspecific (key : pthread_key_t) return System.Address; function pthread_getspecific (key : pthread_key_t) return System.Address;
pragma Import (C, pthread_getspecific, "pthread_getspecific"); pragma Import (C, pthread_getspecific, "pthread_getspecific");
type destructor_pointer is access type destructor_pointer is access procedure (arg : System.Address);
procedure (arg : System.Address); pragma Convention (C, destructor_pointer);
function pthread_key_create function pthread_key_create
(key : access pthread_key_t; (key : access pthread_key_t;
......
...@@ -133,6 +133,7 @@ package System.OS_Interface is ...@@ -133,6 +133,7 @@ package System.OS_Interface is
type sigset_t is private; type sigset_t is private;
type isr_address is access procedure (sig : int); type isr_address is access procedure (sig : int);
pragma Convention (C, isr_address);
function intr_attach (sig : int; handler : isr_address) return long; function intr_attach (sig : int; handler : isr_address) return long;
...@@ -238,6 +239,7 @@ package System.OS_Interface is ...@@ -238,6 +239,7 @@ package System.OS_Interface is
type Thread_Body is access type Thread_Body is access
function (arg : System.Address) return System.Address; function (arg : System.Address) return System.Address;
pragma Convention (C, Thread_Body);
function Thread_Body_Access is new function Thread_Body_Access is new
Ada.Unchecked_Conversion (System.Address, Thread_Body); Ada.Unchecked_Conversion (System.Address, Thread_Body);
...@@ -426,6 +428,7 @@ package System.OS_Interface is ...@@ -426,6 +428,7 @@ package System.OS_Interface is
-- DCE_THREADS has a nonstandard pthread_getspecific -- DCE_THREADS has a nonstandard pthread_getspecific
type destructor_pointer is access procedure (arg : System.Address); type destructor_pointer is access procedure (arg : System.Address);
pragma Convention (C, destructor_pointer);
function pthread_key_create function pthread_key_create
(key : access pthread_key_t; (key : access pthread_key_t;
......
...@@ -256,6 +256,7 @@ package System.OS_Interface is ...@@ -256,6 +256,7 @@ package System.OS_Interface is
type Thread_Body is access type Thread_Body is access
function (arg : System.Address) return System.Address; function (arg : System.Address) return System.Address;
pragma Convention (C, Thread_Body);
function Thread_Body_Access is new function Thread_Body_Access is new
Ada.Unchecked_Conversion (System.Address, Thread_Body); Ada.Unchecked_Conversion (System.Address, Thread_Body);
...@@ -489,6 +490,7 @@ package System.OS_Interface is ...@@ -489,6 +490,7 @@ package System.OS_Interface is
pragma Import (C, pthread_getspecific, "pthread_getspecific"); pragma Import (C, pthread_getspecific, "pthread_getspecific");
type destructor_pointer is access procedure (arg : System.Address); type destructor_pointer is access procedure (arg : System.Address);
pragma Convention (C, destructor_pointer);
function pthread_key_create function pthread_key_create
(key : access pthread_key_t; (key : access pthread_key_t;
......
...@@ -243,6 +243,7 @@ package System.OS_Interface is ...@@ -243,6 +243,7 @@ package System.OS_Interface is
type Thread_Body is access type Thread_Body is access
function (arg : System.Address) return System.Address; function (arg : System.Address) return System.Address;
pragma Convention (C, Thread_Body);
function Thread_Body_Access is new function Thread_Body_Access is new
Ada.Unchecked_Conversion (System.Address, Thread_Body); Ada.Unchecked_Conversion (System.Address, Thread_Body);
...@@ -445,6 +446,7 @@ package System.OS_Interface is ...@@ -445,6 +446,7 @@ package System.OS_Interface is
pragma Import (C, pthread_getspecific, "pthread_getspecific"); pragma Import (C, pthread_getspecific, "pthread_getspecific");
type destructor_pointer is access procedure (arg : System.Address); type destructor_pointer is access procedure (arg : System.Address);
pragma Convention (C, destructor_pointer);
function pthread_key_create function pthread_key_create
(key : access pthread_key_t; (key : access pthread_key_t;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
-- (GNU/Linux-HPPA Version) -- -- (GNU/Linux-HPPA Version) --
-- -- -- --
-- Copyright (C) 1991-1994, Florida State University -- -- Copyright (C) 1991-1994, Florida State University --
-- Copyright (C) 1995-2007, Free Software Foundation, Inc. -- -- Copyright (C) 1995-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL 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- --
...@@ -255,7 +255,7 @@ package System.OS_Interface is ...@@ -255,7 +255,7 @@ package System.OS_Interface is
function To_Target_Priority function To_Target_Priority
(Prio : System.Any_Priority) return Interfaces.C.int; (Prio : System.Any_Priority) return Interfaces.C.int;
-- Maps System.Any_Priority to a POSIX priority. -- Maps System.Any_Priority to a POSIX priority
------------- -------------
-- Process -- -- Process --
...@@ -275,6 +275,7 @@ package System.OS_Interface is ...@@ -275,6 +275,7 @@ package System.OS_Interface is
type Thread_Body is access type Thread_Body is access
function (arg : System.Address) return System.Address; function (arg : System.Address) return System.Address;
pragma Convention (C, Thread_Body);
function Thread_Body_Access is new function Thread_Body_Access is new
Ada.Unchecked_Conversion (System.Address, Thread_Body); Ada.Unchecked_Conversion (System.Address, Thread_Body);
...@@ -455,6 +456,7 @@ package System.OS_Interface is ...@@ -455,6 +456,7 @@ package System.OS_Interface is
pragma Import (C, pthread_getspecific, "pthread_getspecific"); pragma Import (C, pthread_getspecific, "pthread_getspecific");
type destructor_pointer is access procedure (arg : System.Address); type destructor_pointer is access procedure (arg : System.Address);
pragma Convention (C, destructor_pointer);
function pthread_key_create function pthread_key_create
(key : access pthread_key_t; (key : access pthread_key_t;
......
...@@ -211,7 +211,7 @@ package System.OS_Interface is ...@@ -211,7 +211,7 @@ package System.OS_Interface is
function To_Target_Priority function To_Target_Priority
(Prio : System.Any_Priority) return Interfaces.C.int; (Prio : System.Any_Priority) return Interfaces.C.int;
-- Maps System.Any_Priority to a POSIX priority. -- Maps System.Any_Priority to a POSIX priority
------------- -------------
-- Process -- -- Process --
...@@ -241,6 +241,7 @@ package System.OS_Interface is ...@@ -241,6 +241,7 @@ package System.OS_Interface is
type Thread_Body is access type Thread_Body is access
function (arg : System.Address) return System.Address; function (arg : System.Address) return System.Address;
pragma Convention (C, Thread_Body);
function Thread_Body_Access is new function Thread_Body_Access is new
Ada.Unchecked_Conversion (System.Address, Thread_Body); Ada.Unchecked_Conversion (System.Address, Thread_Body);
...@@ -266,7 +267,7 @@ package System.OS_Interface is ...@@ -266,7 +267,7 @@ package System.OS_Interface is
----------- -----------
Stack_Base_Available : constant Boolean := False; Stack_Base_Available : constant Boolean := False;
-- Indicates wether the stack base is available on this target. -- Indicates wether the stack base is available on this target
function Get_Stack_Base (thread : pthread_t) return Address; function Get_Stack_Base (thread : pthread_t) return Address;
pragma Inline (Get_Stack_Base); pragma Inline (Get_Stack_Base);
...@@ -484,6 +485,7 @@ package System.OS_Interface is ...@@ -484,6 +485,7 @@ package System.OS_Interface is
-- LynxOS has a non standard pthread_getspecific -- LynxOS has a non standard pthread_getspecific
type destructor_pointer is access procedure (arg : System.Address); type destructor_pointer is access procedure (arg : System.Address);
pragma Convention (C, destructor_pointer);
function pthread_key_create function pthread_key_create
(key : access pthread_key_t; (key : access pthread_key_t;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1991-1994, Florida State University -- -- Copyright (C) 1991-1994, Florida State University --
-- Copyright (C) 1995-2007, Free Software Foundation, Inc. -- -- Copyright (C) 1995-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL 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- --
...@@ -253,6 +253,7 @@ package System.OS_Interface is ...@@ -253,6 +253,7 @@ package System.OS_Interface is
type Thread_Body is access type Thread_Body is access
function (arg : System.Address) return System.Address; function (arg : System.Address) return System.Address;
pragma Convention (C, Thread_Body);
function Thread_Body_Access is new function Thread_Body_Access is new
Ada.Unchecked_Conversion (System.Address, Thread_Body); Ada.Unchecked_Conversion (System.Address, Thread_Body);
...@@ -275,7 +276,7 @@ package System.OS_Interface is ...@@ -275,7 +276,7 @@ package System.OS_Interface is
----------- -----------
Stack_Base_Available : constant Boolean := False; Stack_Base_Available : constant Boolean := False;
-- Indicates whether the stack base is available on this target. -- Indicates whether the stack base is available on this target
function Get_Stack_Base (thread : pthread_t) return Address; function Get_Stack_Base (thread : pthread_t) return Address;
pragma Inline (Get_Stack_Base); pragma Inline (Get_Stack_Base);
...@@ -484,6 +485,7 @@ package System.OS_Interface is ...@@ -484,6 +485,7 @@ package System.OS_Interface is
pragma Import (C, st_getspecific, "st_getspecific"); pragma Import (C, st_getspecific, "st_getspecific");
type destructor_pointer is access procedure (arg : System.Address); type destructor_pointer is access procedure (arg : System.Address);
pragma Convention (C, destructor_pointer);
function st_keycreate function st_keycreate
(destructor : destructor_pointer; (destructor : destructor_pointer;
......
...@@ -133,6 +133,7 @@ package System.OS_Interface is ...@@ -133,6 +133,7 @@ package System.OS_Interface is
type sigset_t is private; type sigset_t is private;
type isr_address is access procedure (sig : int); type isr_address is access procedure (sig : int);
pragma Convention (C, isr_address);
function intr_attach (sig : int; handler : isr_address) return long; function intr_attach (sig : int; handler : isr_address) return long;
pragma Import (C, intr_attach, "signal"); pragma Import (C, intr_attach, "signal");
...@@ -206,6 +207,7 @@ package System.OS_Interface is ...@@ -206,6 +207,7 @@ package System.OS_Interface is
type Thread_Body is access type Thread_Body is access
function (arg : System.Address) return System.Address; function (arg : System.Address) return System.Address;
pragma Convention (C, Thread_Body);
function Thread_Body_Access is new function Thread_Body_Access is new
Ada.Unchecked_Conversion (System.Address, Thread_Body); Ada.Unchecked_Conversion (System.Address, Thread_Body);
......
...@@ -220,7 +220,7 @@ package System.OS_Interface is ...@@ -220,7 +220,7 @@ package System.OS_Interface is
function To_Target_Priority function To_Target_Priority
(Prio : System.Any_Priority) return Interfaces.C.int; (Prio : System.Any_Priority) return Interfaces.C.int;
-- Maps System.Any_Priority to a POSIX priority. -- Maps System.Any_Priority to a POSIX priority
------------- -------------
-- Process -- -- Process --
...@@ -247,6 +247,7 @@ package System.OS_Interface is ...@@ -247,6 +247,7 @@ package System.OS_Interface is
type Thread_Body is access type Thread_Body is access
function (arg : System.Address) return System.Address; function (arg : System.Address) return System.Address;
pragma Convention (C, Thread_Body);
function Thread_Body_Access is new function Thread_Body_Access is new
Ada.Unchecked_Conversion (System.Address, Thread_Body); Ada.Unchecked_Conversion (System.Address, Thread_Body);
...@@ -271,7 +272,7 @@ package System.OS_Interface is ...@@ -271,7 +272,7 @@ package System.OS_Interface is
----------- -----------
Stack_Base_Available : constant Boolean := False; Stack_Base_Available : constant Boolean := False;
-- Indicates whether the stack base is available on this target. -- Indicates whether the stack base is available on this target
function Get_Stack_Base (thread : pthread_t) return Address; function Get_Stack_Base (thread : pthread_t) return Address;
pragma Inline (Get_Stack_Base); pragma Inline (Get_Stack_Base);
...@@ -477,6 +478,7 @@ package System.OS_Interface is ...@@ -477,6 +478,7 @@ package System.OS_Interface is
pragma Import (C, pthread_getspecific, "pthread_getspecific"); pragma Import (C, pthread_getspecific, "pthread_getspecific");
type destructor_pointer is access procedure (arg : System.Address); type destructor_pointer is access procedure (arg : System.Address);
pragma Convention (C, destructor_pointer);
function pthread_key_create function pthread_key_create
(key : access pthread_key_t; (key : access pthread_key_t;
......
...@@ -299,6 +299,7 @@ package System.OS_Interface is ...@@ -299,6 +299,7 @@ package System.OS_Interface is
type Thread_Body is access type Thread_Body is access
function (arg : System.Address) return System.Address; function (arg : System.Address) return System.Address;
pragma Convention (C, Thread_Body);
function Thread_Body_Access is new function Thread_Body_Access is new
Ada.Unchecked_Conversion (System.Address, Thread_Body); Ada.Unchecked_Conversion (System.Address, Thread_Body);
......
...@@ -247,6 +247,7 @@ package System.OS_Interface is ...@@ -247,6 +247,7 @@ package System.OS_Interface is
type Thread_Body is access type Thread_Body is access
function (arg : System.Address) return System.Address; function (arg : System.Address) return System.Address;
pragma Convention (C, Thread_Body);
function Thread_Body_Access is new function Thread_Body_Access is new
Ada.Unchecked_Conversion (System.Address, Thread_Body); Ada.Unchecked_Conversion (System.Address, Thread_Body);
...@@ -484,6 +485,7 @@ package System.OS_Interface is ...@@ -484,6 +485,7 @@ package System.OS_Interface is
pragma Import (C, pthread_getspecific, "__pthread_getspecific"); pragma Import (C, pthread_getspecific, "__pthread_getspecific");
type destructor_pointer is access procedure (arg : System.Address); type destructor_pointer is access procedure (arg : System.Address);
pragma Convention (C, destructor_pointer);
function pthread_key_create function pthread_key_create
(key : access pthread_key_t; (key : access pthread_key_t;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1991-1994, Florida State University -- -- Copyright (C) 1991-1994, Florida State University --
-- Copyright (C) 1995-2007, Free Software Foundation, Inc. -- -- Copyright (C) 1995-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL 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- --
...@@ -42,12 +42,13 @@ ...@@ -42,12 +42,13 @@
with Interfaces.C; with Interfaces.C;
with Ada.Unchecked_Conversion; with Ada.Unchecked_Conversion;
with System.Aux_DEC;
package System.OS_Interface is package System.OS_Interface is
pragma Preelaborate; pragma Preelaborate;
pragma Linker_Options ("--for-linker=sys$library:pthread$rtl.exe"); pragma Linker_Options ("--for-linker=sys$library:pthread$rtl.exe");
-- Link in the DEC threads library. -- Link in the DEC threads library
-- pragma Linker_Options ("--for-linker=/threads_enable"); -- pragma Linker_Options ("--for-linker=/threads_enable");
-- Enable upcalls and multiple kernel threads. -- Enable upcalls and multiple kernel threads.
...@@ -80,7 +81,7 @@ package System.OS_Interface is ...@@ -80,7 +81,7 @@ package System.OS_Interface is
subtype Interrupt_Number_Type is unsigned_long; subtype Interrupt_Number_Type is unsigned_long;
-- OpenVMS system services return values of type Cond_Value_Type. -- OpenVMS system services return values of type Cond_Value_Type
subtype Cond_Value_Type is unsigned_long; subtype Cond_Value_Type is unsigned_long;
subtype Short_Cond_Value_Type is unsigned_short; subtype Short_Cond_Value_Type is unsigned_short;
...@@ -92,6 +93,7 @@ package System.OS_Interface is ...@@ -92,6 +93,7 @@ package System.OS_Interface is
end record; end record;
type AST_Handler is access procedure (Param : Address); type AST_Handler is access procedure (Param : Address);
pragma Convention (C, AST_Handler);
No_AST_Handler : constant AST_Handler := null; No_AST_Handler : constant AST_Handler := null;
CMB_M_READONLY : constant := 16#00000001#; CMB_M_READONLY : constant := 16#00000001#;
...@@ -173,7 +175,7 @@ package System.OS_Interface is ...@@ -173,7 +175,7 @@ package System.OS_Interface is
-- --
procedure Sys_Crembx procedure Sys_Crembx
(Status : out Cond_Value_Type; (Status : out Cond_Value_Type;
Prmflg : Boolean; Prmflg : unsigned_char;
Chan : out unsigned_short; Chan : out unsigned_short;
Maxmsg : unsigned_long := 0; Maxmsg : unsigned_long := 0;
Bufquo : unsigned_long := 0; Bufquo : unsigned_long := 0;
...@@ -184,7 +186,7 @@ package System.OS_Interface is ...@@ -184,7 +186,7 @@ package System.OS_Interface is
pragma Interface (External, Sys_Crembx); pragma Interface (External, Sys_Crembx);
pragma Import_Valued_Procedure pragma Import_Valued_Procedure
(Sys_Crembx, "SYS$CREMBX", (Sys_Crembx, "SYS$CREMBX",
(Cond_Value_Type, Boolean, unsigned_short, (Cond_Value_Type, unsigned_char, unsigned_short,
unsigned_long, unsigned_long, unsigned_short, unsigned_long, unsigned_long, unsigned_short,
unsigned_short, String, unsigned_long), unsigned_short, String, unsigned_long),
(Value, Value, Reference, (Value, Value, Reference,
...@@ -360,9 +362,10 @@ package System.OS_Interface is ...@@ -360,9 +362,10 @@ package System.OS_Interface is
type Thread_Body is access type Thread_Body is access
function (arg : System.Address) return System.Address; function (arg : System.Address) return System.Address;
pragma Convention (C, Thread_Body);
function Thread_Body_Access is new function Thread_Body_Access is new
Ada.Unchecked_Conversion (System.Address, Thread_Body); Ada.Unchecked_Conversion (System.Aux_DEC.Short_Address, Thread_Body);
type pthread_t is private; type pthread_t is private;
subtype Thread_Id is pthread_t; subtype Thread_Id is pthread_t;
...@@ -569,6 +572,7 @@ package System.OS_Interface is ...@@ -569,6 +572,7 @@ package System.OS_Interface is
pragma Import (C, pthread_getspecific, "PTHREAD_GETSPECIFIC"); pragma Import (C, pthread_getspecific, "PTHREAD_GETSPECIFIC");
type destructor_pointer is access procedure (arg : System.Address); type destructor_pointer is access procedure (arg : System.Address);
pragma Convention (C, destructor_pointer);
function pthread_key_create function pthread_key_create
(key : access pthread_key_t; (key : access pthread_key_t;
......
...@@ -137,6 +137,7 @@ package System.OS_Interface is ...@@ -137,6 +137,7 @@ package System.OS_Interface is
pragma Import (C, sigaction, "sigaction"); pragma Import (C, sigaction, "sigaction");
type isr_address is access procedure (sig : int); type isr_address is access procedure (sig : int);
pragma Convention (C, isr_address);
function c_signal (sig : Signal; handler : isr_address) return isr_address; function c_signal (sig : Signal; handler : isr_address) return isr_address;
pragma Import (C, c_signal, "signal"); pragma Import (C, c_signal, "signal");
......
...@@ -179,6 +179,7 @@ package System.OS_Interface is ...@@ -179,6 +179,7 @@ package System.OS_Interface is
pragma Import (C, sigaction, "sigaction"); pragma Import (C, sigaction, "sigaction");
type isr_address is access procedure (sig : int); type isr_address is access procedure (sig : int);
pragma Convention (C, isr_address);
function c_signal (sig : Signal; handler : isr_address) return isr_address; function c_signal (sig : Signal; handler : isr_address) return isr_address;
pragma Import (C, c_signal, "signal"); pragma Import (C, c_signal, "signal");
......
...@@ -54,6 +54,9 @@ with System.Soft_Links; ...@@ -54,6 +54,9 @@ with System.Soft_Links;
-- used for Get_Exc_Stack_Addr -- used for Get_Exc_Stack_Addr
-- Abort_Defer/Undefer -- Abort_Defer/Undefer
with System.Aux_DEC;
-- used for Short_Address
with Ada.Unchecked_Conversion; with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation; with Ada.Unchecked_Deallocation;
...@@ -147,6 +150,7 @@ package body System.Task_Primitives.Operations is ...@@ -147,6 +150,7 @@ package body System.Task_Primitives.Operations is
-- Replace System.Soft_Links.Get_Exc_Stack_Addr_NT -- Replace System.Soft_Links.Get_Exc_Stack_Addr_NT
procedure Timer_Sleep_AST (ID : Address); procedure Timer_Sleep_AST (ID : Address);
pragma Convention (C, Timer_Sleep_AST);
-- Signal the condition variable when AST fires -- Signal the condition variable when AST fires
procedure Timer_Sleep_AST (ID : Address) is procedure Timer_Sleep_AST (ID : Address) is
...@@ -822,7 +826,7 @@ package body System.Task_Primitives.Operations is ...@@ -822,7 +826,7 @@ package body System.Task_Primitives.Operations is
Result : Interfaces.C.int; Result : Interfaces.C.int;
function Thread_Body_Access is new function Thread_Body_Access is new
Ada.Unchecked_Conversion (System.Address, Thread_Body); Ada.Unchecked_Conversion (System.Aux_DEC.Short_Address, Thread_Body);
begin begin
-- Since the initial signal mask of a thread is inherited from the -- Since the initial signal mask of a thread is inherited from the
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2000-2005 Free Software Foundation, Inc. -- -- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL 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- --
...@@ -38,6 +38,7 @@ with System.Aux_DEC; ...@@ -38,6 +38,7 @@ with System.Aux_DEC;
package System.Task_Primitives.Operations.DEC is package System.Task_Primitives.Operations.DEC is
procedure Interrupt_AST_Handler (ID : Address); procedure Interrupt_AST_Handler (ID : Address);
pragma Convention (C, Interrupt_AST_Handler);
-- Handles the AST for Ada95 Interrupts. -- Handles the AST for Ada95 Interrupts.
procedure RMS_AST_Handler (ID : Address); procedure RMS_AST_Handler (ID : Address);
......
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