Remove TARGET_PC and cruft from typedefs.h.

Additionally remove all TARGET defines (e.g. TARGET_MAC), which weren't used anyway.

BUG=
TEST=build on Linux, Mac, Win

Review URL: https://webrtc-codereview.appspot.com/432001

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1822 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andrew@webrtc.org 2012-03-01 21:39:57 +00:00
parent fa2f5627ca
commit d62d7301f4
4 changed files with 36 additions and 106 deletions

View File

@ -1,4 +1,4 @@
# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
# #
# Use of this source code is governed by a BSD-style license # Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source # that can be found in the LICENSE file in the root of the source
@ -127,7 +127,6 @@
}], }],
['OS=="linux"', { ['OS=="linux"', {
'defines': [ 'defines': [
'WEBRTC_TARGET_PC',
'WEBRTC_LINUX', 'WEBRTC_LINUX',
'WEBRTC_THREAD_RR', 'WEBRTC_THREAD_RR',
# TODO(andrew): can we select this automatically? # TODO(andrew): can we select this automatically?
@ -136,19 +135,16 @@
], ],
}], }],
['OS=="mac"', { ['OS=="mac"', {
# TODO(andrew): what about PowerPC?
# Setup for Intel
'defines': [ 'defines': [
'WEBRTC_TARGET_MAC_INTEL',
'WEBRTC_MAC_INTEL',
'WEBRTC_MAC', 'WEBRTC_MAC',
'WEBRTC_MAC_INTEL', # TODO(andrew): remove this.
'WEBRTC_THREAD_RR', 'WEBRTC_THREAD_RR',
'WEBRTC_CLOCK_TYPE_REALTIME', 'WEBRTC_CLOCK_TYPE_REALTIME',
], ],
}], }],
['OS=="win"', { ['OS=="win"', {
'defines': [ 'defines': [
'WEBRTC_TARGET_PC', 'WEBRTC_WIN',
], ],
# TODO(andrew): remove this block when possible. # TODO(andrew): remove this block when possible.
# 4389: Signed/unsigned mismatch. # 4389: Signed/unsigned mismatch.
@ -159,18 +155,17 @@
}], }],
['OS=="android"', { ['OS=="android"', {
'defines': [ 'defines': [
'WEBRTC_TARGET_PC',
'WEBRTC_LINUX', 'WEBRTC_LINUX',
'WEBRTC_ANDROID',
# TODO(leozwang): move WEBRTC_ARCH_ARM to typedefs.h.
'WEBRTC_ARCH_ARM',
# TODO(leozwang): Investigate CLOCK_REALTIME and CLOCK_MONOTONIC # TODO(leozwang): Investigate CLOCK_REALTIME and CLOCK_MONOTONIC
# support on Android. Keep WEBRTC_CLOCK_TYPE_REALTIME for now, # support on Android. Keep WEBRTC_CLOCK_TYPE_REALTIME for now,
# remove it after I verify that CLOCK_MONOTONIC is fully functional # remove it after I verify that CLOCK_MONOTONIC is fully functional
# with condition and event functions in system_wrappers. # with condition and event functions in system_wrappers.
'WEBRTC_CLOCK_TYPE_REALTIME', 'WEBRTC_CLOCK_TYPE_REALTIME',
'WEBRTC_THREAD_RR', 'WEBRTC_THREAD_RR',
'WEBRTC_ANDROID',
'WEBRTC_ARM_INLINE_CALLS', 'WEBRTC_ARM_INLINE_CALLS',
# TODO(leozwang): move WEBRTC_ARCH_ARM to typedefs.h.
'WEBRTC_ARCH_ARM',
'WEBRTC_ANDROID_OPENSLES', 'WEBRTC_ANDROID_OPENSLES',
], ],
}], }],

View File

