mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-02-05 04:06:20 -05:00
tests: cast pid_t and struct timeval fields before printing
The exact type behind these might depend on the architecture. For
instance, on ARMv7, struct timeval fields are long long int instead
of long int:
FAILED: tests/libtest-runner.a.p/test-compositor.c.o
cc -Itests/libtest-runner.a.p -Itests -I../tests -I. -I.. -Isrc -I../src -fdiagnostics-color=always -fsanitize=address,undefined -fno-omit-frame-pointer -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c99 -O0 -g -D_POSIX_C_SOURCE=200809L -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden -fPIC -pthread -MD -MQ tests/libtest-runner.a.p/test-compositor.c.o -MF tests/libtest-runner.a.p/test-compositor.c.o.d -o tests/libtest-runner.a.p/test-compositor.c.o -c ../tests/test-compositor.c
../tests/test-compositor.c: In function 'get_socket_name':
../tests/test-compositor.c:95:60: error: format '%ld' expects argument of type 'long int', but argument 5 has type '__time64_t' {aka 'long long int'} [-Werror=format=]
95 | snprintf(retval, sizeof retval, "wayland-test-%d-%ld%ld",
| ~~^
| |
| long int
| %lld
96 | getpid(), tv.tv_sec, tv.tv_usec);
| ~~~~~~~~~
| |
| __time64_t {aka long long int}
../tests/test-compositor.c:95:63: error: format '%ld' expects argument of type 'long int', but argument 6 has type '__suseconds64_t' {aka 'long long int'} [-Werror=format=]
95 | snprintf(retval, sizeof retval, "wayland-test-%d-%ld%ld",
| ~~^
| |
| long int
| %lld
96 | getpid(), tv.tv_sec, tv.tv_usec);
| ~~~~~~~~~~
| |
| __suseconds64_t {aka long long int}
Signed-off-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
parent
f72e3fae4a
commit
8c0947892b
1 changed files with 2 additions and 2 deletions
|
|
@ -92,8 +92,8 @@ get_socket_name(void)
|
|||
static char retval[64];
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
snprintf(retval, sizeof retval, "wayland-test-%d-%ld%ld",
|
||||
getpid(), tv.tv_sec, tv.tv_usec);
|
||||
snprintf(retval, sizeof retval, "wayland-test-%d-%lld%lld",
|
||||
(int) getpid(), (long long int) tv.tv_sec, (long long int) tv.tv_usec);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue