]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
test.h: Use COCCI to suppress macros Coccinelle does not understand.
authorNick Mathewson <nickm@torproject.org>
Wed, 9 Oct 2019 17:22:34 +0000 (13:22 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 22 Oct 2019 13:32:13 +0000 (09:32 -0400)
src/test/test.h

index d6a1d19ea1ee99ca5d5fe9a7fbb7cbe22890e4a8..59c4bc7978976ec337f1479b28dfe0917cd279d4 100644 (file)
@@ -37,6 +37,7 @@
 
 #define test_memeq_hex(expr1, hex) test_mem_op_hex(expr1, OP_EQ, hex)
 
+#ifndef COCCI
 #define tt_double_op(a,op,b)                                            \
   tt_assert_test_type(a,b,#a" "#op" "#b,double,(val1_ op val2_),"%g",   \
                       TT_EXIT_TEST_FUNCTION)
@@ -64,6 +65,7 @@
   tt_assert_test_fmt_type(a,b,#a" "#op" "#b,int64_t,(val1_ op val2_),  \
     int64_t, "%"PRId64,                                                \
     {print_ = (int64_t) value_;}, {}, TT_EXIT_TEST_FUNCTION)
+#endif
 
 /**
  * Declare that the test is done, even though no tt___op() calls were made.
@@ -145,6 +147,7 @@ void free_pregenerated_keys(void);
 #define NAME_TEST_(name) #name
 #define NAME_TEST(name) NAME_TEST_(name)
 #define ASPECT(test_module, test_name) US2_CONCAT_2__(test_module, test_name)
+#ifndef COCCI
 #define TEST_CASE(function)  \
   {  \
       NAME_TEST(function),  \
@@ -161,15 +164,18 @@ void free_pregenerated_keys(void);
       NULL,  \
       NULL,  \
   }
+#endif
 
 #define NS(name) US_CONCAT_3_(NS_MODULE, NS_SUBMODULE, name)
 #define NS_FULL(module, submodule, name) US_CONCAT_3_(module, submodule, name)
 
 #define CALLED(mock_name) US_CONCAT_2_(NS(mock_name), called)
+#ifndef COCCI
 #define NS_DECL(retval, mock_fn, args) \
     extern int CALLED(mock_fn);        \
     static retval NS(mock_fn) args; int CALLED(mock_fn) = 0
 #define NS_MOCK(name) MOCK(name, NS(name))
+#endif
 #define NS_UNMOCK(name) UNMOCK(name)
 
 extern const struct testcase_setup_t passthrough_setup;