summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-10-09 10:34:43 -0400
committerNick Mathewson <nickm@torproject.org>2019-10-22 09:32:05 -0400
commitb867e97ce6825e3d7f33a3c3dce8c65f11fe15ec (patch)
tree63b920408fb355c0cc5eb1f8d722cfacd7c2d104 /src/core
parent48be9221609ceafa259db6f4c32cf947e9395e30 (diff)
downloadtor-b867e97ce6825e3d7f33a3c3dce8c65f11fe15ec.tar.gz
tor-b867e97ce6825e3d7f33a3c3dce8c65f11fe15ec.zip
With COCCI defined, avoid PERIODIC_EVENT.
Coccinelle doesn't understand the particular pattern of token pasting we have going on here.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/mainloop/mainloop.c4
-rw-r--r--src/core/mainloop/periodic.h2
-rw-r--r--src/core/or/or_periodic.c2
3 files changed, 7 insertions, 1 deletions
diff --git a/src/core/mainloop/mainloop.c b/src/core/mainloop/mainloop.c
index c051b11566..6e78a5bb26 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 a9aa461969..0f80748f55 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 fe28c99192..879d142cb2 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)