]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Simplify GNATmake by reusing GNAT.Ctrl_C
authorPiotr Trojanek <trojanek@adacore.com>
Tue, 12 Jan 2021 10:24:23 +0000 (11:24 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 5 May 2021 08:19:02 +0000 (04:19 -0400)
gcc/ada/

* make.adb (Make): Use GNAT.Ctrl_C.Install_Handler instead of a
custom imported procedure.

gcc/ada/make.adb

index 374ca057312cf3784ab4f39dc5fa312d401e7bac..9ddc7ccc636f49f6616a38ef72a8bd80aff61a15 100644 (file)
@@ -61,6 +61,7 @@ with Ada.Directories;
 with Ada.Exceptions;   use Ada.Exceptions;
 
 with GNAT.Command_Line;         use GNAT.Command_Line;
+with GNAT.Ctrl_C;
 with GNAT.Directory_Operations; use GNAT.Directory_Operations;
 with GNAT.OS_Lib;               use GNAT.OS_Lib;
 
@@ -76,15 +77,7 @@ package body Make is
    --  is not always explicit and considering it is important when -f and -a
    --  are used.
 
-   type Sigint_Handler is access procedure;
-   pragma Convention (C, Sigint_Handler);
-
-   procedure Install_Int_Handler (Handler : Sigint_Handler);
-   pragma Import (C, Install_Int_Handler, "__gnat_install_int_handler");
-   --  Called by Gnatmake to install the SIGINT handler below
-
    procedure Sigint_Intercepted;
-   pragma Convention (C, Sigint_Intercepted);
    pragma No_Return (Sigint_Intercepted);
    --  Called when the program is interrupted by Ctrl-C to delete the
    --  temporary mapping files and configuration pragmas files.
@@ -3322,7 +3315,7 @@ package body Make is
       pragma Warnings (Off, Discard);
 
    begin
-      Install_Int_Handler (Sigint_Intercepted'Access);
+      GNAT.Ctrl_C.Install_Handler (Sigint_Intercepted'Access);
 
       Do_Compile_Step := True;
       Do_Bind_Step    := True;