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 #include +#include #include #include @@ -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 e38e305aa..22f8e8d78 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 #include +#include #include #include #include @@ -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 -#include - -#if defined(_WIN32) -// We don't have C++14 on Windows yet. -// Reimplement std::make_unique ourselves until we do. - -namespace internal { - -template -struct array_known_bounds; - -template -struct array_known_bounds { - constexpr static bool value = false; -}; - -template -struct array_known_bounds { - constexpr static bool value = true; -}; - -} // namespace internal - -namespace std { - -template -typename std::enable_if::value, std::unique_ptr>::type make_unique( - Args&&... args) { - return std::unique_ptr(new T(std::forward(args)...)); -} - -template -typename std::enable_if::value && !internal::array_known_bounds::value, - std::unique_ptr>::type -make_unique(std::size_t size) { - return std::unique_ptr(new typename std::remove_extent::type[size]()); -} - -template -typename std::enable_if::value && internal::array_known_bounds::value, - std::unique_ptr>::type -make_unique(Args&&... args) = delete; - -} // namespace std - -#endif diff --git a/adb/sysdeps_win32.cpp b/adb/sysdeps_win32.cpp index 878475752..0a08fbbd9 100644 --- a/adb/sysdeps_win32.cpp +++ b/adb/sysdeps_win32.cpp @@ -94,6 +94,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 #include #include +#include #include #include #include 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 #include +#include #include #include #include @@ -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 #include +#include #include #include #include @@ -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 + #include "sysdeps.h" -#include "sysdeps/memory.h" #include "transport.h" #include diff --git a/adb/types.h b/adb/types.h index 1f7008e00..0c71c3a2a 100644 --- a/adb/types.h +++ b/adb/types.h @@ -25,7 +25,6 @@ #include -#include "sysdeps/memory.h" #include "sysdeps/uio.h" // Essentially std::vector, 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 -#include "sysdeps/memory.h" +#include #include "types.h" static std::unique_ptr create_block(const std::string& string) { diff --git a/base/include/android-base/utf8.h b/base/include/android-base/utf8.h index 4b916232c..1a414ec79 100644 --- a/base/include/android-base/utf8.h +++ b/base/include/android-base/utf8.h @@ -17,6 +17,7 @@ #pragma once #ifdef _WIN32 +#include #include #else // Bring in prototypes for standard APIs so that we can import them into the utf8 namespace. diff --git a/libziparchive/Android.bp b/libziparchive/Android.bp index fd3f60290..3308adf37 100644 --- a/libziparchive/Android.bp +++ b/libziparchive/Android.bp @@ -23,11 +23,21 @@ cc_defaults { "-D_FILE_OFFSET_BITS=64", ], cppflags: [ - "-Wold-style-cast", // Incorrectly warns when C++11 empty brace {} initializer is used. // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61489 "-Wno-missing-field-initializers", ], + + // Enable -Wold-style-cast only for non-Windows targets. _islower_l, + // _isupper_l etc. in MinGW locale_win32.h (included from + // libcxx/include/__locale) has an old-style-cast. + target: { + not_windows: { + cppflags: [ + "-Wold-style-cast", + ], + }, + }, } cc_defaults {