• Robert Edmonds's avatar
    Fix atomicops build failure on non-Clang · 7432af82
    Robert Edmonds authored
    We cannot use Clang's __has_extension macro unless we really are
    compiling on Clang, which means we cannot use this expression:
    
        #if (defined(__clang__) && __has_extension(c_atomic)))
        // ...
        #endif
    
    On GCC, this generates the following errors:
    
        In file included from ./google/protobuf/stubs/atomicops.h:59:0,
                         from google/protobuf/stubs/atomicops_internals_x86_gcc.cc:36:
        ./google/protobuf/stubs/platform_macros.h:67:41: error: missing binary operator before token "("
           (defined(__clang__) && __has_extension(c_atomic)))
                                                 ^
        In file included from google/protobuf/stubs/atomicops_internals_x86_gcc.cc:36:0:
        ./google/protobuf/stubs/atomicops.h:196:40: error: missing binary operator before token "("
          (defined(__clang__) && __has_extension(c_atomic))
                                                ^
    
    Instead, we have to protect the __has_extension expression by only
    executing it when __clang__ is defined:
    
        #if defined(__clang__)
        # if __has_extension(c_atomic)
        // ...
        # endif
        #endif
    7432af82
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...