Commit 117f7716 authored by Bo Yang's avatar Bo Yang

Update _GNUC_VER to use the correct implementation of atomic operation on Mac.

parent 2f38ce1f
...@@ -5,6 +5,7 @@ import glob ...@@ -5,6 +5,7 @@ import glob
import os import os
import subprocess import subprocess
import sys import sys
import platform
# We must use setuptools, not distutils, because we need to use the # We must use setuptools, not distutils, because we need to use the
# namespace_packages option for the "google" package. # namespace_packages option for the "google" package.
...@@ -189,6 +190,12 @@ if __name__ == '__main__': ...@@ -189,6 +190,12 @@ if __name__ == '__main__':
if "clang" in os.popen('$CC --version 2> /dev/null').read(): if "clang" in os.popen('$CC --version 2> /dev/null').read():
extra_compile_args.append('-Wno-shorten-64-to-32') extra_compile_args.append('-Wno-shorten-64-to-32')
v, _, _ = platform.mac_ver()
if not v:
v = float('.'.join(v.split('.')[:2]))
if v >= 10.12:
extra_compile_args=['-std=c++11'],
if warnings_as_errors in sys.argv: if warnings_as_errors in sys.argv:
extra_compile_args.append('-Werror') extra_compile_args.append('-Werror')
sys.argv.remove(warnings_as_errors) sys.argv.remove(warnings_as_errors)
......
...@@ -196,7 +196,6 @@ Atomic64 Release_Load(volatile const Atomic64* ptr); ...@@ -196,7 +196,6 @@ Atomic64 Release_Load(volatile const Atomic64* ptr);
// Apple. // Apple.
#elif defined(GOOGLE_PROTOBUF_OS_APPLE) #elif defined(GOOGLE_PROTOBUF_OS_APPLE)
#pragma message(_GNUC_VER)
#if __has_feature(cxx_atomic) || _GNUC_VER >= 407 #if __has_feature(cxx_atomic) || _GNUC_VER >= 407
#include <google/protobuf/stubs/atomicops_internals_generic_c11_atomic.h> #include <google/protobuf/stubs/atomicops_internals_generic_c11_atomic.h>
#else // __has_feature(cxx_atomic) || _GNUC_VER >= 407 #else // __has_feature(cxx_atomic) || _GNUC_VER >= 407
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment