Skip to content

Commit

Permalink
*: require semicolon after DEFINE_<typesafe...>
Browse files Browse the repository at this point in the history
Again, see previous commits.

Signed-off-by: David Lamparter <equinox@diac24.net>
  • Loading branch information
eqvinox committed Mar 17, 2021
1 parent 96244ac commit 960b9a5
Show file tree
Hide file tree
Showing 44 changed files with 141 additions and 131 deletions.
4 changes: 2 additions & 2 deletions bgpd/bgp_advertise.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include "lib/typesafe.h"

PREDECL_DLIST(bgp_adv_fifo)
PREDECL_DLIST(bgp_adv_fifo);

struct update_subgroup;

Expand Down Expand Up @@ -60,7 +60,7 @@ struct bgp_advertise {
struct bgp_path_info *pathi;
};

DECLARE_DLIST(bgp_adv_fifo, struct bgp_advertise, fifo)
DECLARE_DLIST(bgp_adv_fifo, struct bgp_advertise, fifo);

/* BGP adjacency out. */
struct bgp_adj_out {
Expand Down
19 changes: 10 additions & 9 deletions bgpd/bgp_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static uint32_t bmp_bgp_hash(const struct bmp_bgp *e)
return jhash(&e->bgp, sizeof(e->bgp), 0x55aa5a5a);
}

DECLARE_HASH(bmp_bgph, struct bmp_bgp, bbi, bmp_bgp_cmp, bmp_bgp_hash)
DECLARE_HASH(bmp_bgph, struct bmp_bgp, bbi, bmp_bgp_cmp, bmp_bgp_hash);

struct bmp_bgph_head bmp_bgph;

Expand All @@ -109,11 +109,11 @@ static uint32_t bmp_bgp_peer_hash(const struct bmp_bgp_peer *e)
}

DECLARE_HASH(bmp_peerh, struct bmp_bgp_peer, bpi,
bmp_bgp_peer_cmp, bmp_bgp_peer_hash)
bmp_bgp_peer_cmp, bmp_bgp_peer_hash);

struct bmp_peerh_head bmp_peerh;

DECLARE_LIST(bmp_mirrorq, struct bmp_mirrorq, bmi)
DECLARE_LIST(bmp_mirrorq, struct bmp_mirrorq, bmi);

/* listener management */

Expand All @@ -132,19 +132,20 @@ static int bmp_listener_cmp(const struct bmp_listener *a,
return 0;
}

DECLARE_SORTLIST_UNIQ(bmp_listeners, struct bmp_listener, bli, bmp_listener_cmp)
DECLARE_SORTLIST_UNIQ(bmp_listeners, struct bmp_listener, bli,
bmp_listener_cmp);

static int bmp_targets_cmp(const struct bmp_targets *a,
const struct bmp_targets *b)
{
return strcmp(a->name, b->name);
}

DECLARE_SORTLIST_UNIQ(bmp_targets, struct bmp_targets, bti, bmp_targets_cmp)
DECLARE_SORTLIST_UNIQ(bmp_targets, struct bmp_targets, bti, bmp_targets_cmp);

DECLARE_LIST(bmp_session, struct bmp, bsi)
DECLARE_LIST(bmp_session, struct bmp, bsi);

DECLARE_DLIST(bmp_qlist, struct bmp_queue_entry, bli)
DECLARE_DLIST(bmp_qlist, struct bmp_queue_entry, bli);

static int bmp_qhash_cmp(const struct bmp_queue_entry *a,
const struct bmp_queue_entry *b)
Expand Down Expand Up @@ -189,7 +190,7 @@ static uint32_t bmp_qhash_hkey(const struct bmp_queue_entry *e)
}

DECLARE_HASH(bmp_qhash, struct bmp_queue_entry, bhi,
bmp_qhash_cmp, bmp_qhash_hkey)
bmp_qhash_cmp, bmp_qhash_hkey);

static int bmp_active_cmp(const struct bmp_active *a,
const struct bmp_active *b)
Expand All @@ -206,7 +207,7 @@ static int bmp_active_cmp(const struct bmp_active *a,
return 0;
}

DECLARE_SORTLIST_UNIQ(bmp_actives, struct bmp_active, bai, bmp_active_cmp)
DECLARE_SORTLIST_UNIQ(bmp_actives, struct bmp_active, bai, bmp_active_cmp);

static struct bmp *bmp_new(struct bmp_targets *bt, int bmp_sock)
{
Expand Down
18 changes: 9 additions & 9 deletions bgpd/bgp_bmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
* always happens from the front of the queue.)
*/

