From: Ivan Maidanski Date: Thu, 27 Oct 2016 09:04:41 +0000 (+0300) Subject: Workaround 'pos_*, [r]iter, dump never used' cppcheck style warnings (cord) X-Git-Tag: v7.6.2~429 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a779302dd79a04334f24809438ad7d0a5b2fdb4d;p=gc Workaround 'pos_*, [r]iter, dump never used' cppcheck style warnings (cord) * cord/tests/cordtest.c [CPPCHECK] (CORD_iter, CORD_next, CORD_pos_fetch, CORD_pos_to_cord, CORD_pos_to_index, CORD_pos_valid, CORD_prev): Undefine (at the beginning of the file). * cord/tests/cordtest.c [CPPCHECK] (test_basics): Call CORD_pos_to_cord, CORD_pos_to_index, CORD_iter, CORD_riter, CORD_dump; add TODO item. --- diff --git a/cord/tests/cordtest.c b/cord/tests/cordtest.c index 01e7b15d..7e3a8328 100644 --- a/cord/tests/cordtest.c +++ b/cord/tests/cordtest.c @@ -26,6 +26,16 @@ # define ABORT(string) \ { fprintf(stderr, "FAILED: %s\n", string); abort(); } +#if defined(CPPCHECK) +# undef CORD_iter +# undef CORD_next +# undef CORD_pos_fetch +# undef CORD_pos_to_cord +# undef CORD_pos_to_index +# undef CORD_pos_valid +# undef CORD_prev +#endif + int count; int test_fn(char c, void * client_data) @@ -122,6 +132,15 @@ void test_basics(void) CORD_next(p); i++; } if (i != 13) ABORT("Bad apparent length for function node"); +# if defined(CPPCHECK) + /* TODO: Actually test these functions. */ + CORD_prev(p); + (void)CORD_pos_to_cord(p); + (void)CORD_pos_to_index(p); + (void)CORD_iter(CORD_EMPTY, test_fn, NULL); + (void)CORD_riter(CORD_EMPTY, test_fn, NULL); + CORD_dump(y); +# endif } void test_extras(void)