Skip to content

tests: Suppress unused return value warnings #540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions tests/bsdtests.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,8 @@ _test_errno(const char* file, long line, const char* desc, int actual, int expec
{
char* actual_str;
char* expected_str;
asprintf(&actual_str, "%d\t%s", actual, actual ? strerror(actual) : "");
asprintf(&expected_str, "%d\t%s", expected, expected ? strerror(expected) : "");
(void)asprintf(&actual_str, "%d\t%s", actual, actual ? strerror(actual) : "");
(void)asprintf(&expected_str, "%d\t%s", expected, expected ? strerror(expected) : "");
_test_print(file, line, desc,
(actual == expected), "%s", actual_str, "%s", expected_str);
free(actual_str);
Expand All @@ -369,8 +369,8 @@ _test_mach_error(const char* file, long line, const char* desc,
{
char* actual_str;
char* expected_str;
asprintf(&actual_str, "%d %s", actual, actual ? mach_error_string(actual) : "");
asprintf(&expected_str, "%d %s", expected, expected ? mach_error_string(expected) : "");
(void)asprintf(&actual_str, "%d %s", actual, actual ? mach_error_string(actual) : "");
(void)asprintf(&expected_str, "%d %s", expected, expected ? mach_error_string(expected) : "");
_test_print(file, line, desc,
(actual == expected), "%s", actual_str, "%s", expected_str);
free(actual_str);
Expand Down Expand Up @@ -416,12 +416,12 @@ test_cferror(const char *desc, CFErrorRef actual, CFIndex expectedCode)
if (code != expectedCode) {
char buffer[BUFSIZ];
CFStringGetCString(errDesc, buffer, sizeof(buffer), kCFStringEncodingUTF8);
asprintf(&actual_str, "%ld\t%s", code, buffer);
(void)asprintf(&actual_str, "%ld\t%s", code, buffer);
} else {
asprintf(&actual_str, "%ld", code);
(void)asprintf(&actual_str, "%ld", code);
}

asprintf(&expected_str, "%ld", expectedCode);
(void)asprintf(&expected_str, "%ld", expectedCode);
_test_print("", (long) 0, desc,
(code == expectedCode), "%s", actual_str, "%s", expected_str);

Expand Down
2 changes: 1 addition & 1 deletion tests/dispatch_io_muxed.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ test_file_muxed(void)
const char *path_separator = "/";
#endif
char *path = NULL;
asprintf(&path, "%s%sdispatchtest_io.XXXXXX", temp_dir, path_separator);
(void)asprintf(&path, "%s%sdispatchtest_io.XXXXXX", temp_dir, path_separator);
dispatch_fd_t fd = mkstemp(path);
if (fd == -1) {
test_errno("mkstemp", errno, 0);
Expand Down
2 changes: 1 addition & 1 deletion tests/dispatch_overcommit.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ main(void)
int i;
for (i = 0; i < final; ++i) {
char* name;
asprintf(&name, "test.overcommit.%d", i);
(void)asprintf(&name, "test.overcommit.%d", i);

dispatch_queue_t queue = dispatch_queue_create(name, NULL);
test_ptr_notnull("dispatch_queue_create", queue);
Expand Down