• Robert S. Edmonds's avatar
    Expose generic atomicops on Clang · 628a23ba
    Robert S. Edmonds authored
    The generic atomicops implementation is only exposed if GCC >= 4.7 is
    available, but Clang, where the underlying __atomic built-ins are also
    available, typically only claims to be GCC 4.2. This causes build
    failures when compiling protobuf or the output of protoc's C++ code
    generator on an architecture that needs the generic atomicops
    implementation with Clang.
    
    Clang has a "c_atomic" extension which can be tested for which almost
    does what we want:
    
        C11 atomic operations
    
        Use __has_feature(c_atomic) or __has_extension(c_atomic) to
        determine if support for atomic types using _Atomic is enabled.
        Clang also provides a set of builtins which can be used to implement
        the <stdatomic.h> operations on _Atomic types.
    
    I'm not sure if this guarantees that the GNU atomic builtins (the ones
    with the __atomic prefix) are also available, but in practice this
    should guarantee that Clang is new enough.
    
    With this change in place, Clang generates several diagnostics when
    compiling the generic atomicops implementation. These appear to be bugs
    in the generic atomicops implementation and are not Clang-specific.
    628a23ba
Name
Last commit
Last update
benchmarks Loading commit data...
editors Loading commit data...
examples Loading commit data...
java Loading commit data...
m4 Loading commit data...
more_tests Loading commit data...
python Loading commit data...
src Loading commit data...
vsprojects Loading commit data...
CHANGES.txt Loading commit data...
CONTRIBUTORS.txt Loading commit data...
INSTALL.txt Loading commit data...
LICENSE Loading commit data...
Makefile.am Loading commit data...
README.md Loading commit data...
autogen.sh Loading commit data...
configure.ac Loading commit data...
generate_descriptor_proto.sh Loading commit data...
post_process_dist.sh Loading commit data...
protobuf-lite.pc.in Loading commit data...
protobuf.pc.in Loading commit data...