[PATCH] Remove misleading XOR

tbaeder@redhat.com tbaeder@redhat.com
Wed Feb 17 10:12:16 GMT 2021


From: Timm Bäder <tbaeder@redhat.com>

Clang complains about this because it has -Wxor-used-as-pow:

../../lib/dynamicsizehash_concurrent.c:288:61: error: result of 'CLEANING ^ NO_RESIZING' is 2; did you mean '1 << NO_RESIZING' (1)? [-Werror,-Wxor-used-as-pow]
  atomic_fetch_xor_explicit(&htab->resizing_state, CLEANING ^ NO_RESIZING,
                                                   ~~~~~~~~~^~~~~~~~~~~~~
                                                   1
../../lib/dynamicsizehash_concurrent.c:288:61: note: replace expression with '0x2 ^ NO_RESIZING' to silence this warning

The result of CLEANING ^ NO_RESIZING is CLEANING, since NO_RESIZING is
0.
---
 lib/dynamicsizehash_concurrent.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/dynamicsizehash_concurrent.c b/lib/dynamicsizehash_concurrent.c
index 2d53bec6..7d314d32 100644
--- a/lib/dynamicsizehash_concurrent.c
+++ b/lib/dynamicsizehash_concurrent.c
@@ -285,7 +285,7 @@ resize_master(NAME *htab)
   free(htab->old_table);
 
   /* Change state to NO_RESIZING */
-  atomic_fetch_xor_explicit(&htab->resizing_state, CLEANING ^ NO_RESIZING,
+  atomic_fetch_xor_explicit(&htab->resizing_state, CLEANING,
                             memory_order_relaxed);
 
 }
-- 
2.26.2



More information about the Elfutils-devel mailing list