aboutsummaryrefslogtreecommitdiffstats
path: root/src/google/protobuf/stubs/platform_macros.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/stubs/platform_macros.h')
-rw-r--r--src/google/protobuf/stubs/platform_macros.h31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/google/protobuf/stubs/platform_macros.h b/src/google/protobuf/stubs/platform_macros.h
index 1705b41..7956d07 100644
--- a/src/google/protobuf/stubs/platform_macros.h
+++ b/src/google/protobuf/stubs/platform_macros.h
@@ -1,6 +1,6 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2012 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
+// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -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,25 +65,39 @@
#endif
#elif defined(__pnacl__)
#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
-#elif defined(__ppc__)
-#define GOOGLE_PROTOBUF_ARCH_PPC 1
+#elif defined(sparc)
+#define GOOGLE_PROTOBUF_ARCH_SPARC 1
+#ifdef SOLARIS_64BIT_ENABLED
+#define GOOGLE_PROTOBUF_ARCH_64_BIT 1
+#else
#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
+#endif
+#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__)
#define GOOGLE_PROTOBUF_OS_APPLE
#elif defined(__native_client__)
#define GOOGLE_PROTOBUF_OS_NACL
+#elif defined(sun)
+#define GOOGLE_PROTOBUF_OS_SOLARIS
#endif
+#undef GOOGLE_PROTOBUF_PLATFORM_ERROR
+
#endif // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_