From e4c49d86052dfc241ec60bbd3b7e190307891722 Mon Sep 17 00:00:00 2001 From: Marc Schink Date: Thu, 26 Feb 2026 10:14:34 +0100 Subject: [PATCH] server/server: Fix build on FreeBSD On FreeBSD, sig_atomic_t is of type 'long' rather than 'int'. Remove the assert() instead of replacing it with a more complex, size-agnostic check that would handle both 'int' and 'long'. Since the signal number comes from the operating system, an explicit range check is unnecessary. Checkpatch-ignore: COMMIT_LOG_LONG_LINE Build error on FreeBSD: ../src/server/server.c:616:39: error: result of comparison of constant 9223372036854775807 with expression of type 'int' is always true [-Werror,-Wtautological-constant-out-of-range-compare] 616 | assert(sig >= SIG_ATOMIC_MIN && sig <= SIG_ATOMIC_MAX); | ~~~ ^ ~~~~~~~~~~~~~~ /usr/include/assert.h:55:21: note: expanded from macro 'assert' 55 | #define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \ | ^ ../src/server/server.c:616:14: error: result of comparison of constant -9223372036854775808 with expression of type 'int' is always true [-Werror,-Wtautological-constant-out-of-range-compare] 616 | assert(sig >= SIG_ATOMIC_MIN && sig <= SIG_ATOMIC_MAX); | ~~~ ^ ~~~~~~~~~~~~~~ /usr/include/assert.h:55:21: note: expanded from macro 'assert' 55 | #define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \ Change-Id: I6cf9242ab8206184bff9390ef0245843261656bd Signed-off-by: Marc Schink Reviewed-on: https://review.openocd.org/c/openocd/+/9477 Reviewed-by: Anatoly P Reviewed-by: Antonio Borneo Tested-by: jenkins --- src/server/server.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/server/server.c b/src/server/server.c index 62c2ce821..a48c0dba9 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -613,7 +613,6 @@ static void sig_handler(int sig) /* store only first signal that hits us */ if (shutdown_openocd == CONTINUE_MAIN_LOOP) { shutdown_openocd = SHUTDOWN_WITH_SIGNAL_CODE; - assert(sig >= SIG_ATOMIC_MIN && sig <= SIG_ATOMIC_MAX); last_signal = sig; LOG_DEBUG("Terminating on Signal %d", sig); } else