]> git.lttng.org Git - urcu.git/commitdiff
rculfhash: Only pass integral types to atomic builtins
authorOlivier Dion <odion@efficios.com>
Thu, 21 Sep 2023 20:16:21 +0000 (16:16 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 23 Sep 2023 06:00:49 +0000 (07:00 +0100)
Clang expects the pointers passed to atomic builtins to be integral. Fix
this by casting nodes address to uintptr_t *.

Change-Id: Ifb8833c493df849a542a22f0bb2baeeb85be0297
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/rculfhash.c

index 09cd2b79cd33aa91c75e6d3982aab7faf7a03137..a453326a4124f11ac06aeb14697214d99b3c020d 100644 (file)
@@ -1153,7 +1153,7 @@ int _cds_lfht_del(struct cds_lfht *ht, unsigned long size,
                struct cds_lfht_node *node)
 {
        struct cds_lfht_node *bucket, *next;
-       struct cds_lfht_node **node_next;
+       uintptr_t *node_next;
 
        if (!node)      /* Return -ENOENT if asked to delete NULL node */
                return -ENOENT;
@@ -1185,7 +1185,7 @@ int _cds_lfht_del(struct cds_lfht *ht, unsigned long size,
         * NOTE: The node_next variable is present to avoid breaking
         * strict-aliasing rules.
         */
-       node_next = &node->next;
+       node_next = (uintptr_t*)&node->next;
        uatomic_or_mo(node_next, REMOVED_FLAG, CMM_RELEASE);
 
        /* We performed the (logical) deletion. */
@@ -1426,7 +1426,7 @@ void remove_table_partition(struct cds_lfht *ht, unsigned long i,
        for (j = size + start; j < size + start + len; j++) {
                struct cds_lfht_node *fini_bucket = bucket_at(ht, j);
                struct cds_lfht_node *parent_bucket = bucket_at(ht, j - size);
-               struct cds_lfht_node **fini_bucket_next;
+               uintptr_t *fini_bucket_next;
 
                urcu_posix_assert(j >= size && j < (size << 1));
                dbg_printf("remove entry: order %lu index %lu hash %lu\n",
@@ -1436,7 +1436,7 @@ void remove_table_partition(struct cds_lfht *ht, unsigned long i,
                 * NOTE: The fini_bucket_next variable is present to
                 * avoid breaking strict-aliasing rules.
                 */
-               fini_bucket_next = &fini_bucket->next;
+               fini_bucket_next = (uintptr_t*)&fini_bucket->next;
                uatomic_or(fini_bucket_next, REMOVED_FLAG);
                _cds_lfht_gc_bucket(parent_bucket, fini_bucket);
        }
This page took 0.031513 seconds and 4 git commands to generate.