Skip to content

Commit

Permalink
Add __noreturn__ attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
mschwager committed Feb 12, 2024
1 parent af6366b commit efbc39c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ext/cruzzy/cruzzy.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,21 @@ static VALUE c_libfuzzer_is_loaded(VALUE self)

int ATEXIT_RETCODE = 0;

static void ruzzy_exit() {
__attribute__((__noreturn__)) static void ruzzy_exit()
{
_exit(ATEXIT_RETCODE);
}

static void graceful_exit(int code) {
__attribute__((__noreturn__)) static void graceful_exit(int code)
{
// Disable libFuzzer's atexit
ATEXIT_RETCODE = code;
atexit(ruzzy_exit);
exit(code);
}

static void sigint_handler(int signal) {
__attribute__((__noreturn__)) static void sigint_handler(int signal)
{
fprintf(
stderr,
"Signal %d (%s) received. Exiting...\n",
Expand Down

0 comments on commit efbc39c

Please sign in to comment.