andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | // This file contains platform-specific typedefs and defines. |
| 12 | // Much of it is derived from Chromium's build/build_config.h. |
| 13 | |
| 14 | #ifndef WEBRTC_TYPEDEFS_H_ |
| 15 | #define WEBRTC_TYPEDEFS_H_ |
| 16 | |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 17 | // For access to standard POSIXish features, use WEBRTC_POSIX instead of a |
| 18 | // more specific macro. |
| 19 | #if defined(WEBRTC_MAC) || defined(WEBRTC_LINUX) || \ |
| 20 | defined(WEBRTC_ANDROID) |
| 21 | #define WEBRTC_POSIX |
| 22 | #endif |
| 23 | |
| 24 | // Processor architecture detection. For more info on what's defined, see: |
| 25 | // http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
| 26 | // http://www.agner.org/optimize/calling_conventions.pdf |
| 27 | // or with gcc, run: "echo | gcc -E -dM -" |
| 28 | // TODO(andrew): replace WEBRTC_LITTLE_ENDIAN with WEBRTC_ARCH_LITTLE_ENDIAN. |
| 29 | #if defined(_M_X64) || defined(__x86_64__) |
| 30 | #define WEBRTC_ARCH_X86_FAMILY |
| 31 | #define WEBRTC_ARCH_X86_64 |
| 32 | #define WEBRTC_ARCH_64_BITS |
| 33 | #define WEBRTC_ARCH_LITTLE_ENDIAN |
| 34 | #define WEBRTC_LITTLE_ENDIAN |
| 35 | #elif defined(_M_IX86) || defined(__i386__) |
| 36 | #define WEBRTC_ARCH_X86_FAMILY |
| 37 | #define WEBRTC_ARCH_X86 |
| 38 | #define WEBRTC_ARCH_32_BITS |
| 39 | #define WEBRTC_ARCH_LITTLE_ENDIAN |
| 40 | #define WEBRTC_LITTLE_ENDIAN |
| 41 | #elif defined(__ARMEL__) |
| 42 | // TODO(andrew): We'd prefer to control platform defines here, but this is |
| 43 | // currently provided by the Android makefiles. Commented to avoid duplicate |
| 44 | // definition warnings. |
| 45 | //#define WEBRTC_ARCH_ARM |
| 46 | // TODO(andrew): Chromium uses the following two defines. Should we switch? |
| 47 | //#define WEBRTC_ARCH_ARM_FAMILY |
| 48 | //#define WEBRTC_ARCH_ARMEL |
| 49 | #define WEBRTC_ARCH_32_BITS |
| 50 | #define WEBRTC_ARCH_LITTLE_ENDIAN |
| 51 | #define WEBRTC_LITTLE_ENDIAN |
| 52 | #elif defined(__MIPSEL__) |
| 53 | #define WEBRTC_ARCH_32_BITS |
| 54 | #define WEBRTC_ARCH_LITTLE_ENDIAN |
| 55 | #define WEBRTC_LITTLE_ENDIAN |
| 56 | #else |
| 57 | #error Please add support for your architecture in typedefs.h |
| 58 | #endif |
| 59 | |
| 60 | #if defined(__SSE2__) || defined(_MSC_VER) |
| 61 | #define WEBRTC_USE_SSE2 |
| 62 | #endif |
| 63 | |
| 64 | #if !defined(_MSC_VER) |
| 65 | #include <stdint.h> |
| 66 | #else |
| 67 | // Define C99 equivalent types, since MSVC doesn't provide stdint.h. |
| 68 | typedef signed char int8_t; |
| 69 | typedef signed short int16_t; |
| 70 | typedef signed int int32_t; |
| 71 | typedef __int64 int64_t; |
| 72 | typedef unsigned char uint8_t; |
| 73 | typedef unsigned short uint16_t; |
| 74 | typedef unsigned int uint32_t; |
| 75 | typedef unsigned __int64 uint64_t; |
| 76 | #endif |
| 77 | |
andrew@webrtc.org | 58a5924 | 2013-03-25 21:20:38 +0000 | [diff] [blame] | 78 | // Borrowed from Chromium's base/compiler_specific.h. |
| 79 | // Annotate a virtual method indicating it must be overriding a virtual |
| 80 | // method in the parent class. |
| 81 | // Use like: |
| 82 | // virtual void foo() OVERRIDE; |
| 83 | #if defined(_MSC_VER) |
| 84 | #define OVERRIDE override |
| 85 | #elif defined(__clang__) |
pbos@webrtc.org | 3759823 | 2013-05-08 08:34:34 +0000 | [diff] [blame] | 86 | // Clang defaults to C++03 and warns about using override. Squelch that. |
| 87 | // Intentionally no push/pop here so all users of OVERRIDE ignore the warning |
| 88 | // too. This is like passing -Wno-c++11-extensions, except that GCC won't die |
| 89 | // (because it won't see this pragma). |
| 90 | #pragma clang diagnostic ignored "-Wc++11-extensions" |
andrew@webrtc.org | 58a5924 | 2013-03-25 21:20:38 +0000 | [diff] [blame] | 91 | #define OVERRIDE override |
| 92 | #else |
| 93 | #define OVERRIDE |
| 94 | #endif |
| 95 | |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 96 | #endif // WEBRTC_TYPEDEFS_H_ |