From bbc7f8fbce8db8f17656581800f5a68808ee94cb Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Mon, 19 Oct 2015 22:16:15 +1030 Subject: [PATCH] Remove terminating semicolons from within macros The ALARM_STRUCT() and DECLARE_TRIGGER() macros included terminating semicolons, but their invocation should always be followed by a semicolon, otherwise etags(1) gets confused, so their included semicolon was redundant. --- fdqueue.h | 2 +- httpd.c | 2 +- rhizome.h | 2 +- rhizome_database.c | 2 +- trigger.h | 9 ++++++--- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/fdqueue.h b/fdqueue.h index 23b8af65..abb61107 100644 --- a/fdqueue.h +++ b/fdqueue.h @@ -114,7 +114,7 @@ struct sched_ent{ #define ALARM_STRUCT(X) _sched_##X #define DECLARE_ALARM(X) \ extern struct sched_ent ALARM_STRUCT(X); \ - void X(struct sched_ent *); + void X(struct sched_ent *) #define DEFINE_ALARM(X) \ void X(struct sched_ent *); \ diff --git a/httpd.c b/httpd.c index 7882297d..4e0eeead 100644 --- a/httpd.c +++ b/httpd.c @@ -302,7 +302,7 @@ static void trigger_rhizome_bundle_added(rhizome_manifest *m) } } -DEFINE_TRIGGER(bundle_add, trigger_rhizome_bundle_added) +DEFINE_TRIGGER(bundle_add, trigger_rhizome_bundle_added); int is_http_header_complete(const char *buf, size_t len, size_t read_since_last_call) { diff --git a/rhizome.h b/rhizome.h index b7f927bb..a53dea12 100644 --- a/rhizome.h +++ b/rhizome.h @@ -925,6 +925,6 @@ DECLARE_ALARM(rhizome_fetch_status); /* Rhizome triggers */ -DECLARE_TRIGGER(bundle_add, rhizome_manifest*) +DECLARE_TRIGGER(bundle_add, rhizome_manifest*); #endif //__SERVAL_DNA__RHIZOME_H diff --git a/rhizome_database.c b/rhizome_database.c index 30228096..17d2c8c2 100644 --- a/rhizome_database.c +++ b/rhizome_database.c @@ -1376,7 +1376,7 @@ static void trigger_rhizome_bundle_added_debug(rhizome_manifest *m) ); } -DEFINE_TRIGGER(bundle_add, trigger_rhizome_bundle_added_debug) +DEFINE_TRIGGER(bundle_add, trigger_rhizome_bundle_added_debug); /* The cursor struct must be zerofilled and the query parameters optionally filled in prior to * calling this function. diff --git a/trigger.h b/trigger.h index 51247b0d..0bee4e6c 100644 --- a/trigger.h +++ b/trigger.h @@ -26,16 +26,19 @@ #define DECLARE_TRIGGER(TRIG, ...) \ typedef void TRIGGER_FUNC_##TRIG (__VA_ARGS__); \ - DECLARE_SECTION(TRIGGER_FUNC_##TRIG *, tr_##TRIG); + DECLARE_SECTION(TRIGGER_FUNC_##TRIG *, tr_##TRIG) +// Don't include the trailing ";" in the macro, the caller has to supply it. +// Otherwise etags(1) gets confused and omits any function definition that +// immediately follows a DEFINE_TRIGGER() line. #define DEFINE_TRIGGER(TRIG, FUNC) \ - TRIGGER_FUNC_##TRIG * __trigger_##FUNC IN_SECTION(tr_##TRIG) = FUNC; + TRIGGER_FUNC_##TRIG * __trigger_##FUNC IN_SECTION(tr_##TRIG) = FUNC #define CALL_TRIGGER(TRIG, ...) \ do { \ TRIGGER_FUNC_##TRIG **__trig; \ for (__trig = SECTION_START(tr_##TRIG); __trig < SECTION_END(tr_##TRIG); ++__trig) \ (**__trig)(__VA_ARGS__); \ - } while (0); + } while (0) #endif // __SERVAL_DNA__TRIGGER_H