Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r2857:018427a42764 Date: 2017-01-13 11:02 +0100 http://bitbucket.org/cffi/cffi/changeset/018427a42764/
Log: Use __sync_synchronize() only if setup.py detects we have it. Fix for people using an incredibly old gcc. diff --git a/c/call_python.c b/c/call_python.c --- a/c/call_python.c +++ b/c/call_python.c @@ -177,7 +177,7 @@ #if (defined(WITH_THREAD) && !defined(_MSC_VER) && \ !defined(__amd64__) && !defined(__x86_64__) && \ !defined(__i386__) && !defined(__i386)) -# if defined(__GNUC__) +# if defined(HAVE_SYNC_SYNCHRONIZE) # define read_barrier() __sync_synchronize() # elif defined(_AIX) # define read_barrier() __lwsync() diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -69,7 +69,22 @@ if not ok1: no_working_compiler_found() sys.stderr.write("Note: will not use '__thread' in the C code\n") - sys.stderr.write("The above error message can be safely ignored\n") + _safe_to_ignore() + +def ask_supports_sync_synchronize(): + if sys.platform == 'win32': + return + config = get_config() + ok = config.try_link('int main(void) { __sync_synchronize(); return 0; }') + if ok: + define_macros.append(('HAVE_SYNC_SYNCHRONIZE', None)) + else: + sys.stderr.write("Note: will not use '__sync_synchronize()'" + " in the C code\n") + _safe_to_ignore() + +def _safe_to_ignore(): + sys.stderr.write("***** The above error message can be safely ignored.\n\n") def uses_msvc(): config = get_config() @@ -118,6 +133,7 @@ else: use_pkg_config() ask_supports_thread() + ask_supports_sync_synchronize() if 'freebsd' in sys.platform: include_dirs.append('/usr/local/include') _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit