mirror of
git://repo.or.cz/tinycc.git
synced 2026-06-17 15:44:18 +08:00
Fix false warnings with readonly atomics
Some checks failed
build and test / test-x86_64-linux (push) Has been cancelled
build and test / test-x86_64-osx (push) Has been cancelled
build and test / test-aarch64-osx (push) Has been cancelled
build and test / test-x86_64-win32 (push) Has been cancelled
build and test / test-i386-win32 (push) Has been cancelled
build and test / test-armv7-linux (push) Has been cancelled
build and test / test-aarch64-linux (push) Has been cancelled
build and test / test-riscv64-linux (push) Has been cancelled
Some checks failed
build and test / test-x86_64-linux (push) Has been cancelled
build and test / test-x86_64-osx (push) Has been cancelled
build and test / test-aarch64-osx (push) Has been cancelled
build and test / test-x86_64-win32 (push) Has been cancelled
build and test / test-i386-win32 (push) Has been cancelled
build and test / test-armv7-linux (push) Has been cancelled
build and test / test-aarch64-linux (push) Has been cancelled
build and test / test-riscv64-linux (push) Has been cancelled
Code like:
#include <stdatomic.h>
_Atomic const int ai; int aiGet(void){ return atomic_load(&ai); }
has been raising "warning: assignment of read-only location".
This is due to `__typeof__ (*ptr) tmp;` not rvalue-converting the target
type.
This commit is contained in:
parent
5675177b7f
commit
b39da9f6fa
@ -100,7 +100,7 @@ typedef struct {
|
||||
__val; })
|
||||
#define atomic_load_explicit(object, order) \
|
||||
({ __typeof__ (object) ptr = (object); \
|
||||
__typeof__ (*ptr) tmp; \
|
||||
__typeof__ ((void)0,*ptr) tmp; \
|
||||
__atomic_load (ptr, &tmp, (order)); \
|
||||
tmp; \
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user