-
Notifications
You must be signed in to change notification settings - Fork 567
Closed
Description
Compiling openal-soft with a compiler that supports C11 atomics (in my case clang 3.4.0) is not possible:
...
-- The C compiler identification is Clang 3.4.0
-- The CXX compiler identification is Clang 3.4.0
-- Check for working C compiler: /usr/bin/cc
...
-- Performing Test HAVE_C11_STATIC_ASSERT
-- Performing Test HAVE_C11_STATIC_ASSERT - Success
-- Performing Test HAVE_C11_ALIGNAS
-- Performing Test HAVE_C11_ALIGNAS - Success
-- Performing Test HAVE_C11_ATOMIC
-- Performing Test HAVE_C11_ATOMIC - Success
...
...
[ 4%] Building C object CMakeFiles/makehrtf.dir/utils/makehrtf.c.o
[ 6%] Building C object CMakeFiles/common.dir/common/atomic.c.o
[ 8%] Building C object CMakeFiles/common.dir/common/rwlock.c.o
In file included from /usr/home/marcus/devel/openal-soft-1.16.0/common/atomic.c:4:
/usr/home/marcus/devel/openal-soft-1.16.0/include/atomic.h:19:10: error: address argument to atomic operation must be a pointer to _Atomic type ('volatile int *' invalid)
{ return atomic_exchange(ptr, newval); }
^ ~~~
/usr/include/stdatomic.h:350:2: note: expanded from macro 'atomic_exchange'
atomic_exchange_explicit(object, desired, memory_order_seq_cst)
^
/usr/include/stdatomic.h:243:2: note: expanded from macro 'atomic_exchange_explicit'
__c11_atomic_exchange(object, desired, order)
^
...
The definitions in atomic.h
inline int ExchangeInt(volatile int *ptr, int newval)
{ return atomic_exchange(ptr, newval); }
inline void *ExchangePtr(XchgPtr *ptr, void *newval)
{ return atomic_exchange(ptr, newval); }
just pass pointers into atomic_exchange() without a proper cast or a ATOMIC_VAR_INIT()
initialization.
Metadata
Metadata
Assignees
Labels
No labels