OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 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 overrides the inclusion of webrtc/base/basictypes.h to remove | |
12 // collisions with Chromium's base/basictypes.h. We then add back a few | |
13 // items that Chromium's version doesn't provide, but libjingle expects. | |
14 | |
15 #ifndef OVERRIDES_WEBRTC_BASE_BASICTYPES_H__ | |
16 #define OVERRIDES_WEBRTC_BASE_BASICTYPES_H__ | |
17 | |
18 // We can't include these files directly via "base/foo.h" since we might | |
19 // inadvertently include the very files we're overriding. | |
20 #include "../../../../../base/basictypes.h" | |
21 #include "../../../../../build/build_config.h" | |
22 | |
23 #ifndef INT_TYPES_DEFINED | |
24 #define INT_TYPES_DEFINED | |
25 | |
26 #ifdef COMPILER_MSVC | |
27 #if _MSC_VER >= 1600 | |
28 #include <stdint.h> | |
29 #else | |
30 typedef unsigned __int64 uint64; | |
31 typedef __int64 int64; | |
32 #endif | |
33 #ifndef INT64_C | |
34 #define INT64_C(x) x ## I64 | |
35 #endif | |
36 #ifndef UINT64_C | |
37 #define UINT64_C(x) x ## UI64 | |
38 #endif | |
39 #define INT64_F "I64" | |
40 #else // COMPILER_MSVC | |
41 #ifndef INT64_C | |
42 #define INT64_C(x) x ## LL | |
43 #endif | |
44 #ifndef UINT64_C | |
45 #define UINT64_C(x) x ## ULL | |
46 #endif | |
47 #ifndef INT64_F | |
48 #define INT64_F "ll" | |
49 #endif | |
50 #endif // COMPILER_MSVC | |
51 #endif // INT_TYPES_DEFINED | |
52 | |
53 // Detect compiler is for x86 or x64. | |
54 #if defined(__x86_64__) || defined(_M_X64) || \ | |
55 defined(__i386__) || defined(_M_IX86) | |
56 #define CPU_X86 1 | |
57 #endif | |
58 // Detect compiler is for arm. | |
59 #if defined(__arm__) || defined(_M_ARM) | |
60 #define CPU_ARM 1 | |
61 #endif | |
62 #if defined(CPU_X86) && defined(CPU_ARM) | |
63 #error CPU_X86 and CPU_ARM both defined. | |
64 #endif | |
65 #if !defined(ARCH_CPU_BIG_ENDIAN) && !defined(ARCH_CPU_LITTLE_ENDIAN) | |
66 // x86, arm or GCC provided __BYTE_ORDER__ macros | |
67 #if CPU_X86 || CPU_ARM || \ | |
68 (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) | |
69 #define ARCH_CPU_LITTLE_ENDIAN | |
70 #elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ | |
71 #define ARCH_CPU_BIG_ENDIAN | |
72 #else | |
73 #error ARCH_CPU_BIG_ENDIAN or ARCH_CPU_LITTLE_ENDIAN should be defined. | |
74 #endif | |
75 #endif | |
76 #if defined(ARCH_CPU_BIG_ENDIAN) && defined(ARCH_CPU_LITTLE_ENDIAN) | |
77 #error ARCH_CPU_BIG_ENDIAN and ARCH_CPU_LITTLE_ENDIAN both defined. | |
78 #endif | |
79 | |
80 #if defined(WEBRTC_WIN) | |
81 typedef int socklen_t; | |
82 #endif | |
83 | |
84 #if defined(WEBRTC_WIN) | |
85 #if _MSC_VER < 1700 | |
86 #define alignof(t) __alignof(t) | |
87 #endif | |
88 #else // !WEBRTC_WIN | |
89 #define alignof(t) __alignof__(t) | |
90 #endif // !WEBRTC_WIN | |
91 #ifndef ALIGNP | |
92 #define ALIGNP(p, t) \ | |
93 (reinterpret_cast<uint8*>(((reinterpret_cast<uintptr_t>(p) + \ | |
94 ((t)-1)) & ~((t)-1)))) | |
95 #endif | |
96 #define RTC_IS_ALIGNED(p, a) (0==(reinterpret_cast<uintptr_t>(p) & ((a)-1))) | |
97 | |
98 // RTC_DEFINE_STATIC_LOCAL() is libjingle's copy of CR_DEFINE_STATIC_LOCAL(). | |
99 #define RTC_DEFINE_STATIC_LOCAL(type, name, arguments) \ | |
100 CR_DEFINE_STATIC_LOCAL(type, name, arguments) | |
101 | |
102 #endif // OVERRIDES_WEBRTC_BASE_BASICTYPES_H__ | |
OLD | NEW |