Delete rtc_base/basictypes.h

Only remaining user was rtc_base/byteorder.h, which is changed to use
rtc_base/system/arch.h.

Bug: webrtc:6853
Change-Id: If3b21831adc60adfd989061027d661867c938a0f
Reviewed-on: https://webrtc-review.googlesource.com/78740
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23406}
This commit is contained in:
Niels Möller 2018-05-25 10:05:34 +02:00 committed by Commit Bot
parent 123ab64bc5
commit b06b0a689f
7 changed files with 13 additions and 110 deletions

View file

@ -104,7 +104,6 @@ rtc_source_set("rtc_base_approved") {
rtc_source_set("macromagic") {
sources = [
"arraysize.h",
"basictypes.h",
"constructormagic.h",
"format_macros.h",
"stringize_macros.h",
@ -385,6 +384,7 @@ rtc_source_set("rtc_base_approved_generic") {
":timeutils",
":type_traits",
"../:typedefs",
"system:arch",
]
sources = [
@ -1104,7 +1104,6 @@ if (rtc_include_tests) {
sources = [
"atomicops_unittest.cc",
"base64_unittest.cc",
"basictypes_unittest.cc",
"bind_unittest.cc",
"bitbuffer_unittest.cc",
"bitrateallocationstrategy_unittest.cc",

View file

@ -13,9 +13,8 @@
#if defined(WEBRTC_WIN)
// Include winsock2.h before including <windows.h> to maintain consistency with
// win32.h. We can't include win32.h directly here since it pulls in
// headers such as basictypes.h which causes problems in Chromium where webrtc
// exists as two separate projects, webrtc and libjingle.
// win32.h. To include win32.h directly, it must be broken out into its own
// build target.
#include <winsock2.h>
#include <windows.h>
#endif // defined(WEBRTC_WIN)

View file

@ -1,45 +0,0 @@
/*
* Copyright 2004 The WebRTC Project Authors. All rights reserved.
*
* 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
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef RTC_BASE_BASICTYPES_H_
#define RTC_BASE_BASICTYPES_H_
// Detect compiler is for x86 or x64.
#if defined(__x86_64__) || defined(_M_X64) || \
defined(__i386__) || defined(_M_IX86)
#define CPU_X86 1
#endif
// Detect compiler is for arm.
#if defined(__arm__) || defined(_M_ARM)
#define CPU_ARM 1
#endif
#if defined(CPU_X86) && defined(CPU_ARM)
#error CPU_X86 and CPU_ARM both defined.
#endif
#if !defined(RTC_ARCH_CPU_BIG_ENDIAN) && !defined(RTC_ARCH_CPU_LITTLE_ENDIAN)
// x86, arm or GCC provided __BYTE_ORDER__ macros
#if defined(CPU_X86) || defined(CPU_ARM) || \
(defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define RTC_ARCH_CPU_LITTLE_ENDIAN
#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define RTC_ARCH_CPU_BIG_ENDIAN
#else
#error RTC_ARCH_CPU_BIG_ENDIAN or RTC_ARCH_CPU_LITTLE_ENDIAN should be defined.
#endif
#endif
#if defined(RTC_ARCH_CPU_BIG_ENDIAN) && defined(RTC_ARCH_CPU_LITTLE_ENDIAN)
#error RTC_ARCH_CPU_BIG_ENDIAN and RTC_ARCH_CPU_LITTLE_ENDIAN both defined.
#endif
#endif // RTC_BASE_BASICTYPES_H_

View file

@ -1,48 +0,0 @@
/*
* Copyright 2012 The WebRTC Project Authors. All rights reserved.
*
* 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
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "rtc_base/basictypes.h"
#include "rtc_base/gunit.h"
namespace rtc {
TEST(BasicTypesTest, Endian) {
uint16_t v16 = 0x1234u;
uint8_t first_byte = *reinterpret_cast<uint8_t*>(&v16);
#if defined(RTC_ARCH_CPU_LITTLE_ENDIAN)
EXPECT_EQ(0x34u, first_byte);
#elif defined(RTC_ARCH_CPU_BIG_ENDIAN)
EXPECT_EQ(0x12u, first_byte);
#endif
}
TEST(BasicTypesTest, SizeOfConstants) {
EXPECT_EQ(8u, sizeof(INT64_C(0)));
EXPECT_EQ(8u, sizeof(UINT64_C(0)));
EXPECT_EQ(8u, sizeof(INT64_C(0x1234567887654321)));
EXPECT_EQ(8u, sizeof(UINT64_C(0x8765432112345678)));
}
// Test CPU_ macros
#if !defined(CPU_ARM) && defined(__arm__)
#error expected CPU_ARM to be defined.
#endif
#if !defined(CPU_X86) && (defined(WEBRTC_WIN) || defined(WEBRTC_MAC) && !defined(WEBRTC_IOS))
#error expected CPU_X86 to be defined.
#endif
#if !defined(RTC_ARCH_CPU_LITTLE_ENDIAN) && \
(defined(WEBRTC_WIN) || defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) || defined(CPU_X86))
#error expected RTC_ARCH_CPU_LITTLE_ENDIAN to be defined.
#endif
// TODO(fbarchard): Test all macros in basictypes.h
} // namespace rtc

View file

@ -17,7 +17,7 @@
#include <arpa/inet.h>
#endif
#include "rtc_base/basictypes.h"
#include "rtc_base/system/arch.h"
#if defined(WEBRTC_MAC)
#include <libkern/OSByteOrder.h>
@ -53,7 +53,7 @@
#define be64toh(v) ntohll(v)
#endif
#if defined(RTC_ARCH_CPU_LITTLE_ENDIAN)
#if defined(WEBRTC_ARCH_LITTLE_ENDIAN)
#define htole16(v) (v)
#define htole32(v) (v)
#define htole64(v) (v)
@ -64,7 +64,7 @@
#define htobe64(v) __builtin_bswap64(v)
#define be64toh(v) __builtin_bswap64(v)
#endif
#elif defined(RTC_ARCH_CPU_BIG_ENDIAN)
#elif defined(WEBRTC_ARCH_BIG_ENDIAN)
#define htole16(v) __builtin_bswap16(v)
#define htole32(v) __builtin_bswap32(v)
#define htole64(v) __builtin_bswap64(v)
@ -76,8 +76,8 @@
#define be64toh(v) (v)
#endif
#else
#error RTC_ARCH_CPU_BIG_ENDIAN or RTC_ARCH_CPU_LITTLE_ENDIAN must be defined.
#endif // defined(RTC_ARCH_CPU_LITTLE_ENDIAN)
#error WEBRTC_ARCH_BIG_ENDIAN or WEBRTC_ARCH_LITTLE_ENDIAN must be defined.
#endif // defined(WEBRTC_ARCH_LITTLE_ENDIAN)
#elif defined(WEBRTC_POSIX)
#include <endian.h>
#endif
@ -144,7 +144,7 @@ inline uint64_t GetLE64(const void* memory) {
// Check if the current host is big endian.
inline bool IsHostBigEndian() {
#if defined(RTC_ARCH_CPU_BIG_ENDIAN)
#if defined(WEBRTC_ARCH_BIG_ENDIAN)
return true;
#else
return false;

View file

@ -19,9 +19,8 @@
#if defined(WEBRTC_WIN)
// Include winsock2.h before including <windows.h> to maintain consistency with
// win32.h. We can't include win32.h directly here since it pulls in
// headers such as basictypes.h which causes problems in Chromium where webrtc
// exists as two separate projects, webrtc and libjingle.
// win32.h. To include win32.h directly, it must be broken out into its own
// build target.
#include <winsock2.h>
#include <windows.h>
#include <sal.h> // must come after windows headers.

View file

@ -11,9 +11,8 @@
#include "rtc_base/task_queue.h"
// Include winsock2.h before including <windows.h> to maintain consistency with
// win32.h. We can't include win32.h directly here since it pulls in
// headers such as basictypes.h which causes problems in Chromium where webrtc
// exists as two separate projects, webrtc and libjingle.
// win32.h. To include win32.h directly, it must be broken out into its own
// build target.
#include <winsock2.h>
#include <windows.h>
#include <sal.h> // Must come after windows headers.