summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68>2022-06-24 13:23:59 +0000
committerylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68>2022-06-24 13:23:59 +0000
commit09f1a19753c98eab09f4a29c8648ca05d6f53fe9 (patch)
tree81c6872f67f407ec983b2fc7d9c450411f67d853
parent70be869c12b7792da4c238b3f3682cc0f834e573 (diff)
downloadlibapr-09f1a19753c98eab09f4a29c8648ca05d6f53fe9.tar.gz
atomic: Fix -Wincompatible-pointer-types-discards-qualifiers
atomic/unix/builtins.c:117:38: warning: passing 'void **' to parameter of type 'volatile void **' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers] __atomic_compare_exchange_n(mem, (void **)&cmp, ptr, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); ^~~~~~~~~~~~~ This warning is weird, because 'volatile void **' is not a thing usually, it happens on macos in apr-1.x, where apr_atomic_casptr() is (ill-)defined as: APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *ptr, const void *cmp); but not on trunk's: APR_DECLARE(void*) apr_atomic_casptr(void *volatile *mem, void *ptr, const void *cmp); The mark clearly indicates that (void **)&cmp is the culprit though (compiler bug?). Let's see if using the generic (void *) cast helps, the goal of the (void **) cast was to remove constantness only (__atomic_compare_exchange_n will modify the pointer on stack, but not the pointed to value), (void *) will do that too without any volatile qualifier issue possibly. Merge r1902233 from trunk. Submitted by: ylavic git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.8.x@1902234 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--atomic/unix/builtins.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/atomic/unix/builtins.c b/atomic/unix/builtins.c
index 22b828c3c..6aaae1ba2 100644
--- a/atomic/unix/builtins.c
+++ b/atomic/unix/builtins.c
@@ -114,7 +114,7 @@ APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint
APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *ptr, const void *cmp)
{
#if HAVE__ATOMIC_BUILTINS
- __atomic_compare_exchange_n(mem, (void **)&cmp, ptr, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
+ __atomic_compare_exchange_n(mem, (void *)&cmp, ptr, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
return (void *)cmp;
#else
return (void *)__sync_val_compare_and_swap(mem, (void *)cmp, ptr);