diff options
author | Jakob Kaivo <jkk@ung.org> | 2020-09-25 14:24:55 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2020-09-25 14:24:55 -0400 |
commit | 17679f331403b2d9af84bb4d107bc0ae1f3373f3 (patch) | |
tree | d47fe3a08bfc5ade912a35642e9a830dc8f28eee | |
parent | 6a2d72af1ac550f5050eeac0be25734c206b9512 (diff) |
move type test objects to file scope, remove need for (void)foo to avoid warnings on unused variables
-rw-r--r-- | signal.c | 6 | ||||
-rw-r--r-- | stddef.c | 12 | ||||
-rw-r--r-- | stdio.c | 11 | ||||
-rw-r--r-- | stdlib.c | 14 | ||||
-rw-r--r-- | string.c | 5 | ||||
-rw-r--r-- | wchar.c | 17 | ||||
-rw-r--r-- | wctype.c | 11 |
7 files changed, 28 insertions, 48 deletions
@@ -1,10 +1,10 @@ #include <signal.h> #include "test.h" +sig_atomic_t test_sig_atomic = 0; + void test_signal_h(void) { - sig_atomic_t sig_atomic = 0; - int signals[] = { SIGABRT, SIGFPE, @@ -14,8 +14,6 @@ void test_signal_h(void) SIGTERM, }; - (void)sig_atomic; - testing_header("signal.h"); test_distinct(signals); @@ -6,18 +6,14 @@ struct s { char b; }; +ptrdiff_t test_ptrdiff; +size_t test_size; +wchar_t test_wchar; + void test_stddef_h(void) { - ptrdiff_t ptrdiff; - size_t size; - wchar_t wchar; - static struct s the_s; - (void)ptrdiff; - (void)size; - (void)wchar; - testing_header("stddef.h"); test_true(NULL == 0); @@ -2,15 +2,12 @@ #include "_stdio.h" #include "test.h" +FILE *test_file; +fpos_t test_fpos; +size_t test_size; + void test_stdio_h(void) { - FILE *file; - fpos_t fpos; - size_t size; - (void)file; - (void)fpos; - (void)size; - int buftypes[] = { _IOFBF, _IOLBF, @@ -2,17 +2,13 @@ #include <limits.h> #include "test.h" +div_t test_div; +ldiv_t test_ldiv; +size_t test_size; +wchar_t test_wchar; + void test_stdlib_h(void) { - div_t div; - ldiv_t ldiv; - size_t size; - wchar_t wchar; - (void)div; - (void)ldiv; - (void)size; - (void)wchar; - int exit_statuses[] = { EXIT_FAILURE, EXIT_SUCCESS, @@ -1,14 +1,14 @@ #include <string.h> #include "test.h" +size_t test_size; + void test_string_h(void) { - size_t size; char dst[64] = { 0 }; char less[] = "a"; char more[] = "b"; char haystack[] = "the five boxing wizards jump quickly"; - (void)size; testing_header("string.h"); @@ -60,6 +60,7 @@ void test_string_h(void) test_true(strspn(haystack, "12345") == 0); test_true(strspn(haystack, "eht") == 3); + test_true(strstr(haystack, "") == haystack); test_true(strstr(haystack, "wizard") == haystack + 16); test_true(strstr(haystack, "rogue") == NULL); @@ -3,19 +3,14 @@ #include "_wchar.h" #include "test.h" +wchar_t test_wchar; +size_t test_size; +mbstate_t test_mbstate; +wint_t test_wint; +struct tm *test_tm; + void test_wchar_h(void) { - wchar_t wchar; - size_t size; - mbstate_t mbstate; - wint_t wint; - struct tm *tm; - (void)wchar; - (void)size; - (void)mbstate; - (void)wint; - (void)tm; - testing_header("wchar.h"); test_true(NULL == 0); @@ -5,6 +5,10 @@ #include "_wctype.h" #include "test.h" +wint_t test_wint; +wctrans_t test_wctrans; +wctype_t test_wctype; + #define UPPER L"ABCDEFGHIJKLMNOPQRSTUVWXYZ" #define LOWER L"abcdefghijklmnopqrstuvwxyz" #define DIGIT L"0123456789" @@ -68,13 +72,6 @@ static void test_ctype_conversion_imp(const char *fnname, int (*fn)(int), const void test_wctype_h(void) { - wint_t wint; - wctrans_t wctrans; - wctype_t wctype; - (void)wint; - (void)wctrans; - (void)wctype; - testing_header("wctype.h"); test_ctype_function(iswalnum, UPPER LOWER DIGIT); |