From 596befb9d23cdbf3282f377c5800622b5ca038d4 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 27 Oct 2016 12:04:41 +0300 Subject: [PATCH] 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. --- cord/tests/cordtest.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/cord/tests/cordtest.c b/cord/tests/cordtest.c index 35ea9ae..e05e6a5 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) @@ -123,6 +133,15 @@ void test_basics(void) 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) -- 2.7.4