diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-12-13 10:19:04 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-12-13 10:19:04 +0000 |
commit | ff84c916d0b0a60f7b83fbe7729b275b9d6abcc2 (patch) | |
tree | 2d7d450cb2b59f3695b897cfe5157b878e24aa40 /gcc/ada/g-ctrl_c.adb | |
parent | e2a33c1825a7cbbb0061b24d7fccf70c172ddd5e (diff) | |
download | gcc-ff84c916d0b0a60f7b83fbe7729b275b9d6abcc2.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130813 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/g-ctrl_c.adb')
-rw-r--r-- | gcc/ada/g-ctrl_c.adb | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/gcc/ada/g-ctrl_c.adb b/gcc/ada/g-ctrl_c.adb new file mode 100644 index 00000000000..17b1a9fda85 --- /dev/null +++ b/gcc/ada/g-ctrl_c.adb @@ -0,0 +1,57 @@ +------------------------------------------------------------------------------ +-- -- +-- 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; |