Rémi Bernon rbernon@codeweavers.com writes:
The implementation and use of __atomic_store_n is fine, it's just values of __GNUC__ and __GNUC_MINOR__ that we can't trust on clang, so it's only #if that could be improved. In practice, you could probably just add "|| defined(__clang__)" there. There is also__has_builtin(__atomic_store_n) that could be used, but I'm not sure it's worth it. We could also avoid dealing with hardcoded compiler version and use a configure check.
Yes, I'm planning on adding a __clang__ version check, as some quick test tells me that __atomic builtins are only supported for clang >= 3.1.
But then, as the fallback isn't very reliable and depends on the guarantees that the target architecture provides, it can either simply be completely unsupported and report a compilation error, or we can try to be a bit clever and have it only for X86 (but that may not be a good idea).
If the fallback code is good enough for x86, you could make that the default, and then have the __atomic code be the fallback on other architectures. Then you don't need compiler checks, we can assume that we have a recent compiler on the more "exotic" architectures.