Home | History | Annotate | Download | only in stubs
      1 // Protocol Buffers - Google's data interchange format
      2 // Copyright 2012 Google Inc.  All rights reserved.
      3 // http://code.google.com/p/protobuf/
      4 //
      5 // Redistribution and use in source and binary forms, with or without
      6 // modification, are permitted provided that the following conditions are
      7 // met:
      8 //
      9 //     * Redistributions of source code must retain the above copyright
     10 // notice, this list of conditions and the following disclaimer.
     11 //     * Redistributions in binary form must reproduce the above
     12 // copyright notice, this list of conditions and the following disclaimer
     13 // in the documentation and/or other materials provided with the
     14 // distribution.
     15 //     * Neither the name of Google Inc. nor the names of its
     16 // contributors may be used to endorse or promote products derived from
     17 // this software without specific prior written permission.
     18 //
     19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     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.
     30 
     31 #ifndef GOOGLE_PROTOBUF_PLATFORM_MACROS_H_
     32 #define GOOGLE_PROTOBUF_PLATFORM_MACROS_H_
     33 
     34 #include <google/protobuf/stubs/common.h>
     35 
     36 // Processor architecture detection.  For more info on what's defined, see:
     37 //   http://msdn.microsoft.com/en-us/library/b0084kay.aspx
     38 //   http://www.agner.org/optimize/calling_conventions.pdf
     39 //   or with gcc, run: "echo | gcc -E -dM -"
     40 #if defined(_M_X64) || defined(__x86_64__)
     41 #define GOOGLE_PROTOBUF_ARCH_X64 1
     42 #define GOOGLE_PROTOBUF_ARCH_64_BIT 1
     43 #elif defined(_M_IX86) || defined(__i386__)
     44 #define GOOGLE_PROTOBUF_ARCH_IA32 1
     45 #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
     46 #elif defined(__QNX__)
     47 #define GOOGLE_PROTOBUF_ARCH_ARM_QNX 1
     48 #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
     49 #elif defined(__ARMEL__)
     50 #define GOOGLE_PROTOBUF_ARCH_ARM 1
     51 #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
     52 #elif defined(__MIPSEL__)
     53 #define GOOGLE_PROTOBUF_ARCH_MIPS 1
     54 #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
     55 #elif defined(__pnacl__)
     56 #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
     57 #elif defined(__ppc__)
     58 #define GOOGLE_PROTOBUF_ARCH_PPC 1
     59 #define GOOGLE_PROTOBUF_ARCH_32_BIT 1
     60 #else
     61 #error Host architecture was not detected as supported by protobuf
     62 #endif
     63 
     64 #if defined(__APPLE__)
     65 #define GOOGLE_PROTOBUF_OS_APPLE
     66 #elif defined(__native_client__)
     67 #define GOOGLE_PROTOBUF_OS_NACL
     68 #endif
     69 
     70 #endif  // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_
     71