Skip to content

Commit 1a18f4b

Browse files
thugheskartben
authored andcommitted
tests: posix: Re-enable -Wunused-value warning
Rather than disabling -Wunused-value for the entire file, explicitly mark variables that are unused. Signed-off-by: Tom Hughes <[email protected]>
1 parent 916928a commit 1a18f4b

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

tests/posix/headers/src/sys_socket_h.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#include <zephyr/posix/sys/socket.h>
1313
#endif
1414

15-
#pragma GCC diagnostic push
16-
#pragma GCC diagnostic ignored "-Wunused-value"
1715
/**
1816
* @brief existence test for `<sys/socket.h>`
1917
*
@@ -51,9 +49,9 @@ ZTEST(posix_headers, test_sys_socket_h)
5149
zassert_not_equal(-1, offsetof(struct cmsghdr, cmsg_level));
5250
zassert_not_equal(-1, offsetof(struct cmsghdr, cmsg_type));
5351

54-
CMSG_DATA(&cmsg);
55-
CMSG_NXTHDR(&mhdr, &cmsg);
56-
CMSG_FIRSTHDR(&mhdr);
52+
ARG_UNUSED(CMSG_DATA(&cmsg));
53+
__unused struct cmsghdr *next = CMSG_NXTHDR(&mhdr, &cmsg);
54+
__unused struct cmsghdr *first = CMSG_FIRSTHDR(&mhdr);
5755

5856
zassert_not_equal(-1, offsetof(struct linger, l_onoff));
5957
zassert_not_equal(-1, offsetof(struct linger, l_linger));
@@ -120,4 +118,3 @@ ZTEST(posix_headers, test_sys_socket_h)
120118
zassert_not_null(socketpair);
121119
}
122120
}
123-
#pragma GCC diagnostic pop

0 commit comments

Comments
 (0)