Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 protobuf (2.6.0-4) unstable; urgency=medium
 .
   * Merge post-2.6.0 fixes that were merged upstream. In particular,
     protoc-generated code should now compile correctly when built with Clang.
Author: Robert Edmonds <edmonds@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- protobuf-2.6.0.orig/configure.ac
+++ protobuf-2.6.0/configure.ac
@@ -139,6 +139,9 @@ AM_CONDITIONAL([USE_EXTERNAL_PROTOC], [t
 ACX_PTHREAD
 AC_CXX_STL_HASH
 
+# Need to link against rt on Solaris
+AC_SEARCH_LIBS([sched_yield], [rt], [], [AC_MSG_FAILURE([sched_yield was not found on your system])])
+
 # HACK:  Make gtest's configure script pick up our copy of CFLAGS and CXXFLAGS,
 #   since the flags added by ACX_CHECK_SUNCC must be used when compiling gtest
 #   too.
--- protobuf-2.6.0.orig/java/pom.xml
+++ protobuf-2.6.0/java/pom.xml
@@ -148,7 +148,7 @@
           <instructions>
             <Bundle-DocURL>http://code.google.com/p/protobuf</Bundle-DocURL>
             <Bundle-SymbolicName>com.google.protobuf</Bundle-SymbolicName>
-            <Export-Package>com.google.protobuf;version=2.5.0</Export-Package>
+            <Export-Package>com.google.protobuf;version=2.6.0</Export-Package>
           </instructions>
         </configuration>
       </plugin>
--- protobuf-2.6.0.orig/python/setup.py
+++ protobuf-2.6.0/python/setup.py
@@ -7,18 +7,8 @@ import subprocess
 
 # We must use setuptools, not distutils, because we need to use the
 # namespace_packages option for the "google" package.
-try:
-  from setuptools import setup, Extension
-except ImportError:
-  try:
-    from ez_setup import use_setuptools
-    use_setuptools()
-    from setuptools import setup, Extension
-  except ImportError:
-    sys.stderr.write(
-        "Could not import setuptools; make sure you have setuptools or "
-        "ez_setup installed.\n")
-    raise
+from setuptools import setup, Extension
+
 from distutils.command.clean import clean as _clean
 from distutils.command.build_py import build_py as _build_py
 from distutils.spawn import find_executable
--- protobuf-2.6.0.orig/src/google/protobuf/compiler/command_line_interface.cc
+++ protobuf-2.6.0/src/google/protobuf/compiler/command_line_interface.cc
@@ -1559,7 +1559,7 @@ void FormatFreeFieldNumbers(const string
   string output;
   StringAppendF(&output, "%-35s free:", name.c_str());
   int next_free_number = 1;
-  for (set<FieldRange>::iterator i = ranges.begin();
+  for (set<FieldRange>::const_iterator i = ranges.begin();
        i != ranges.end(); ++i) {
     // This happens when groups re-use parent field numbers, in which
     // case we skip the FieldRange entirely.
--- protobuf-2.6.0.orig/src/google/protobuf/generated_message_reflection.cc
+++ protobuf-2.6.0/src/google/protobuf/generated_message_reflection.cc
@@ -1496,7 +1496,7 @@ inline uint32* GeneratedMessageReflectio
   return reinterpret_cast<uint32*>(ptr);
 }
 
-inline const uint32 GeneratedMessageReflection::GetOneofCase(
+inline uint32 GeneratedMessageReflection::GetOneofCase(
     const Message& message,
     const OneofDescriptor* oneof_descriptor) const {
   const void* ptr = reinterpret_cast<const uint8*>(&message)
--- protobuf-2.6.0.orig/src/google/protobuf/generated_message_reflection.h
+++ protobuf-2.6.0/src/google/protobuf/generated_message_reflection.h
@@ -368,7 +368,7 @@ class LIBPROTOBUF_EXPORT GeneratedMessag
 
   inline const uint32* GetHasBits(const Message& message) const;
   inline uint32* MutableHasBits(Message* message) const;
-  inline const uint32 GetOneofCase(
+  inline uint32 GetOneofCase(
       const Message& message,
       const OneofDescriptor* oneof_descriptor) const;
   inline uint32* MutableOneofCase(
--- protobuf-2.6.0.orig/src/google/protobuf/stubs/atomicops.h
+++ protobuf-2.6.0/src/google/protobuf/stubs/atomicops.h
@@ -194,6 +194,12 @@ GOOGLE_PROTOBUF_ATOMICOPS_ERROR
 #include <google/protobuf/stubs/atomicops_internals_pnacl.h>
 #elif (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4))
 #include <google/protobuf/stubs/atomicops_internals_generic_gcc.h>
+#elif defined(__clang__)
+#if __has_extension(c_atomic)
+#include <google/protobuf/stubs/atomicops_internals_generic_gcc.h>
+#else
+GOOGLE_PROTOBUF_ATOMICOPS_ERROR
+#endif
 #else
 GOOGLE_PROTOBUF_ATOMICOPS_ERROR
 #endif
--- protobuf-2.6.0.orig/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h
+++ protobuf-2.6.0/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h
@@ -83,7 +83,7 @@ inline void MemoryBarrier() {
 }
 
 inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
-  __atomic_store_n(ptr, value, __ATOMIC_ACQUIRE);
+  __atomic_store_n(ptr, value, __ATOMIC_SEQ_CST);
 }
 
 inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
@@ -99,7 +99,7 @@ inline Atomic32 Acquire_Load(volatile co
 }
 
 inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
-  return __atomic_load_n(ptr, __ATOMIC_RELEASE);
+  return __atomic_load_n(ptr, __ATOMIC_SEQ_CST);
 }
 
 #ifdef __LP64__
--- protobuf-2.6.0.orig/src/google/protobuf/stubs/platform_macros.h
+++ protobuf-2.6.0/src/google/protobuf/stubs/platform_macros.h
@@ -33,6 +33,9 @@
 
 #include <google/protobuf/stubs/common.h>
 
+#define GOOGLE_PROTOBUF_PLATFORM_ERROR \
+#error "Host platform was not detected as supported by protobuf"
+
 // Processor architecture detection.  For more info on what's defined, see:
 //   http://msdn.microsoft.com/en-us/library/b0084kay.aspx
 //   http://www.agner.org/optimize/calling_conventions.pdf
@@ -62,19 +65,22 @@
 #endif
 #elif defined(__pnacl__)
 #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
-#elif defined(__ppc__)
-#define GOOGLE_PROTOBUF_ARCH_PPC 1
-#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
-#elif defined(__GNUC__) && \
- (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4))
-// We fallback to the generic GCC >= 4.7 implementation in atomicops.h
+#elif defined(__GNUC__)
+# if (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4))
+// We fallback to the generic Clang/GCC >= 4.7 implementation in atomicops.h
+# elif defined(__clang__)
+#  if !__has_extension(c_atomic)
+GOOGLE_PROTOBUF_PLATFORM_ERROR
+#  endif
+// We fallback to the generic Clang/GCC >= 4.7 implementation in atomicops.h
+# endif
 # if __LP64__
 #  define GOOGLE_PROTOBUF_ARCH_64_BIT 1
 # else
 #  define GOOGLE_PROTOBUF_ARCH_32_BIT 1
 # endif
 #else
-#error Host architecture was not detected as supported by protobuf
+GOOGLE_PROTOBUF_PLATFORM_ERROR
 #endif
 
 #if defined(__APPLE__)
@@ -83,4 +89,6 @@
 #define GOOGLE_PROTOBUF_OS_NACL
 #endif
 
+#undef GOOGLE_PROTOBUF_PLATFORM_ERROR
+
 #endif  // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_
