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.
This commit is contained in:
Andrew Bettison 2015-10-19 22:16:15 +10:30
parent a060642fdb
commit bbc7f8fbce
5 changed files with 10 additions and 7 deletions

View File

@ -114,7 +114,7 @@ struct sched_ent{
#define ALARM_STRUCT(X) _sched_##X #define ALARM_STRUCT(X) _sched_##X
#define DECLARE_ALARM(X) \ #define DECLARE_ALARM(X) \
extern struct sched_ent ALARM_STRUCT(X); \ extern struct sched_ent ALARM_STRUCT(X); \
void X(struct sched_ent *); void X(struct sched_ent *)
#define DEFINE_ALARM(X) \ #define DEFINE_ALARM(X) \
void X(struct sched_ent *); \ void X(struct sched_ent *); \

View File

@ -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) int is_http_header_complete(const char *buf, size_t len, size_t read_since_last_call)
{ {

View File

@ -925,6 +925,6 @@ DECLARE_ALARM(rhizome_fetch_status);
/* Rhizome triggers */ /* Rhizome triggers */
DECLARE_TRIGGER(bundle_add, rhizome_manifest*) DECLARE_TRIGGER(bundle_add, rhizome_manifest*);
#endif //__SERVAL_DNA__RHIZOME_H #endif //__SERVAL_DNA__RHIZOME_H

View File

@ -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 /* The cursor struct must be zerofilled and the query parameters optionally filled in prior to
* calling this function. * calling this function.

View File

@ -26,16 +26,19 @@
#define DECLARE_TRIGGER(TRIG, ...) \ #define DECLARE_TRIGGER(TRIG, ...) \
typedef void TRIGGER_FUNC_##TRIG (__VA_ARGS__); \ 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) \ #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, ...) \ #define CALL_TRIGGER(TRIG, ...) \
do { \ do { \
TRIGGER_FUNC_##TRIG **__trig; \ TRIGGER_FUNC_##TRIG **__trig; \
for (__trig = SECTION_START(tr_##TRIG); __trig < SECTION_END(tr_##TRIG); ++__trig) \ for (__trig = SECTION_START(tr_##TRIG); __trig < SECTION_END(tr_##TRIG); ++__trig) \
(**__trig)(__VA_ARGS__); \ (**__trig)(__VA_ARGS__); \
} while (0); } while (0)
#endif // __SERVAL_DNA__TRIGGER_H #endif // __SERVAL_DNA__TRIGGER_H