Changeset 1f68d5d for src


Ignore:
Timestamp:
Jun 1, 2021, 2:22:37 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
bc179fd3
Parents:
68ff3de
Message:

Changed signal handling to avoid incompatible pointer cast

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main.cc

    r68ff3de r1f68d5d  
    160160#define SIGPARMS int sig __attribute__(( unused )), siginfo_t * sfp __attribute__(( unused )), ucontext_t * cxt __attribute__(( unused ))
    161161
    162 static void Signal( int sig, void (* handler)(SIGPARMS), int flags ) {
    163         struct sigaction act;
    164 
    165         act.sa_sigaction = (void (*)(int, siginfo_t *, void *))handler;
     162static void _Signal(struct sigaction & act, int sig, int flags ) {
    166163        act.sa_flags = flags;
    167164
     
    170167            _exit( EXIT_FAILURE );
    171168        } // if
     169}
     170
     171static void Signal( int sig, void (* handler)(SIGPARMS), int flags ) {
     172        struct sigaction act;
     173        act.sa_sigaction = (void (*)(int, siginfo_t *, void *))handler;
     174        _Signal(act, sig, flags);
     175} // Signal
     176
     177static void Signal( int sig, void (* handler)(int), int flags ) {
     178        struct sigaction act;
     179        act.sa_handler = handler;
     180        _Signal(act, sig, flags);
    172181} // Signal
    173182
     
    202211static void sigAbortHandler( SIGPARMS ) {
    203212        backtrace( 6 );                                                                         // skip first 6 stack frames
    204         Signal( SIGABRT, (void (*)(SIGPARMS))SIG_DFL, SA_SIGINFO );     // reset default signal handler
     213        Signal( SIGABRT, SIG_DFL, SA_SIGINFO ); // reset default signal handler
    205214        raise( SIGABRT );                                                                       // reraise SIGABRT
    206215} // sigAbortHandler
Note: See TracChangeset for help on using the changeset viewer.