Workaround 'pos_*, [r]iter, dump never used' cppcheck style warnings (cord)
authorIvan Maidanski <ivmai@mail.ru>
Thu, 27 Oct 2016 09:04:41 +0000 (12:04 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 27 Oct 2016 09:04:41 +0000 (12:04 +0300)
* 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

index 35ea9ae..e05e6a5 100644 (file)
 # 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)