Skip to content
Snippets Groups Projects
Commit 00a3a338 authored by Armin Biere's avatar Armin Biere
Browse files

inlined kissat_signal_name

parent 8cf49a43
No related branches found
No related tags found
No related merge requests found
sc2021-sweep
2.0.0
#include "handle.h"
#include <assert.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
......@@ -9,13 +8,6 @@ static void (*handler) (int);
static volatile int caught_signal;
static volatile bool handler_set;
#define SIGNALS \
SIGNAL(SIGABRT) \
SIGNAL(SIGBUS) \
SIGNAL(SIGINT) \
SIGNAL(SIGSEGV) \
SIGNAL(SIGTERM)
// *INDENT-OFF*
#define SIGNAL(SIG) \
......@@ -23,18 +15,6 @@ static void (*SIG ## _handler)(int);
SIGNALS
#undef SIGNAL
const char *
kissat_signal_name (int sig)
{
#define SIGNAL(SIG) \
if (sig == SIG) return #SIG;
SIGNALS
#undef SIGNAL
if (sig == SIGALRM)
return "SIGALRM";
return "SIGUNKNOWN";
}
void
kissat_reset_signal_handler (void)
{
......
#ifndef _handle_h_INCLUDED
#define _handle_h_INCLUDED
#include <signal.h>
void kissat_init_signal_handler (void (*handler) (int));
void kissat_reset_signal_handler (void);
void kissat_init_alarm (void (*handler) (void));
void kissat_reset_alarm (void);
const char *kissat_signal_name (int sig);
#define SIGNALS \
SIGNAL(SIGABRT) \
SIGNAL(SIGBUS) \
SIGNAL(SIGINT) \
SIGNAL(SIGSEGV) \
SIGNAL(SIGTERM)
// *INDENT-OFF*
static inline const char *
kissat_signal_name (int sig)
{
#define SIGNAL(SIG) \
if (sig == SIG) return #SIG;
SIGNALS
#undef SIGNAL
if (sig == SIGALRM)
return "SIGALRM";
return "SIGUNKNOWN";
}
// *INDENT-ON*
#endif
......@@ -134,7 +134,7 @@ execute_solver_and_send_signal (int sig)
#ifdef ASAN
#define SIGNALS \
#define TEST_SIGNALS \
SIGNAL(SIGABRT) \
SIGNAL(SIGALRM) \
SIGNAL(SIGINT) \
......@@ -142,7 +142,7 @@ SIGNAL(SIGTERM)
#else
#define SIGNALS \
#define TEST_SIGNALS \
SIGNAL(SIGABRT) \
SIGNAL(SIGALRM) \
SIGNAL(SIGINT) \
......@@ -159,7 +159,7 @@ test_main_ ## NAME (void) \
execute_solver_and_send_signal (NAME); \
}
SIGNALS
TEST_SIGNALS
#undef SIGNAL
#endif
void
......@@ -170,7 +170,7 @@ tissat_schedule_main (void)
if (tissat_found_test_directory)
{
#define SIGNAL(NAME) SCHEDULE_FUNCTION (test_main_ ## NAME);
SIGNALS
TEST_SIGNALS
#undef SIGNAL
}
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment