[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] test.h: Use COCCI to suppress macros Coccinelle does not understand.



commit 0da349aa5ebc6d33c92a4f979002c2b0282afc41
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Wed Oct 9 13:22:34 2019 -0400

    test.h: Use COCCI to suppress macros Coccinelle does not understand.
---
 src/test/test.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/test/test.h b/src/test/test.h
index d6a1d19ea..59c4bc797 100644
--- a/src/test/test.h
+++ b/src/test/test.h
@@ -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;



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits