From b0eb01ef4832113f9d2530a04cdc76664391dc13 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Fri, 17 Oct 2025 16:12:59 -0300 Subject: [PATCH] support: Use CHAR_MAX as maximum value On ABIs with defined 'char' was unsigned type, clang fails to build support_process_state.c with: support_process_state.c:70:21: error: result of comparison of constant -1 with expression of type 'char' is always false [-Werror,-Wtautological-constant-out-of-range-compare] 70 | if (cur_state == -1) | ~~~~~~~~~ ^ ~~ 1 error generated. Reviewed-by: Sam James --- support/support_process_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/support/support_process_state.c b/support/support_process_state.c index d2cb546136..8f8e118ce9 100644 --- a/support/support_process_state.c +++ b/support/support_process_state.c @@ -59,7 +59,7 @@ support_process_state_wait (pid_t pid, enum support_process_state state) for (;;) { - char cur_state = -1; + char cur_state = CHAR_MAX; while (xgetline (&line, &linesiz, fstatus) > 0) if (strncmp (line, "State:", strlen ("State:")) == 0) { @@ -67,7 +67,7 @@ support_process_state_wait (pid_t pid, enum support_process_state state) break; } /* Fallback to nanosleep for invalid state. */ - if (cur_state == -1) + if (cur_state == CHAR_MAX) break; for (size_t i = 0; i < array_length (process_states); ++i)