Adapt to switch to libc++ for Windows

Bug: http://b/91353691

- libcxx has ETXTBSY for Windows
- adb/sysdeps/memory.h is no longer needed

Test: Build and test Windows binaries under Wine.

Change-Id: I9c27087d46c49cb25b391c4adae8d9e24724784d
This commit is contained in:
Pirama Arumuga Nainar 2018-08-08 10:33:24 -07:00
parent 11c7f43b90
commit 29e3dd8548
12 changed files with 12 additions and 78 deletions

View file

@ -21,6 +21,7 @@
#include <algorithm>
#include <list>
#include <memory>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
@ -29,7 +30,6 @@
#include "socket_spec.h"
#include "sysdeps.h"
#include "sysdeps/memory.h"
#include "transport.h"
// A listener is an entity which binds to a local port and, upon receiving a connection on that

View file

@ -63,7 +63,6 @@
#include "services.h"
#include "shell_protocol.h"
#include "sysdeps/chrono.h"
#include "sysdeps/memory.h"
extern int gListenAll;

View file

@ -19,6 +19,7 @@
#include <gtest/gtest.h>
#include <limits>
#include <memory>
#include <queue>
#include <string>
#include <thread>
@ -26,7 +27,6 @@
#include "adb_io.h"
#include "fdevent_test.h"
#include "sysdeps/memory.h"
class FdHandler {
public:

View file

@ -24,10 +24,6 @@
#include "adb.h"
#if defined(_WIN32)
#define ETXTBSY EBUSY
#endif
// Use the linux asm-generic values for errno (which are used on all android archs but mips).
#define ERRNO_VALUES() \
ERRNO_VALUE(EACCES, 13); \

View file

@ -1,65 +0,0 @@
#pragma once
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <memory>
#include <type_traits>
#if defined(_WIN32)
// We don't have C++14 on Windows yet.
// Reimplement std::make_unique ourselves until we do.
namespace internal {
template <typename T>
struct array_known_bounds;
template <typename T>
struct array_known_bounds<T[]> {
constexpr static bool value = false;
};
template <typename T, size_t N>
struct array_known_bounds<T[N]> {
constexpr static bool value = true;
};
} // namespace internal
namespace std {
template <typename T, typename... Args>
typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type make_unique(
Args&&... args) {
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
template <typename T>
typename std::enable_if<std::is_array<T>::value && !internal::array_known_bounds<T>::value,
std::unique_ptr<T>>::type
make_unique(std::size_t size) {
return std::unique_ptr<T>(new typename std::remove_extent<T>::type[size]());
}
template <typename T, typename... Args>
typename std::enable_if<std::is_array<T>::value && internal::array_known_bounds<T>::value,
std::unique_ptr<T>>::type
make_unique(Args&&... args) = delete;
} // namespace std
#endif

View file

@ -95,6 +95,10 @@ static const FHClassRec _fh_socket_class = {
_fh_socket_writev,
};
#if defined(assert)
#undef assert
#endif
#define assert(cond) \
do { \
if (!(cond)) fatal("assertion failed '%s' on %s:%d\n", #cond, __FILE__, __LINE__); \

View file

@ -17,7 +17,6 @@
#define TRACE_TAG TRANSPORT
#include "sysdeps.h"
#include "sysdeps/memory.h"
#include "transport.h"
@ -32,6 +31,7 @@
#include <algorithm>
#include <deque>
#include <list>
#include <memory>
#include <mutex>
#include <set>
#include <thread>

View file

@ -17,6 +17,7 @@
#include <stdint.h>
#include <deque>
#include <memory>
#include <mutex>
#include <string>
#include <thread>
@ -28,7 +29,6 @@
#include "adb_unique_fd.h"
#include "adb_utils.h"
#include "sysdeps.h"
#include "sysdeps/memory.h"
#include "transport.h"
#include "types.h"

View file

@ -26,6 +26,7 @@
#include <sys/types.h>
#include <condition_variable>
#include <memory>
#include <mutex>
#include <thread>
#include <unordered_map>
@ -45,7 +46,6 @@
#include "adb_unique_fd.h"
#include "adb_utils.h"
#include "sysdeps/chrono.h"
#include "sysdeps/memory.h"
#if ADB_HOST

View file

@ -16,8 +16,9 @@
#define TRACE_TAG TRANSPORT
#include <memory>
#include "sysdeps.h"
#include "sysdeps/memory.h"
#include "transport.h"
#include <stdio.h>

View file

@ -25,7 +25,6 @@
#include <android-base/logging.h>
#include "sysdeps/memory.h"
#include "sysdeps/uio.h"
// Essentially std::vector<char>, except without zero initialization or reallocation.

View file

@ -16,7 +16,7 @@
#include <gtest/gtest.h>
#include "sysdeps/memory.h"
#include <memory>
#include "types.h"
static std::unique_ptr<IOVector::block_type> create_block(const std::string& string) {