From ecbefc519ec968f31ac659779ac2dedfe8545d3b Mon Sep 17 00:00:00 2001 From: Andrew Clayton Date: Thu, 23 Mar 2023 16:40:25 +0000 Subject: Use unsigned int for nxt_bool_t in va_arg(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is required for the next patch which will change nxt_bool_t from a nxt_uint_t to a uint8_t, which produces the following compiler warning cc -c -pipe -fPIC -fvisibility=hidden -O -W -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wmissing-prototypes -Werror -g -I src -I build \ \ \ -o build/src/nxt_sprintf.o \ -MMD -MF build/src/nxt_sprintf.dep -MT build/src/nxt_sprintf.o \ src/nxt_sprintf.c In file included from src/nxt_unix.h:160, from src/nxt_main.h:31, from src/nxt_sprintf.c:7: src/nxt_sprintf.c: In function ‘nxt_vsprintf’: src/nxt_sprintf.c:368:44: error: ‘nxt_bool_t’ {aka ‘unsigned char’} is promoted to ‘int’ when passed through ‘...’ [-Werror] 368 | ui64 = (uint64_t) va_arg(args, nxt_bool_t); | ^ src/nxt_sprintf.c:368:44: note: (so you should pass ‘int’ not ‘nxt_bool_t’ {aka ‘unsigned char’} to ‘va_arg’) src/nxt_sprintf.c:368:44: note: if this code is reached, the program will abort cc1: all warnings being treated as errors Lets use unsigned int as it matches the signedness of nxt_bool_t. Reviewed-by: Alejandro Colomar Signed-off-by: Andrew Clayton --- src/nxt_sprintf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nxt_sprintf.c b/src/nxt_sprintf.c index 9c8e27ed..cad402fa 100644 --- a/src/nxt_sprintf.c +++ b/src/nxt_sprintf.c @@ -365,7 +365,7 @@ nxt_vsprintf(u_char *buf, u_char *end, const char *fmt, va_list args) goto number; case 'b': - ui64 = (uint64_t) va_arg(args, nxt_bool_t); + ui64 = (uint64_t) va_arg(args, unsigned int); sign = 0; goto number; -- cgit