From efbc39ced66708b4af40643c20710887a4dba601 Mon Sep 17 00:00:00 2001 From: Matt Schwager Date: Mon, 12 Feb 2024 14:12:20 -0700 Subject: [PATCH] Add __noreturn__ attribute --- ext/cruzzy/cruzzy.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ext/cruzzy/cruzzy.c b/ext/cruzzy/cruzzy.c index 701f544..0c560c8 100644 --- a/ext/cruzzy/cruzzy.c +++ b/ext/cruzzy/cruzzy.c @@ -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",