]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/atomlist.h
Merge pull request #13108 from opensourcerouting/clippy-string-warn
[mirror_frr.git] / lib / atomlist.h
index 5ca19cbcd4c7f21c8ada9c9225ca4e018f26e92f..2b6a3a176f94ee2741e01b2599164bcf51e8ecb3 100644 (file)
@@ -1,17 +1,6 @@
+// SPDX-License-Identifier: ISC
 /*
  * Copyright (c) 2016-2019  David Lamparter, for NetDEF, Inc.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
 #ifndef _FRR_ATOMLIST_H
@@ -100,7 +89,7 @@ static inline bool atomptr_u(atomptr_t val)
 /* single-linked list, unsorted/arbitrary.
  * can be used as queue with add_tail / pop
  *
- * all operations are lock-free, but not neccessarily wait-free.  this means
+ * all operations are lock-free, but not necessarily wait-free.  this means
  * that there is no state where the system as a whole stops making process,
  * but it *is* possible that a *particular* thread is delayed by some time.
  *
@@ -123,15 +112,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) { }
 
@@ -171,7 +161,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
@@ -221,7 +211,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)     { }
@@ -298,7 +289,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)
@@ -312,7 +303,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)  \
@@ -325,7 +316,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)
@@ -352,8 +343,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)(