@ -39,25 +39,17 @@
#define WEBRTC_SPL_ABS_W32(a) \ #define WEBRTC_SPL_ABS_W32(a) \
(((WebRtc_Word32)a >= 0) ? ((WebRtc_Word32)a) : -((WebRtc_Word32)a)) (((WebRtc_Word32)a >= 0) ? ((WebRtc_Word32)a) : -((WebRtc_Word32)a))
#if (defined WEBRTC_TARGET_PC)||(defined __TARGET_XSCALE) #ifdef WEBRTC_ARCH_LITTLE_ENDIAN
#define WEBRTC_SPL_GET_BYTE(a, nr) (((WebRtc_Word8 *)a)[nr]) #define WEBRTC_SPL_GET_BYTE(a, nr) (((WebRtc_Word8 *)a)[nr])
#define WEBRTC_SPL_SET_BYTE(d_ptr, val, index) \ #define WEBRTC_SPL_SET_BYTE(d_ptr, val, index) \
(((WebRtc_Word8 *)d_ptr)[index] = (val)) (((WebRtc_Word8 *)d_ptr)[index] = (val))
#elif defined WEBRTC_BIG_ENDIAN #else
#define WEBRTC_SPL_GET_BYTE(a, nr) \ #define WEBRTC_SPL_GET_BYTE(a, nr) \
((((WebRtc_Word16 *)a)[nr >> 1]) >> (((nr + 1) & 0x1) * 8) & 0x00ff) ((((WebRtc_Word16 *)a)[nr >> 1]) >> (((nr + 1) & 0x1) * 8) & 0x00ff)
#define WEBRTC_SPL_SET_BYTE(d_ptr, val, index) \ #define WEBRTC_SPL_SET_BYTE(d_ptr, val, index) \
((WebRtc_Word16 *)d_ptr)[index >> 1] = \ ((WebRtc_Word16 *)d_ptr)[index >> 1] = \
((((WebRtc_Word16 *)d_ptr)[index >> 1]) \ ((((WebRtc_Word16 *)d_ptr)[index >> 1]) \
& (0x00ff << (8 * ((index) & 0x1)))) | (val << (8 * ((index + 1) & 0x1))) & (0x00ff << (8 * ((index) & 0x1)))) | (val << (8 * ((index + 1) & 0x1)))
#else
#define WEBRTC_SPL_GET_BYTE(a,nr) \
((((WebRtc_Word16 *)(a))[(nr) >> 1]) >> (((nr) & 0x1) * 8) & 0x00ff)
#define WEBRTC_SPL_SET_BYTE(d_ptr, val, index) \
((WebRtc_Word16 *)(d_ptr))[(index) >> 1] = \
((((WebRtc_Word16 *)(d_ptr))[(index) >> 1]) \
& (0x00ff << (8 * (((index) + 1) & 0x1)))) | \
((val) << (8 * ((index) & 0x1)))
#endif #endif
#define WEBRTC_SPL_MUL(a, b) \ #define WEBRTC_SPL_MUL(a, b) \

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
* *
* Use of this source code is governed by a BSD-style license * Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source * that can be found in the LICENSE file in the root of the source
@ -19,53 +19,24 @@
#define G_CONST const #define G_CONST const
#define WEBRTC_INLINE extern __inline #define WEBRTC_INLINE extern __inline
// Define WebRTC preprocessor identifiers based on the current build platform.
// TODO(andrew): Clean these up. We can probably remove everything in this
// block.
// - TARGET_MAC_INTEL and TARGET_MAC aren't used anywhere.
// - In the few places where TARGET_PC is used, it should be replaced by
// something more specific.
// - Do we really support PowerPC? Probably not. Remove WEBRTC_MAC_INTEL
// from build/common.gypi as well.
#if defined(WIN32)
// Windows & Windows Mobile.
#if !defined(WEBRTC_TARGET_PC)
#define WEBRTC_TARGET_PC
#endif
#elif defined(__APPLE__)
// Mac OS X.
#if defined(__LITTLE_ENDIAN__ )
#if !defined(WEBRTC_TARGET_MAC_INTEL)
#define WEBRTC_TARGET_MAC_INTEL
#endif
#else
#if !defined(WEBRTC_TARGET_MAC)
#define WEBRTC_TARGET_MAC
#endif
#endif
#else
// Linux etc.
#if !defined(WEBRTC_TARGET_PC)
#define WEBRTC_TARGET_PC
#endif
#endif
// Derived from Chromium's build/build_config.h // Derived from Chromium's build/build_config.h
// Processor architecture detection. For more info on what's defined, see: // Processor architecture detection. For more info on what's defined, see:
// http://msdn.microsoft.com/en-us/library/b0084kay.aspx // http://msdn.microsoft.com/en-us/library/b0084kay.aspx
// http://www.agner.org/optimize/calling_conventions.pdf // http://www.agner.org/optimize/calling_conventions.pdf
// or with gcc, run: "echo | gcc -E -dM -" // or with gcc, run: "echo | gcc -E -dM -"
// TODO(andrew): replace WEBRTC_LITTLE_ENDIAN with WEBRTC_ARCH_LITTLE_ENDIAN? // TODO(andrew): replace WEBRTC_LITTLE_ENDIAN with WEBRTC_ARCH_LITTLE_ENDIAN.
#if defined(_M_X64) || defined(__x86_64__) #if defined(_M_X64) || defined(__x86_64__)
#define WEBRTC_ARCH_X86_FAMILY #define WEBRTC_ARCH_X86_FAMILY
#define WEBRTC_ARCH_X86_64 #define WEBRTC_ARCH_X86_64
#define WEBRTC_ARCH_64_BITS #define WEBRTC_ARCH_64_BITS
#define WEBRTC_ARCH_LITTLE_ENDIAN #define WEBRTC_ARCH_LITTLE_ENDIAN
#define WEBRTC_LITTLE_ENDIAN
#elif defined(_M_IX86) || defined(__i386__) #elif defined(_M_IX86) || defined(__i386__)
#define WEBRTC_ARCH_X86_FAMILY #define WEBRTC_ARCH_X86_FAMILY
#define WEBRTC_ARCH_X86 #define WEBRTC_ARCH_X86
#define WEBRTC_ARCH_32_BITS #define WEBRTC_ARCH_32_BITS
#define WEBRTC_ARCH_LITTLE_ENDIAN #define WEBRTC_ARCH_LITTLE_ENDIAN
#define WEBRTC_LITTLE_ENDIAN
#elif defined(__ARMEL__) #elif defined(__ARMEL__)
// TODO(andrew): We'd prefer to control platform defines here, but this is // TODO(andrew): We'd prefer to control platform defines here, but this is
// currently provided by the Android makefiles. Commented to avoid duplicate // currently provided by the Android makefiles. Commented to avoid duplicate
@ -76,6 +47,7 @@
//#define WEBRTC_ARCH_ARMEL //#define WEBRTC_ARCH_ARMEL
#define WEBRTC_ARCH_32_BITS #define WEBRTC_ARCH_32_BITS
#define WEBRTC_ARCH_LITTLE_ENDIAN #define WEBRTC_ARCH_LITTLE_ENDIAN
#define WEBRTC_LITTLE_ENDIAN
#else #else
#error Please add support for your architecture in typedefs.h #error Please add support for your architecture in typedefs.h
#endif #endif
@ -84,59 +56,31 @@
#define WEBRTC_USE_SSE2 #define WEBRTC_USE_SSE2
#endif #endif
#if defined(WEBRTC_TARGET_PC)
#if !defined(_MSC_VER) #if !defined(_MSC_VER)
#include <stdint.h> #include <stdint.h>
#else #else
// Define C99 equivalent types. // Define C99 equivalent types, since MSVC doesn't provide stdint.h.
// Since MSVC doesn't include these headers, we have to write our own typedef signed char int8_t;
// version to provide a compatibility layer between MSVC and the WebRTC typedef signed short int16_t;
// headers. typedef signed int int32_t;
typedef signed char int8_t; typedef __int64 int64_t;
typedef signed short int16_t; typedef unsigned char uint8_t;
typedef signed int int32_t; typedef unsigned short uint16_t;
typedef signed long long int64_t; typedef unsigned int uint32_t;
typedef unsigned char uint8_t; typedef unsigned __int64 uint64_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
#endif #endif
#if defined(WIN32) // TODO(andrew): remove WebRtc_ types:
typedef __int64 WebRtc_Word64; // http://code.google.com/p/webrtc/issues/detail?id=314
typedef unsigned __int64 WebRtc_UWord64; // TODO(leozwang): change to WebRtc_Word8 to use int8_t:
#else // http://code.google.com/p/webrtc/issues/detail?id=311
typedef int64_t WebRtc_Word64; typedef char WebRtc_Word8;
typedef uint64_t WebRtc_UWord64; typedef int16_t WebRtc_Word16;
#endif typedef int32_t WebRtc_Word32;
typedef int32_t WebRtc_Word32; typedef int64_t WebRtc_Word64;
typedef uint32_t WebRtc_UWord32; typedef uint8_t WebRtc_UWord8;
typedef int16_t WebRtc_Word16; typedef uint16_t WebRtc_UWord16;
typedef uint16_t WebRtc_UWord16; typedef uint32_t WebRtc_UWord32;
typedef char WebRtc_Word8; typedef uint64_t WebRtc_UWord64;
typedef uint8_t WebRtc_UWord8;
// Define endian for the platform
#define WEBRTC_LITTLE_ENDIAN
#elif defined(WEBRTC_TARGET_MAC_INTEL)
#include <stdint.h>
typedef int64_t WebRtc_Word64;
typedef uint64_t WebRtc_UWord64;
typedef int32_t WebRtc_Word32;
typedef uint32_t WebRtc_UWord32;
typedef int16_t WebRtc_Word16;
typedef char WebRtc_Word8;
typedef uint16_t WebRtc_UWord16;
typedef uint8_t WebRtc_UWord8;
// Define endian for the platform
#define WEBRTC_LITTLE_ENDIAN
#else
#error "No platform defined for WebRTC type definitions (typedefs.h)"
#endif
#endif // WEBRTC_TYPEDEFS_H_ #endif // WEBRTC_TYPEDEFS_H_

View File

@ -1437,8 +1437,7 @@ void createSummary(VoiceEngine* ve) {
sprintf(str, "WebRTc VoiceEngine "); sprintf(str, "WebRTc VoiceEngine ");
#if defined(_WIN32) #if defined(_WIN32)
strcat(str, "Win"); strcat(str, "Win");
#elif defined(WEBRTC_LINUX) && defined(WEBRTC_TARGET_PC) && \ #elif defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)
!defined(WEBRTC_ANDROID)
strcat(str, "Linux"); strcat(str, "Linux");
#elif defined(WEBRTC_MAC) && !defined(MAC_IPHONE) #elif defined(WEBRTC_MAC) && !defined(MAC_IPHONE)
strcat(str, "Mac"); strcat(str, "Mac");