summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2023-03-23 16:40:25 +0000
committerAndrew Clayton <a.clayton@nginx.com>2023-03-28 23:15:28 +0100
commitecbefc519ec968f31ac659779ac2dedfe8545d3b (patch)
treec71ba10a875fb6e251defdec147a3185d816db8d
parent814c680c3920e6b086796a4ce1299d6d21754d38 (diff)
downloadunit-ecbefc519ec968f31ac659779ac2dedfe8545d3b.tar.gz
unit-ecbefc519ec968f31ac659779ac2dedfe8545d3b.tar.bz2
Use unsigned int for nxt_bool_t in va_arg().
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 <alx@nginx.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
-rw-r--r--src/nxt_sprintf.c2
1 files changed, 1 insertions, 1 deletions
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;