Mojca Miklavec added the comment: Is anyone willing to help me a bit to come up with a pull request?
I took some ideas from here: https://fossies.org/diffs/xscreensaver/5.30_vs_5.32/utils/thread_util.c-diff.html Citation from that patch: Clang 3.0 has a partial implementation of GNU atomics; 3.1 rounds it out. http://llvm.org/viewvc/llvm-project/cfe/tags/RELEASE_30/final/include/clang/Basic/Builtins.def?view=markup http://llvm.org/viewvc/llvm-project/cfe/tags/RELEASE_31/final/include/clang/Basic/Builtins.def?view=markup Apple changes the Clang version to track Xcode versions; use __apple_build_version__ to distinguish between the two. Xcode 4.3 uses Apple LLVM 3.1, which corresponds to Clang 3.1. https://en.wikipedia.org/wiki/Xcode One should probably adapt this into "at least clang 3.3 (or perhaps even 3.4?) is needed". Now, the basic test in configure.ac is the following: volatile int val = 1; int main() { __atomic_load_n(&val, __ATOMIC_SEQ_CST); return 0; } With clang on 10.7 (Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)) this compiles, runs and returns 0. Evidently a more complex test is needed to trigger the error, but I'm not sure that that test should be since I don't have enough experience with "atomic". If you have a clue what functionality I should test, I will gladly do it and try to come up with a better test. An alternative could be to blacklist a compiler and this is what I am proposing here as a very naive approach: volatile int val = 1; int main() { __atomic_load_n(&val, __ATOMIC_SEQ_CST); #define VERSION_CHECK(cc_major, cc_minor, req_major, req_minor) \ ((cc_major) > (req_major) || \ (cc_major) == (req_major) && (cc_minor) >= (req_minor)) #if defined(__clang__) #if defined(__apple_build_version__) // either one test or the other should work // #if __apple_build_version__ < 5000000 #if !VERSION_CHECK(__clang_major__, __clang_minor__, 5, 0) this_should_fail(); #endif // not sure if this is 3.3 or 3.4 #elif !VERSION_CHECK(__clang_major__, __clang_minor__, 3, 3) this_should_fail(); #endif #endif return 0; } ---------- nosy: +Mojca Miklavec _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24844> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com