+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
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;
/* 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;