Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2ccce87 authored by Pirama Arumuga Nainar's avatar Pirama Arumuga Nainar Committed by Gerrit Code Review
Browse files

Merge changes from topic "windows-libcxx"

* changes:
  Do not enable -Wold-style-cast for Windows
  Add sys/types.h in utf8.h
  Adapt to switch to libc++ for Windows
parents 8ef3fe14 53f59456
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+0 −1
Original line number Diff line number Diff line
@@ -63,7 +63,6 @@
#include "services.h"
#include "shell_protocol.h"
#include "sysdeps/chrono.h"
#include "sysdeps/memory.h"

extern int gListenAll;

+1 −1
Original line number Diff line number Diff line
@@ -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:
+0 −4
Original line number Diff line number Diff line
@@ -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);       \

adb/sysdeps/memory.h

deleted100644 → 0
+0 −65
Original line number Diff line number Diff line
#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
Loading