OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2012 Google Inc. All rights reserved. | 2 // Copyright 2012 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // http://code.google.com/p/protobuf/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
11 // * Redistributions in binary form must reproduce the above | 11 // * Redistributions in binary form must reproduce the above |
12 // copyright notice, this list of conditions and the following disclaimer | 12 // copyright notice, this list of conditions and the following disclaimer |
13 // in the documentation and/or other materials provided with the | 13 // in the documentation and/or other materials provided with the |
(...skipping 10 matching lines...) Expand all Loading... |
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | 30 |
31 #ifndef GOOGLE_PROTOBUF_PLATFORM_MACROS_H_ | 31 #ifndef GOOGLE_PROTOBUF_PLATFORM_MACROS_H_ |
32 #define GOOGLE_PROTOBUF_PLATFORM_MACROS_H_ | 32 #define GOOGLE_PROTOBUF_PLATFORM_MACROS_H_ |
33 | 33 |
34 #define GOOGLE_PROTOBUF_PLATFORM_ERROR \ | 34 #include <google/protobuf/stubs/common.h> |
35 #error "Host platform was not detected as supported by protobuf" | |
36 | 35 |
37 // Processor architecture detection. For more info on what's defined, see: | 36 // Processor architecture detection. For more info on what's defined, see: |
38 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx | 37 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
39 // http://www.agner.org/optimize/calling_conventions.pdf | 38 // http://www.agner.org/optimize/calling_conventions.pdf |
40 // or with gcc, run: "echo | gcc -E -dM -" | 39 // or with gcc, run: "echo | gcc -E -dM -" |
41 #if defined(_M_X64) || defined(__x86_64__) | 40 #if defined(_M_X64) || defined(__x86_64__) |
42 #define GOOGLE_PROTOBUF_ARCH_X64 1 | 41 #define GOOGLE_PROTOBUF_ARCH_X64 1 |
43 #define GOOGLE_PROTOBUF_ARCH_64_BIT 1 | 42 #define GOOGLE_PROTOBUF_ARCH_64_BIT 1 |
44 #elif defined(_M_IX86) || defined(__i386__) | 43 #elif defined(_M_IX86) || defined(__i386__) |
45 #define GOOGLE_PROTOBUF_ARCH_IA32 1 | 44 #define GOOGLE_PROTOBUF_ARCH_IA32 1 |
(...skipping 10 matching lines...) Expand all Loading... |
56 #elif defined(__MIPSEL__) | 55 #elif defined(__MIPSEL__) |
57 #if defined(__LP64__) | 56 #if defined(__LP64__) |
58 #define GOOGLE_PROTOBUF_ARCH_MIPS64 1 | 57 #define GOOGLE_PROTOBUF_ARCH_MIPS64 1 |
59 #define GOOGLE_PROTOBUF_ARCH_64_BIT 1 | 58 #define GOOGLE_PROTOBUF_ARCH_64_BIT 1 |
60 #else | 59 #else |
61 #define GOOGLE_PROTOBUF_ARCH_MIPS 1 | 60 #define GOOGLE_PROTOBUF_ARCH_MIPS 1 |
62 #define GOOGLE_PROTOBUF_ARCH_32_BIT 1 | 61 #define GOOGLE_PROTOBUF_ARCH_32_BIT 1 |
63 #endif | 62 #endif |
64 #elif defined(__pnacl__) | 63 #elif defined(__pnacl__) |
65 #define GOOGLE_PROTOBUF_ARCH_32_BIT 1 | 64 #define GOOGLE_PROTOBUF_ARCH_32_BIT 1 |
66 #elif defined(sparc) | 65 #elif defined(__ppc__) |
67 #define GOOGLE_PROTOBUF_ARCH_SPARC 1 | 66 #define GOOGLE_PROTOBUF_ARCH_PPC 1 |
68 #ifdef SOLARIS_64BIT_ENABLED | 67 #define GOOGLE_PROTOBUF_ARCH_32_BIT 1 |
69 #define GOOGLE_PROTOBUF_ARCH_64_BIT 1 | |
70 #else | 68 #else |
71 #define GOOGLE_PROTOBUF_ARCH_32_BIT 1 | 69 #error Host architecture was not detected as supported by protobuf |
72 #endif | |
73 #elif defined(_POWER) | |
74 #define GOOGLE_PROTOBUF_ARCH_POWER 1 | |
75 #define GOOGLE_PROTOBUF_ARCH_64_BIT 1 | |
76 #elif defined(__GNUC__) | |
77 # if (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)) | |
78 // We fallback to the generic Clang/GCC >= 4.7 implementation in atomicops.h | |
79 # elif defined(__clang__) | |
80 # if !__has_extension(c_atomic) | |
81 GOOGLE_PROTOBUF_PLATFORM_ERROR | |
82 # endif | |
83 // We fallback to the generic Clang/GCC >= 4.7 implementation in atomicops.h | |
84 # endif | |
85 # if __LP64__ | |
86 # define GOOGLE_PROTOBUF_ARCH_64_BIT 1 | |
87 # else | |
88 # define GOOGLE_PROTOBUF_ARCH_32_BIT 1 | |
89 # endif | |
90 #else | |
91 GOOGLE_PROTOBUF_PLATFORM_ERROR | |
92 #endif | 70 #endif |
93 | 71 |
94 #if defined(__APPLE__) | 72 #if defined(__APPLE__) |
95 #define GOOGLE_PROTOBUF_OS_APPLE | 73 #define GOOGLE_PROTOBUF_OS_APPLE |
96 #include <TargetConditionals.h> | |
97 #if TARGET_OS_IPHONE | |
98 #define GOOGLE_PROTOBUF_OS_IPHONE | |
99 #endif | |
100 #elif defined(__native_client__) | 74 #elif defined(__native_client__) |
101 #define GOOGLE_PROTOBUF_OS_NACL | 75 #define GOOGLE_PROTOBUF_OS_NACL |
102 #elif defined(sun) | |
103 #define GOOGLE_PROTOBUF_OS_SOLARIS | |
104 #elif defined(_AIX) | |
105 #define GOOGLE_PROTOBUF_OS_AIX | |
106 #elif defined(__ANDROID__) | |
107 #define GOOGLE_PROTOBUF_OS_ANDROID | |
108 #endif | |
109 | |
110 #undef GOOGLE_PROTOBUF_PLATFORM_ERROR | |
111 | |
112 #if defined(GOOGLE_PROTOBUF_OS_ANDROID) || defined(GOOGLE_PROTOBUF_OS_IPHONE) | |
113 // Android ndk does not support the __thread keyword very well yet. Here | |
114 // we use pthread_key_create()/pthread_getspecific()/... methods for | |
115 // TLS support on android. | |
116 // iOS also does not support the __thread keyword. | |
117 #define GOOGLE_PROTOBUF_NO_THREADLOCAL | |
118 #endif | 76 #endif |
119 | 77 |
120 #endif // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_ | 78 #endif // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_ |
OLD | NEW |