Skip to content

Commit e4c49d8

Browse files
zapb-0borneoa
authored andcommitted
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 <dev@zapb.de> Reviewed-on: https://review.openocd.org/c/openocd/+/9477 Reviewed-by: Anatoly P <kupokupokupopo@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
1 parent 22e1e1b commit e4c49d8

1 file changed

Lines changed: 0 additions & 1 deletion

File tree

src/server/server.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,6 @@ static void sig_handler(int sig)
613613
/* store only first signal that hits us */
614614
if (shutdown_openocd == CONTINUE_MAIN_LOOP) {
615615
shutdown_openocd = SHUTDOWN_WITH_SIGNAL_CODE;
616-
assert(sig >= SIG_ATOMIC_MIN && sig <= SIG_ATOMIC_MAX);
617616
last_signal = sig;
618617
LOG_DEBUG("Terminating on Signal %d", sig);
619618
} else

0 commit comments

Comments
 (0)