PREDECL_DLIST(bmp_qlist)
PREDECL_HASH(bmp_qhash)
PREDECL_DLIST(bmp_qlist);
PREDECL_HASH(bmp_qhash);

struct bmp_queue_entry {
struct bmp_qlist_item bli;
Expand All @@ -92,7 +92,7 @@ struct bmp_queue_entry {
* with a size limit. Refcount works the same as for monitoring above.
*/

PREDECL_LIST(bmp_mirrorq)
PREDECL_LIST(bmp_mirrorq);

struct bmp_mirrorq {
struct bmp_mirrorq_item bmi;
Expand All @@ -112,7 +112,7 @@ enum {
BMP_AFI_LIVE,
};

PREDECL_LIST(bmp_session)
PREDECL_LIST(bmp_session);

struct bmp_active;
struct bmp_targets;
Expand Down Expand Up @@ -166,7 +166,7 @@ struct bmp {
* succeeds, "bmp" is set up.
*/

PREDECL_SORTLIST_UNIQ(bmp_actives)
PREDECL_SORTLIST_UNIQ(bmp_actives);

#define BMP_DFLT_MINRETRY 30000
#define BMP_DFLT_MAXRETRY 720000
Expand All @@ -191,7 +191,7 @@ struct bmp_active {
};

/* config & state for passive / listening sockets */
PREDECL_SORTLIST_UNIQ(bmp_listeners)
PREDECL_SORTLIST_UNIQ(bmp_listeners);

struct bmp_listener {
struct bmp_listeners_item bli;
Expand All @@ -209,7 +209,7 @@ struct bmp_listener {
* bmp_active items. If they have the same config, BMP session should be
* put in the same targets since that's a bit more effective.
*/
PREDECL_SORTLIST_UNIQ(bmp_targets)
PREDECL_SORTLIST_UNIQ(bmp_targets);

struct bmp_targets {
struct bmp_targets_item bti;
Expand Down Expand Up @@ -251,7 +251,7 @@ DECLARE_QOBJ_TYPE(bmp_targets);

/* per struct peer * data. Lookup by peer->qobj_node.nid, created on demand,
* deleted in peer_backward hook. */
PREDECL_HASH(bmp_peerh)
PREDECL_HASH(bmp_peerh);

struct bmp_bgp_peer {
struct bmp_peerh_item bpi;
Expand All @@ -267,7 +267,7 @@ struct bmp_bgp_peer {
};

/* per struct bgp * data */
PREDECL_HASH(bmp_bgph)
PREDECL_HASH(bmp_bgph);

#define BMP_PEER_DOWN_NO_RELEVANT_EVENT_CODE 0x00

Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_labelpool.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct lp_fifo {
struct lp_lcb lcb;
};

DECLARE_LIST(lp_fifo, struct lp_fifo, fifo)
DECLARE_LIST(lp_fifo, struct lp_fifo, fifo);

struct lp_cbq_item {
int (*cbfunc)(mpls_label_t label, void *lblid, bool alloc);
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_labelpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#define LP_TYPE_VRF 0x00000001
#define LP_TYPE_BGP_LU 0x00000002

PREDECL_LIST(lp_fifo)
PREDECL_LIST(lp_fifo);

struct labelpool {
struct skiplist *ledger; /* all requests */
Expand Down
10 changes: 5 additions & 5 deletions doc/developer/lists.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ The common setup pattern will look like this:
#include <typesafe.h>
PREDECL_XXX(Z)
PREDECL_XXX(Z);
struct item {
int otherdata;
struct Z_item mylistitem;
Expand All @@ -149,20 +149,20 @@ The common setup pattern will look like this:
struct Z_head mylisthead;
/* unsorted: */
DECLARE_XXX(Z, struct item, mylistitem)
DECLARE_XXX(Z, struct item, mylistitem);
/* sorted, items that compare as equal cannot be added to list */
int compare_func(const struct item *a, const struct item *b);
DECLARE_XXX_UNIQ(Z, struct item, mylistitem, compare_func)
DECLARE_XXX_UNIQ(Z, struct item, mylistitem, compare_func);
/* sorted, items that compare as equal can be added to list */
int compare_func(const struct item *a, const struct item *b);
DECLARE_XXX_NONUNIQ(Z, struct item, mylistitem, compare_func)
DECLARE_XXX_NONUNIQ(Z, struct item, mylistitem, compare_func);
/* hash tables: */
int compare_func(const struct item *a, const struct item *b);
uint32_t hash_func(const struct item *a);
DECLARE_XXX(Z, struct item, mylistitem, compare_func, hash_func)
DECLARE_XXX(Z, struct item, mylistitem, compare_func, hash_func);
``XXX`` is replaced with the name of the data structure, e.g. ``SKIPLIST``
or ``ATOMLIST``. The ``DECLARE_XXX`` invocation can either occur in a `.h`
Expand Down
8 changes: 4 additions & 4 deletions isisd/isis_lfa.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include "lib/typesafe.h"
#include "lib/zclient.h"

PREDECL_RBTREE_UNIQ(lfa_tiebreaker_tree)
PREDECL_RBTREE_UNIQ(rlfa_tree)
PREDECL_RBTREE_UNIQ(lfa_tiebreaker_tree);
PREDECL_RBTREE_UNIQ(rlfa_tree);

enum lfa_tiebreaker_type {
LFA_TIEBREAKER_DOWNSTREAM = 0,
Expand All @@ -41,7 +41,7 @@ struct lfa_tiebreaker {
int lfa_tiebreaker_cmp(const struct lfa_tiebreaker *a,
const struct lfa_tiebreaker *b);
DECLARE_RBTREE_UNIQ(lfa_tiebreaker_tree, struct lfa_tiebreaker, entry,
lfa_tiebreaker_cmp)
lfa_tiebreaker_cmp);

struct rlfa {
struct rlfa_tree_item entry;
Expand All @@ -50,7 +50,7 @@ struct rlfa {
struct in_addr pq_address;
};
int rlfa_cmp(const struct rlfa *a, const struct rlfa *b);
DECLARE_RBTREE_UNIQ(rlfa_tree, struct rlfa, entry, rlfa_cmp)
DECLARE_RBTREE_UNIQ(rlfa_tree, struct rlfa, entry, rlfa_cmp);

enum isis_tilfa_sid_type {
TILFA_SID_PREFIX = 1,
Expand Down
4 changes: 2 additions & 2 deletions isisd/isis_lsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "lib/typesafe.h"
#include "isisd/isis_pdu.h"

PREDECL_RBTREE_UNIQ(lspdb)
PREDECL_RBTREE_UNIQ(lspdb);

struct isis;
/* Structure for isis_lsp, this structure will only support the fixed
Expand Down Expand Up @@ -61,7 +61,7 @@ struct isis_lsp {
};

extern int lspdb_compare(const struct isis_lsp *a, const struct isis_lsp *b);
DECLARE_RBTREE_UNIQ(lspdb, struct isis_lsp, dbe, lspdb_compare)
DECLARE_RBTREE_UNIQ(lspdb, struct isis_lsp, dbe, lspdb_compare);

void lsp_db_init(struct lspdb_head *head);
void lsp_db_fini(struct lspdb_head *head);
Expand Down
2 changes: 1 addition & 1 deletion isisd/isis_sr.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static inline int sr_prefix_sid_cfg_compare(const struct sr_prefix_cfg *a,
return prefix_cmp(&a->prefix, &b->prefix);
}
DECLARE_RBTREE_UNIQ(srdb_prefix_cfg, struct sr_prefix_cfg, entry,
sr_prefix_sid_cfg_compare)
sr_prefix_sid_cfg_compare);

/**
* Find SRGB associated to a System ID.
Expand Down
2 changes: 1 addition & 1 deletion isisd/isis_sr.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#define SRLB_UPPER_BOUND 15999

/* Segment Routing Data Base (SRDB) RB-Tree structure */
PREDECL_RBTREE_UNIQ(srdb_prefix_cfg)
PREDECL_RBTREE_UNIQ(srdb_prefix_cfg);

/*
* Segment Routing Prefix-SID information.
Expand Down
22 changes: 12 additions & 10 deletions lib/atomlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,16 @@ struct atomlist_head {

/* use as:
*
* PREDECL_ATOMLIST(namelist)
* PREDECL_ATOMLIST(namelist);
* struct name {
* struct namelist_item nlitem;
* }
* DECLARE_ATOMLIST(namelist, struct name, nlitem)
* DECLARE_ATOMLIST(namelist, struct name, nlitem);
*/
#define PREDECL_ATOMLIST(prefix) \
struct prefix ## _head { struct atomlist_head ah; }; \
struct prefix ## _item { struct atomlist_item ai; };
struct prefix ## _item { struct atomlist_item ai; }; \
MACRO_REQUIRE_SEMICOLON() /* end */

#define INIT_ATOMLIST(var) { }

Expand Down Expand Up @@ -171,7 +172,7 @@ macro_inline void prefix ## _fini(struct prefix##_head *h) \
assert(prefix ## _count(h) == 0); \
memset(h, 0, sizeof(*h)); \
} \
/* ... */
MACRO_REQUIRE_SEMICOLON() /* end */

/* add_head:
* - contention on ->first pointer
Expand Down Expand Up @@ -221,7 +222,8 @@ struct atomsort_head {

#define _PREDECL_ATOMSORT(prefix) \
struct prefix ## _head { struct atomsort_head ah; }; \
struct prefix ## _item { struct atomsort_item ai; };
struct prefix ## _item { struct atomsort_item ai; }; \
MACRO_REQUIRE_SEMICOLON() /* end */

#define INIT_ATOMSORT_UNIQ(var) { }
#define INIT_ATOMSORT_NONUNIQ(var) { }
Expand Down Expand Up @@ -298,7 +300,7 @@ macro_inline type *prefix ## _pop(struct prefix##_head *h) \
struct atomsort_item *p = atomsort_pop(&h->ah); \
return p ? container_of(p, type, field.ai) : NULL; \
} \
/* ... */
MACRO_REQUIRE_SEMICOLON() /* end */

#define PREDECL_ATOMSORT_UNIQ(prefix) \
_PREDECL_ATOMSORT(prefix)
Expand All @@ -312,7 +314,7 @@ macro_inline int prefix ## __cmp(const struct atomsort_item *a, \
} \
\
_DECLARE_ATOMSORT(prefix, type, field, \
prefix ## __cmp, prefix ## __cmp) \
prefix ## __cmp, prefix ## __cmp); \
\
atomic_find_warn \
macro_inline type *prefix ## _find(struct prefix##_head *h, const type *item) \
Expand All @@ -325,7 +327,7 @@ macro_inline type *prefix ## _find(struct prefix##_head *h, const type *item) \
return NULL; \
return p; \
} \
/* ... */
MACRO_REQUIRE_SEMICOLON() /* end */

#define PREDECL_ATOMSORT_NONUNIQ(prefix) \
_PREDECL_ATOMSORT(prefix)
Expand All @@ -352,8 +354,8 @@ macro_inline int prefix ## __cmp_uq(const struct atomsort_item *a, \
} \
\
_DECLARE_ATOMSORT(prefix, type, field, \
prefix ## __cmp, prefix ## __cmp_uq) \
/* ... */
prefix ## __cmp, prefix ## __cmp_uq); \
MACRO_REQUIRE_SEMICOLON() /* end */

struct atomsort_item *atomsort_add(struct atomsort_head *h,
struct atomsort_item *item, int (*cmpfn)(
Expand Down
2 changes: 1 addition & 1 deletion lib/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

static struct debug_cb_list_head cb_head;

DECLARE_LIST(debug_cb_list, struct debug_callbacks, item)
DECLARE_LIST(debug_cb_list, struct debug_callbacks, item);

/* All code in this section should be reentrant and MT-safe */

Expand Down
2 changes: 1 addition & 1 deletion lib/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct debug {
const char *desc;
};

PREDECL_LIST(debug_cb_list)
PREDECL_LIST(debug_cb_list);
/*
* Callback set for debugging code.
*
Expand Down
4 changes: 2 additions & 2 deletions lib/elf_py.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static PyObject *refuse_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
struct elfreloc;
struct elfsect;

PREDECL_HASH(elfrelocs)
PREDECL_HASH(elfrelocs);

/* ELFFile and ELFSection intentionally share some behaviour, particularly
* subscript[123:456] access to file data. This is because relocatables
Expand Down Expand Up @@ -200,7 +200,7 @@ static int elfreloc_cmp(const struct elfreloc *a, const struct elfreloc *b);
static uint32_t elfreloc_hash(const struct elfreloc *reloc);

DECLARE_HASH(elfrelocs, struct elfreloc, elfrelocs_item,
elfreloc_cmp, elfreloc_hash)
elfreloc_cmp, elfreloc_hash);

static Elf_Scn *elf_find_addr(struct elffile *ef, uint64_t addr, size_t *idx);
static PyObject *elffile_secbyidx(struct elffile *w, Elf_Scn *scn, size_t idx);
Expand Down
Loading

0 comments on commit 960b9a5

Please sign in to comment.