Skip to content

Commit ae5c03e

Browse files
authored
Merge pull request swiftlang#540 from dduan/nixos-patch
tests: Suppress unused return value warnings
2 parents 80b1772 + 29ecaed commit ae5c03e

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

tests/bsdtests.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ _test_errno(const char* file, long line, const char* desc, int actual, int expec
347347
{
348348
char* actual_str;
349349
char* expected_str;
350-
asprintf(&actual_str, "%d\t%s", actual, actual ? strerror(actual) : "");
351-
asprintf(&expected_str, "%d\t%s", expected, expected ? strerror(expected) : "");
350+
(void)asprintf(&actual_str, "%d\t%s", actual, actual ? strerror(actual) : "");
351+
(void)asprintf(&expected_str, "%d\t%s", expected, expected ? strerror(expected) : "");
352352
_test_print(file, line, desc,
353353
(actual == expected), "%s", actual_str, "%s", expected_str);
354354
free(actual_str);
@@ -369,8 +369,8 @@ _test_mach_error(const char* file, long line, const char* desc,
369369
{
370370
char* actual_str;
371371
char* expected_str;
372-
asprintf(&actual_str, "%d %s", actual, actual ? mach_error_string(actual) : "");
373-
asprintf(&expected_str, "%d %s", expected, expected ? mach_error_string(expected) : "");
372+
(void)asprintf(&actual_str, "%d %s", actual, actual ? mach_error_string(actual) : "");
373+
(void)asprintf(&expected_str, "%d %s", expected, expected ? mach_error_string(expected) : "");
374374
_test_print(file, line, desc,
375375
(actual == expected), "%s", actual_str, "%s", expected_str);
376376
free(actual_str);
@@ -416,12 +416,12 @@ test_cferror(const char *desc, CFErrorRef actual, CFIndex expectedCode)
416416
if (code != expectedCode) {
417417
char buffer[BUFSIZ];
418418
CFStringGetCString(errDesc, buffer, sizeof(buffer), kCFStringEncodingUTF8);
419-
asprintf(&actual_str, "%ld\t%s", code, buffer);
419+
(void)asprintf(&actual_str, "%ld\t%s", code, buffer);
420420
} else {
421-
asprintf(&actual_str, "%ld", code);
421+
(void)asprintf(&actual_str, "%ld", code);
422422
}
423423

424-
asprintf(&expected_str, "%ld", expectedCode);
424+
(void)asprintf(&expected_str, "%ld", expectedCode);
425425
_test_print("", (long) 0, desc,
426426
(code == expectedCode), "%s", actual_str, "%s", expected_str);
427427

tests/dispatch_io_muxed.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ test_file_muxed(void)
6464
const char *path_separator = "/";
6565
#endif
6666
char *path = NULL;
67-
asprintf(&path, "%s%sdispatchtest_io.XXXXXX", temp_dir, path_separator);
67+
(void)asprintf(&path, "%s%sdispatchtest_io.XXXXXX", temp_dir, path_separator);
6868
dispatch_fd_t fd = mkstemp(path);
6969
if (fd == -1) {
7070
test_errno("mkstemp", errno, 0);

tests/dispatch_overcommit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ main(void)
4848
int i;
4949
for (i = 0; i < final; ++i) {
5050
char* name;
51-
asprintf(&name, "test.overcommit.%d", i);
51+
(void)asprintf(&name, "test.overcommit.%d", i);
5252

5353
dispatch_queue_t queue = dispatch_queue_create(name, NULL);
5454
test_ptr_notnull("dispatch_queue_create", queue);

0 commit comments

Comments
 (0)