diff options
| author | Daniel Stone <daniels@collabora.com> | 2018-08-24 16:53:25 +0100 |
|---|---|---|
| committer | Daniel Stone <daniels@collabora.com> | 2018-08-29 09:59:04 +0100 |
| commit | cb9a2557e11f294256943f5b4187940d7234820c (patch) | |
| tree | 111932ce342e3171c43c1326ba0d2e610380d7e6 /tests/socket-test.c | |
| parent | tests: Use volatile pointer for NULL dereference (diff) | |
| download | wayland-cb9a2557e11f294256943f5b4187940d7234820c.tar wayland-cb9a2557e11f294256943f5b4187940d7234820c.tar.gz wayland-cb9a2557e11f294256943f5b4187940d7234820c.tar.bz2 wayland-cb9a2557e11f294256943f5b4187940d7234820c.tar.lz wayland-cb9a2557e11f294256943f5b4187940d7234820c.tar.xz wayland-cb9a2557e11f294256943f5b4187940d7234820c.tar.zst wayland-cb9a2557e11f294256943f5b4187940d7234820c.zip | |
tests: Overly elaborate compiler warning workaround
Clang will rightly point out that example_sockaddr_un in socket-test
will get discarded from the compilation unit as it is completely unused.
Put in a couple of lines which of no value other than stopping Clang
from complaining.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tests/socket-test.c')
| -rw-r--r-- | tests/socket-test.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/socket-test.c b/tests/socket-test.c index e970562..8d39edc 100644 --- a/tests/socket-test.c +++ b/tests/socket-test.c @@ -42,7 +42,7 @@ * See `man 7 unix`. */ -static const struct sockaddr_un example_sockaddr_un; +static struct sockaddr_un example_sockaddr_un; #define TOO_LONG (1 + sizeof example_sockaddr_un.sun_path) @@ -69,6 +69,11 @@ TEST(socket_path_overflow_client_connect) d = wl_display_connect(path); assert(d == NULL); assert(errno == ENAMETOOLONG); + + /* This is useless, but prevents a warning about example_sockaddr_un + * being discarded from the compilation unit. */ + strcpy(example_sockaddr_un.sun_path, "happy now clang?"); + assert(example_sockaddr_un.sun_path[0] != '\0'); } TEST(socket_path_overflow_server_create) |
