volatile values cannot be used in atomic builtins in C++ starting in GCC 11
It seems that GCC 11 disallows const
or volatile
-qualified values in the C11 atomic builtins starting in GCC 11. This is bad news for functions like gpointer g_atomic_pointer_get(const volatile void *atomic)
on platforms that have __ATOMIC_SEQ_CST
. For C programs it won't be such a problem, as it will just be a -Wpedantic
warning, but for C++ programs it is an error. I'm not sure what the best way to fix this would be. Maybe not use the C11 builtins in C++, and use C++ std::atomic
instead?
This leads to bug reports like this: gjs#376 (closed)
I'm not sure why this change was made, but here's all the context I can find: