diff --git a/src/shared/verbs.h b/src/shared/verbs.h index 51a9e3a525..4fb0486f75 100644 --- a/src/shared/verbs.h +++ b/src/shared/verbs.h @@ -39,19 +39,27 @@ typedef struct { .help = h, \ } -#define VERB_FULL(d, v, a, amin, amax, f, dat, h) \ +/* Forward-define function d. scope specifies the scope, e.g. static. */ +#define VERB_SCOPE_FULL(scope, d, v, a, amin, amax, f, dat, h) \ DISABLE_WARNING_REDUNDANT_DECLS \ - static int d(int, char**, uintptr_t, void*); \ + scope int d(int, char**, uintptr_t, void*); \ REENABLE_WARNING \ _VERB_DATA(d, v, a, amin, amax, f, dat, h) +/* The same as VERB_SCOPE_FULL with scope hardwired to 'static'. */ +#define VERB_FULL(d, v, a, amin, amax, f, dat, h) \ + VERB_SCOPE_FULL(static, d, v, a, amin, amax, f, dat, h) -/* The same as VERB_FULL, but without the data argument */ +/* The same as VERB_SCOPE_FULL/VERB_FULL, but without the data argument. */ +#define VERB_SCOPE(scope, d, v, a, amin, amax, f, h) \ + VERB_SCOPE_FULL(scope, d, v, a, amin, amax, f, /* dat= */ 0, h) #define VERB(d, v, a, amin, amax, f, h) \ - VERB_FULL(d, v, a, amin, amax, f, /* dat= */ 0, h) + VERB_SCOPE(static, d, v, a, amin, amax, f, h) -/* Simplified VERB for parameters that take no argument */ +/* Simplified VERB_SCOPE/VERB for verbs that take no argument. */ +#define VERB_SCOPE_NOARG(scope, d, v, h) \ + VERB_SCOPE(scope, d, v, /* a= */ NULL, /* amin= */ VERB_ANY, /* amax= */ 1, /* f= */ 0, h) #define VERB_NOARG(d, v, h) \ - VERB(d, v, /* a= */ NULL, /* amin= */ VERB_ANY, /* amax= */ 1, /* f= */ 0, h) + VERB_SCOPE_NOARG(static, d, v, h) /* Magic entry in the table (which will not be returned) that designates the start of the group . * The macro works as a separator between groups and must be between other VERB* stanzas. */