aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2011-07-28 13:40:51 +0000
committerRainer Orth <ro@gcc.gnu.org>2011-07-28 13:40:51 +0000
commit6da2ca7d777504705c984379a2d0376d194b9dbf (patch)
treef906cd8c3111f2aab1c13ad8c4e16c541fd155f9 /gcc/ada
parent40b9321d846877a8c56f0cbda91ab977d982d527 (diff)
downloadgcc-6da2ca7d777504705c984379a2d0376d194b9dbf.zip
gcc-6da2ca7d777504705c984379a2d0376d194b9dbf.tar.gz
gcc-6da2ca7d777504705c984379a2d0376d194b9dbf.tar.bz2
init.c (__gnat_error_handler): Cast reason to int.
* init.c (__gnat_error_handler): Cast reason to int. (__gnat_install_handler): Explain sa_sigaction use. From-SVN: r176870
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/init.c12
2 files changed, 15 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index d91f54f..3ca191c 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2011-07-28 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * init.c (__gnat_error_handler): Cast reason to int.
+ (__gnat_install_handler): Explain sa_sigaction use.
+
2011-07-24 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Subprogram_Type>: If the
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index b46cafd..52d7755 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -787,7 +787,11 @@ extern struct Exception_Data _abort_signal;
static void
__gnat_error_handler (int sig, siginfo_t *reason, void *uc ATTRIBUTE_UNUSED)
{
- int code = reason == NULL ? 0 : reason->si_code;
+ /* This handler is installed with SA_SIGINFO cleared, but there's no
+ prototype for the resulting alternative three-argument form, so we
+ have to hack around this by casting reason to the int actually
+ passed. */
+ int code = (int) reason;
struct Exception_Data *exception;
const char *msg;
@@ -872,7 +876,11 @@ __gnat_install_handler (void)
/* Setup signal handler to map synchronous signals to appropriate
exceptions. Make sure that the handler isn't interrupted by another
- signal that might cause a scheduling event! */
+ signal that might cause a scheduling event!
+
+ The handler is installed with SA_SIGINFO cleared, but there's no
+ C++ prototype for the three-argument form, so fake it by using
+ sa_sigaction and casting the arguments instead. */
act.sa_sigaction = __gnat_error_handler;
act.sa_flags = SA_NODEFER + SA_RESTART;