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

[tor-commits] [tor/master] With COCCI defined, avoid PERIODIC_EVENT.



commit b867e97ce6825e3d7f33a3c3dce8c65f11fe15ec
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Wed Oct 9 10:34:43 2019 -0400

    With COCCI defined, avoid PERIODIC_EVENT.
    
    Coccinelle doesn't understand the particular pattern of token
    pasting we have going on here.
---
 src/core/mainloop/mainloop.c           | 4 +++-
 src/core/mainloop/periodic.h           | 2 ++
 src/core/or/or_periodic.c              | 2 ++
 src/feature/dirauth/dirauth_periodic.c | 2 ++
 src/feature/relay/relay_periodic.c     | 2 ++
 5 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index c051b1156..6e78a5bb2 100644
--- a/src/core/mainloop/mainloop.c
+++ b/src/core/mainloop/mainloop.c
@@ -1363,8 +1363,10 @@ CALLBACK(second_elapsed);
 #undef CALLBACK
 
 /* Now we declare an array of periodic_event_item_t for each periodic event */
-#define CALLBACK(name, r, f) \
+#ifndef COCCI
+#define CALLBACK(name, r, f)                            \
   PERIODIC_EVENT(name, PERIODIC_EVENT_ROLE_ ## r, f)
+#endif
 #define FL(name) (PERIODIC_EVENT_FLAG_ ## name)
 
 STATIC periodic_event_item_t mainloop_periodic_events[] = {
diff --git a/src/core/mainloop/periodic.h b/src/core/mainloop/periodic.h
index a9aa46196..0f80748f5 100644
--- a/src/core/mainloop/periodic.h
+++ b/src/core/mainloop/periodic.h
@@ -71,8 +71,10 @@ typedef struct periodic_event_item_t {
 } periodic_event_item_t;
 
 /** events will get their interval from first execution */
+#ifndef COCCI
 #define PERIODIC_EVENT(fn, r, f) { fn##_callback, 0, NULL, #fn, r, f, 0 }
 #define END_OF_PERIODIC_EVENTS { NULL, 0, NULL, NULL, 0, 0, 0 }
+#endif
 
 /* Return true iff the given event was setup before thus is enabled to be
  * scheduled. */
diff --git a/src/core/or/or_periodic.c b/src/core/or/or_periodic.c
index fe28c9919..879d142cb 100644
--- a/src/core/or/or_periodic.c
+++ b/src/core/or/or_periodic.c
@@ -20,11 +20,13 @@
 
 #include "feature/relay/routermode.h"
 
+#ifndef COCCI
 #define DECLARE_EVENT(name, roles, flags)         \
   static periodic_event_item_t name ## _event =   \
     PERIODIC_EVENT(name,                          \
                    PERIODIC_EVENT_ROLE_##roles,   \
                    flags)
+#endif
 
 #define FL(name) (PERIODIC_EVENT_FLAG_ ## name)
 
diff --git a/src/feature/dirauth/dirauth_periodic.c b/src/feature/dirauth/dirauth_periodic.c
index 02727d61b..c02b9ac86 100644
--- a/src/feature/dirauth/dirauth_periodic.c
+++ b/src/feature/dirauth/dirauth_periodic.c
@@ -18,11 +18,13 @@
 
 #include "core/mainloop/periodic.h"
 
+#ifndef COCCI
 #define DECLARE_EVENT(name, roles, flags)         \
   static periodic_event_item_t name ## _event =   \
     PERIODIC_EVENT(name,                          \
                    PERIODIC_EVENT_ROLE_##roles,   \
                    flags)
+#endif
 
 #define FL(name) (PERIODIC_EVENT_FLAG_##name)
 
diff --git a/src/feature/relay/relay_periodic.c b/src/feature/relay/relay_periodic.c
index b48b49589..7dc4cb453 100644
--- a/src/feature/relay/relay_periodic.c
+++ b/src/feature/relay/relay_periodic.c
@@ -31,11 +31,13 @@
 #include "feature/nodelist/routerinfo_st.h"
 #include "feature/control/control_events.h"
 
+#ifndef COCCI
 #define DECLARE_EVENT(name, roles, flags)         \
   static periodic_event_item_t name ## _event =   \
     PERIODIC_EVENT(name,                          \
                    PERIODIC_EVENT_ROLE_##roles,   \
                    flags)
+#endif
 
 #define FL(name) (PERIODIC_EVENT_FLAG_##name)
 



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