CC (gcc) [M usrloc.so] ul_keepalive.o ul_keepalive.c: In function 'ul_ka_urecord': ul_keepalive.c:61:18: warning: format '%x' expects argument of type 'unsigned int', but argument 26 has type '__suseconds_t' {aka 'long int'} [-Wformat=] #define ULKA_MSG "%.*s %.*s SIP/2.0\r\n" \ ^~~~~~~~~~~~~~~~~~~~~~~ ul_keepalive.c:193:50: note: in expansion of macro 'ULKA_MSG' kabuf_len = snprintf(kabuf, ULKA_BUF_SIZE - 1, ULKA_MSG, ^~~~~~~~ ul_keepalive.c:64:34: note: format string is defined here "From: <%.*s>;tag=%.*s-%x-%lx-%x-%x.%x\r\n" \ ~^ %lx In file included from ul_keepalive.c:30: ul_keepalive.c: In function 'ul_ka_reply_received': ../../core/dprint.h:316:24: warning: format '%u' expects argument of type 'unsigned int', but argument 11 has type '__suseconds_t' {aka 'long int'} [-Wformat=] fprintf(stderr, "%2d(%d) %s: %.*s%s%s%s" fmt, \ ^~~~~~~~~~~~~~~~~~~~~~~~ ../../core/dprint.h:340:4: note: in expansion of macro 'LOG_FX' LOG_FX(facility, level, lname, prefix, _FUNC_NAME_, fmt, ## args) ^~~~~~ ../../core/dprint.h:346:4: note: in expansion of macro 'LOG_FL' LOG_FL(facility, level, NULL, prefix, fmt, ## args) ^~~~~~ ../../core/dprint.h:349:4: note: in expansion of macro 'LOG_FP' LOG_FP(DEFAULT_FACILITY, (level), LOC_INFO, fmt, ## args) ^~~~~~ ../../core/dprint.h:396:32: note: in expansion of macro 'LOG' # define DBG(fmt, args...) LOG(L_DBG, fmt , ## args) ^~~ ../../core/dprint.h:400:30: note: in expansion of macro 'DBG' # define DEBUG(fmt, args...) DBG(fmt , ## args) ^~~ ../../core/dprint.h:417:16: note: in expansion of macro 'DEBUG' #define LM_DBG DEBUG ^~~~~ ul_keepalive.c:366:2: note: in expansion of macro 'LM_DBG' LM_DBG("tv usec is [%u]\n", tvm.tv_usec); ^~~~~~ ul_keepalive.c:366:23: note: format string is defined here LM_DBG("tv usec is [%u]\n", tvm.tv_usec); ~^ %lu
Apparently clang-libc on bsd/macos has different types for tmval fields than gcc on linux. I pushed a commit to do casts and avoid warning in any of those platforms.
Cheers, Daniel
On 29.03.20 09:02, Juha Heinanen wrote:
CC (gcc) [M usrloc.so] ul_keepalive.o ul_keepalive.c: In function 'ul_ka_urecord': ul_keepalive.c:61:18: warning: format '%x' expects argument of type 'unsigned int', but argument 26 has type '__suseconds_t' {aka 'long int'} [-Wformat=] #define ULKA_MSG "%.*s %.*s SIP/2.0\r\n" \ ^~~~~~~~~~~~~~~~~~~~~~~ ul_keepalive.c:193:50: note: in expansion of macro 'ULKA_MSG' kabuf_len = snprintf(kabuf, ULKA_BUF_SIZE - 1, ULKA_MSG, ^~~~~~~~ ul_keepalive.c:64:34: note: format string is defined here "From: <%.*s>;tag=%.*s-%x-%lx-%x-%x.%x\r\n" \ ~^ %lx In file included from ul_keepalive.c:30: ul_keepalive.c: In function 'ul_ka_reply_received': ../../core/dprint.h:316:24: warning: format '%u' expects argument of type 'unsigned int', but argument 11 has type '__suseconds_t' {aka 'long int'} [-Wformat=] fprintf(stderr, "%2d(%d) %s: %.*s%s%s%s" fmt, \ ^~~~~~~~~~~~~~~~~~~~~~~~ ../../core/dprint.h:340:4: note: in expansion of macro 'LOG_FX' LOG_FX(facility, level, lname, prefix, _FUNC_NAME_, fmt, ## args) ^~~~~~ ../../core/dprint.h:346:4: note: in expansion of macro 'LOG_FL' LOG_FL(facility, level, NULL, prefix, fmt, ## args) ^~~~~~ ../../core/dprint.h:349:4: note: in expansion of macro 'LOG_FP' LOG_FP(DEFAULT_FACILITY, (level), LOC_INFO, fmt, ## args) ^~~~~~ ../../core/dprint.h:396:32: note: in expansion of macro 'LOG' # define DBG(fmt, args...) LOG(L_DBG, fmt , ## args) ^~~ ../../core/dprint.h:400:30: note: in expansion of macro 'DBG' # define DEBUG(fmt, args...) DBG(fmt , ## args) ^~~ ../../core/dprint.h:417:16: note: in expansion of macro 'DEBUG' #define LM_DBG DEBUG ^~~~~ ul_keepalive.c:366:2: note: in expansion of macro 'LM_DBG' LM_DBG("tv usec is [%u]\n", tvm.tv_usec); ^~~~~~ ul_keepalive.c:366:23: note: format string is defined here LM_DBG("tv usec is [%u]\n", tvm.tv_usec); ~^ %lu
Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev