diff options
author | Pirama Arumuga Nainar <pirama@google.com> | 2018-08-08 10:33:24 -0700 |
---|---|---|
committer | Pirama Arumuga Nainar <pirama@google.com> | 2018-09-21 10:46:25 -0700 |
commit | 29e3dd8548dbaa8c14b8092f4407e1cc3256c35a (patch) | |
tree | 3057b83836aa0544b29e28ab40abd7a40de808d5 | |
parent | 11c7f43b90fab5e2689d623d752bb68e9804a8cf (diff) | |
download | system_core-29e3dd8548dbaa8c14b8092f4407e1cc3256c35a.tar.gz system_core-29e3dd8548dbaa8c14b8092f4407e1cc3256c35a.tar.bz2 system_core-29e3dd8548dbaa8c14b8092f4407e1cc3256c35a.zip |
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
-rw-r--r-- | adb/adb_listeners.cpp | 2 | ||||
-rw-r--r-- | adb/client/commandline.cpp | 1 | ||||
-rw-r--r-- | adb/fdevent_test.cpp | 2 | ||||
-rw-r--r-- | adb/sysdeps/errno.cpp | 4 | ||||
-rw-r--r-- | adb/sysdeps/memory.h | 65 | ||||
-rw-r--r-- | adb/sysdeps_win32.cpp | 4 | ||||
-rw-r--r-- | adb/transport.cpp | 2 | ||||
-rw-r--r-- | adb/transport_fd.cpp | 2 | ||||
-rw-r--r-- | adb/transport_local.cpp | 2 | ||||
-rw-r--r-- | adb/transport_usb.cpp | 3 | ||||
-rw-r--r-- | adb/types.h | 1 | ||||
-rw-r--r-- | adb/types_test.cpp | 2 |
12 files changed, 12 insertions, 78 deletions
diff --git a/adb/adb_listeners.cpp b/adb/adb_listeners.cpp index f4a92e360..051ab738d 100644 --- a/adb/adb_listeners.cpp +++ b/adb/adb_listeners.cpp @@ -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 diff --git a/adb/client/commandline.cpp b/adb/client/commandline.cpp index 6e143c1ec..5bd7c7d36 100644 --- a/adb/client/commandline.cpp +++ b/adb/client/commandline.cpp @@ -63,7 +63,6 @@ #include "services.h" #include "shell_protocol.h" #include "sysdeps/chrono.h" -#include "sysdeps/memory.h" extern int gListenAll; diff --git a/adb/fdevent_test.cpp b/adb/fdevent_test.cpp index 0cb24390a..816134f8f 100644 --- a/adb/fdevent_test.cpp +++ b/adb/fdevent_test.cpp @@ -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: diff --git a/adb/sysdeps/errno.cpp b/adb/sysdeps/errno.cpp index 68699476a..9a37ea2fd 100644 --- a/adb/sysdeps/errno.cpp +++ b/adb/sysdeps/errno.cpp @@ -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); \ diff --git a/adb/sysdeps/memory.h b/adb/sysdeps/memory.h deleted file mode 100644 index 4108aff87..000000000 --- a/adb/sysdeps/memory.h +++ /dev/null @@ -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 diff --git a/adb/sysdeps_win32.cpp b/adb/sysdeps_win32.cpp index 026dd1c0d..38cdb5767 100644 --- a/adb/sysdeps_win32.cpp +++ b/adb/sysdeps_win32.cpp @@ -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__); \ diff --git a/adb/transport.cpp b/adb/transport.cpp index 95df49006..cabd2795c 100644 --- a/adb/transport.cpp +++ b/adb/transport.cpp @@ -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> diff --git a/adb/transport_fd.cpp b/adb/transport_fd.cpp index 85f3c5299..ec6127951 100644 --- a/adb/transport_fd.cpp +++ b/adb/transport_fd.cpp @@ -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" diff --git a/adb/transport_local.cpp b/adb/transport_local.cpp index 8353d89f2..dc87ac74f 100644 --- a/adb/transport_local.cpp +++ b/adb/transport_local.cpp @@ -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 diff --git a/adb/transport_usb.cpp b/adb/transport_usb.cpp index 602970ca6..c471bf985 100644 --- a/adb/transport_usb.cpp +++ b/adb/transport_usb.cpp @@ -16,8 +16,9 @@ #define TRACE_TAG TRANSPORT +#include <memory> + #include "sysdeps.h" -#include "sysdeps/memory.h" #include "transport.h" #include <stdio.h> diff --git a/adb/types.h b/adb/types.h index a3e5d4842..ec17941f7 100644 --- a/adb/types.h +++ b/adb/types.h @@ -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. diff --git a/adb/types_test.cpp b/adb/types_test.cpp index 31ab90af3..1fbd2ca2d 100644 --- a/adb/types_test.cpp +++ b/adb/types_test.cpp @@ -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) { |