[Ada] Fix thinko in QNX's implementation of __gnat_install_handler
authorJoel Brobecker <brobecker@adacore.com>
Fri, 11 Mar 2022 04:22:34 +0000 (04:22 +0000)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 16 May 2022 08:42:05 +0000 (08:42 +0000)
commit839e7f16abda3fd8bd46d59ff1521d402d328a24
tree48ea4aac57af73f537c49ad07d7a266d28e58597
parent9abb17d9fad628a237136b3348ca33f189d2ad2b
[Ada] Fix thinko in QNX's implementation of __gnat_install_handler

On QNX, the sigaction handler is incorrectly installed via the
sa_handler field of struct sigaction, rather than the sa_sigaction
field. This triggers a compilation warning due to a mismatch between the
function's signature and the field's type.

    | init.c:2614:18: warning: assignment to 'void (*)(int)'
    | from incompatible pointer type 'void (*)(int,  siginfo_t *, void *)'
    | {aka 'void (*)(int,  struct _siginfo *, void *)'}
    | [-Wincompatible-pointer-types]

In practice, using the sa_handler field actually works, but only because
those two fields are inside a union:

    From target/qnx7/usr/include/signal.h:
    | union { \
    |     __handler_type  _sa_handler; \
    |     __action_type   _sa_sigaction; \
    |     } __sa_un; \

This commit fixes this.

gcc/ada/

* init.c (__gnat_install_handler) [__QNX__]: Set
act.sa_sigaction rather than act.sa_handler.
gcc/ada/init.c