aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/ctrl_c.c
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2013-04-12 15:42:39 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2013-04-12 15:42:39 +0200
commit4bc0caddeb318b227247b79da3ce9a5c456a12d0 (patch)
treed71967352feccf0d8a131039933b470ed8386628 /gcc/ada/ctrl_c.c
parentb69cd36a46e574d92de18e1ede3d31e951ccf30e (diff)
downloadgcc-4bc0caddeb318b227247b79da3ce9a5c456a12d0.zip
gcc-4bc0caddeb318b227247b79da3ce9a5c456a12d0.tar.gz
gcc-4bc0caddeb318b227247b79da3ce9a5c456a12d0.tar.bz2
[multiple changes]
2013-04-12 Doug Rupp <rupp@adacore.com> * init.c (SS$_CONTROLC, SS$_CONTINUE) [VMS]: New macros. (__gnat_handle_vms_condition) [VMS]: Dispatch on the Crtl/C user handler if installed. * ctrl_c.c (__gnat_install_int_handler) [VMS]: Install a dummy sigaction handler to trigger the real user handler dispatch in init.c/__gnat_handle_vms_condition. (__gnat_uninstall_int_handler) [VMS]: Likewise. 2013-04-12 Vincent Celier <celier@adacore.com> * clean.adb (Parse_Cmd_Line): Set Directories_Must_Exist_In_Projects to False if switch is specified. * makeutl.adb (Initialize_Source_Record): Do not look for the object file if there is no object directory. * opt.ads (Directories_Must_Exist_In_Projects): New Boolean variable, defaulted to True. * prj-nmsc.adb (Check_Library_Attributes): Do not fail if library directory does not exist when Directories_Must_Exist_In_Projects is False. (Get_Directories): Do not fail when the object or the exec directory do not exist when Directories_Must_Exist_In_Projects is False. From-SVN: r197918
Diffstat (limited to 'gcc/ada/ctrl_c.c')
-rw-r--r--gcc/ada/ctrl_c.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/gcc/ada/ctrl_c.c b/gcc/ada/ctrl_c.c
index a860b76..7f8d177 100644
--- a/gcc/ada/ctrl_c.c
+++ b/gcc/ada/ctrl_c.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 2002-2009, Free Software Foundation, Inc. *
+ * Copyright (C) 2002-2013, Free Software Foundation, Inc. *
* *
* 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- *
@@ -50,7 +50,24 @@ void __gnat_uninstall_int_handler (void);
/* POSIX implementation */
#if (defined (__unix__) || defined (_AIX) || defined (__APPLE__)) \
- && !defined (__vxworks)
+ || defined (VMS) && !defined (__vxworks)
+
+#ifdef VMS
+/* On VMS _gnat_handle_vms_condition gets control first, and it has to
+ resignal the Ctrl/C in order for sigaction to gain control and execute
+ the user handler routine, but in doing so propagates the condition
+ causing the program to terminate. So instead we install a dummy handler
+ routine and put the real user handler in a special global variable so
+ that __gnat_handle_vms_condition can declare an AST to asynchronously
+ execute the Ctrl/C user handler at some future time and allow
+ __gnat_handle_vms_condition to return and not be held up waiting for
+ the potentially unbounded time required to execute the Crtl/C handler. */
+void
+dummy_handler () {}
+
+/* Lives in init.c. */
+extern void (*__gnat_ctrl_c_handler) (void);
+#endif
#include <signal.h>
@@ -75,8 +92,8 @@ __gnat_install_int_handler (void (*proc) (void))
if (sigint_intercepted == 0)
{
act.sa_handler = __gnat_int_handler;
-#if defined (__Lynx__)
- /* LynxOS does not support SA_RESTART. */
+#if defined (__Lynx__) || defined (VMS)
+ /* LynxOS and VMS do not support SA_RESTART. */
act.sa_flags = 0;
#else
act.sa_flags = SA_RESTART;
@@ -85,7 +102,12 @@ __gnat_install_int_handler (void (*proc) (void))
sigaction (SIGINT, &act, &original_act);
}
+#ifdef VMS
+ sigint_intercepted = &dummy_handler;
+ __gnat_ctrl_c_handler = proc;
+#else
sigint_intercepted = proc;
+#endif
}
/* Restore original handler */
@@ -98,6 +120,10 @@ __gnat_uninstall_int_handler (void)
sigaction (SIGINT, &original_act, 0);
sigint_intercepted = 0;
}
+#ifdef VMS
+ if (__gnat_ctrl_c_handler)
+ __gnat_ctrl_c_handler = 0;
+#endif
}
/* Windows implementation */