Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: webrtc/base/basictypes.h

Issue 1349213003: Remove overridden basictypes.h. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc/trunk/webrtc.git@master
Patch Set: Added missing include for Win. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/base/base.gyp ('k') | webrtc/base/basictypes_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_BASE_BASICTYPES_H_ 11 #ifndef WEBRTC_BASE_BASICTYPES_H_
12 #define WEBRTC_BASE_BASICTYPES_H_ 12 #define WEBRTC_BASE_BASICTYPES_H_
13 13
14 #include <stddef.h> // for NULL, size_t 14 #include <stddef.h> // for NULL, size_t
15
16 #if !(defined(_MSC_VER) && (_MSC_VER < 1600))
17 #include <stdint.h> // for uintptr_t 15 #include <stdint.h> // for uintptr_t
18 #endif
19 16
20 #ifdef HAVE_CONFIG_H 17 #ifdef HAVE_CONFIG_H
21 #include "config.h" // NOLINT 18 #include "config.h" // NOLINT
22 #endif 19 #endif
23 20
24 #include "webrtc/base/constructormagic.h" 21 // TODO(grunell): Use (u)intxx_t everywhere instead and remove these typedefs.
25 22 typedef int8_t int8;
26 #if !defined(INT_TYPES_DEFINED) 23 typedef uint8_t uint8;
27 #define INT_TYPES_DEFINED 24 typedef int16_t int16;
28 #ifdef COMPILER_MSVC 25 typedef uint16_t uint16;
29 typedef unsigned __int64 uint64; 26 typedef int32_t int32;
30 typedef __int64 int64; 27 typedef uint32_t uint32;
31 #ifndef INT64_C 28 typedef int64_t int64;
32 #define INT64_C(x) x ## I64
33 #endif
34 #ifndef UINT64_C
35 #define UINT64_C(x) x ## UI64
36 #endif
37 #define INT64_F "I64"
38 #else // COMPILER_MSVC
39 // On Mac OS X, cssmconfig.h defines uint64 as uint64_t
40 // TODO(fbarchard): Use long long for compatibility with chromium on BSD/OSX.
41 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
42 typedef uint64_t uint64; 29 typedef uint64_t uint64;
43 typedef int64_t int64;
44 #ifndef INT64_C
45 #define INT64_C(x) x ## LL
46 #endif
47 #ifndef UINT64_C
48 #define UINT64_C(x) x ## ULL
49 #endif
50 #define INT64_F "l"
51 #elif defined(__LP64__)
52 typedef unsigned long long uint64; // NOLINT
53 typedef long long int64; // NOLINT
54 #ifndef INT64_C
55 #define INT64_C(x) x ## L
56 #endif
57 #ifndef UINT64_C
58 #define UINT64_C(x) x ## UL
59 #endif
60 #define INT64_F "l"
61 #else // __LP64__
62 typedef unsigned long long uint64; // NOLINT
63 typedef long long int64; // NOLINT
64 #ifndef INT64_C
65 #define INT64_C(x) x ## LL
66 #endif
67 #ifndef UINT64_C
68 #define UINT64_C(x) x ## ULL
69 #endif
70 #define INT64_F "ll"
71 #endif // __LP64__
72 #endif // COMPILER_MSVC
73 typedef unsigned int uint32;
74 typedef int int32;
75 typedef unsigned short uint16; // NOLINT
76 typedef short int16; // NOLINT
77 typedef unsigned char uint8;
78 typedef signed char int8;
79 #endif // INT_TYPES_DEFINED
80 30
81 // Detect compiler is for x86 or x64. 31 // Detect compiler is for x86 or x64.
82 #if defined(__x86_64__) || defined(_M_X64) || \ 32 #if defined(__x86_64__) || defined(_M_X64) || \
83 defined(__i386__) || defined(_M_IX86) 33 defined(__i386__) || defined(_M_IX86)
84 #define CPU_X86 1 34 #define CPU_X86 1
85 #endif 35 #endif
36
86 // Detect compiler is for arm. 37 // Detect compiler is for arm.
87 #if defined(__arm__) || defined(_M_ARM) 38 #if defined(__arm__) || defined(_M_ARM)
88 #define CPU_ARM 1 39 #define CPU_ARM 1
89 #endif 40 #endif
41
90 #if defined(CPU_X86) && defined(CPU_ARM) 42 #if defined(CPU_X86) && defined(CPU_ARM)
91 #error CPU_X86 and CPU_ARM both defined. 43 #error CPU_X86 and CPU_ARM both defined.
92 #endif 44 #endif
93 #if !defined(ARCH_CPU_BIG_ENDIAN) && !defined(ARCH_CPU_LITTLE_ENDIAN) 45
46 #if !defined(RTC_ARCH_CPU_BIG_ENDIAN) && !defined(RTC_ARCH_CPU_LITTLE_ENDIAN)
94 // x86, arm or GCC provided __BYTE_ORDER__ macros 47 // x86, arm or GCC provided __BYTE_ORDER__ macros
95 #if CPU_X86 || CPU_ARM || \ 48 #if CPU_X86 || CPU_ARM || \
96 (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) 49 (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
97 #define ARCH_CPU_LITTLE_ENDIAN 50 #define RTC_ARCH_CPU_LITTLE_ENDIAN
98 #elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 51 #elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
99 #define ARCH_CPU_BIG_ENDIAN 52 #define RTC_ARCH_CPU_BIG_ENDIAN
100 #else 53 #else
101 #error ARCH_CPU_BIG_ENDIAN or ARCH_CPU_LITTLE_ENDIAN should be defined. 54 #error RTC_ARCH_CPU_BIG_ENDIAN or RTC_ARCH_CPU_LITTLE_ENDIAN should be defined.
102 #endif 55 #endif
103 #endif 56 #endif
104 #if defined(ARCH_CPU_BIG_ENDIAN) && defined(ARCH_CPU_LITTLE_ENDIAN) 57
105 #error ARCH_CPU_BIG_ENDIAN and ARCH_CPU_LITTLE_ENDIAN both defined. 58 #if defined(RTC_ARCH_CPU_BIG_ENDIAN) && defined(RTC_ARCH_CPU_LITTLE_ENDIAN)
59 #error RTC_ARCH_CPU_BIG_ENDIAN and RTC_ARCH_CPU_LITTLE_ENDIAN both defined.
106 #endif 60 #endif
107 61
108 #if defined(WEBRTC_WIN) 62 #if defined(WEBRTC_WIN)
109 typedef int socklen_t; 63 typedef int socklen_t;
110 #endif 64 #endif
111 65
112 // The following only works for C++ 66 // The following only works for C++
113 #ifdef __cplusplus 67 #ifdef __cplusplus
68
114 #ifndef ALIGNP 69 #ifndef ALIGNP
115 #define ALIGNP(p, t) \ 70 #define ALIGNP(p, t) \
116 (reinterpret_cast<uint8*>(((reinterpret_cast<uintptr_t>(p) + \ 71 (reinterpret_cast<uint8_t*>(((reinterpret_cast<uintptr_t>(p) + \
117 ((t) - 1)) & ~((t) - 1)))) 72 ((t) - 1)) & ~((t) - 1))))
118 #endif 73 #endif
74
119 #define RTC_IS_ALIGNED(p, a) (!((uintptr_t)(p) & ((a) - 1))) 75 #define RTC_IS_ALIGNED(p, a) (!((uintptr_t)(p) & ((a) - 1)))
120 76
121 // Use these to declare and define a static local variable (static T;) so that 77 // Use these to declare and define a static local variable that gets leaked so
122 // it is leaked so that its destructors are not called at exit. 78 // that its destructors are not called at exit.
123 #define RTC_DEFINE_STATIC_LOCAL(type, name, arguments) \ 79 #define RTC_DEFINE_STATIC_LOCAL(type, name, arguments) \
124 static type& name = *new type arguments 80 static type& name = *new type arguments
125 81
126 #endif // __cplusplus 82 #endif // __cplusplus
83
127 #endif // WEBRTC_BASE_BASICTYPES_H_ 84 #endif // WEBRTC_BASE_BASICTYPES_H_
OLDNEW
« no previous file with comments | « webrtc/base/base.gyp ('k') | webrtc/base/basictypes_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698