--- android-tools-9.0.0_r47/core/libcutils/include/cutils/threads.h.glibc 2019-05-15 07:36:30.000000000 +0200 +++ android-tools-9.0.0_r47/core/libcutils/include/cutils/threads.h 2019-09-03 04:09:38.131574615 +0200 @@ -37,7 +37,11 @@ extern "C" { // Deprecated: use android::base::GetThreadId instead, which doesn't truncate on Mac/Windows. // +#ifdef __cplusplus +extern pid_t gettid() throw(); +#else extern pid_t gettid(); +#endif // // Deprecated: use `_Thread_local` in C or `thread_local` in C++. --- android-tools-9.0.0_r47/core/adb/sysdeps/posix/network.cpp.linux 2019-05-15 07:36:30.000000000 +0200 +++ android-tools-9.0.0_r47/core/adb/sysdeps/posix/network.cpp 2019-09-03 04:17:19.868149904 +0200 @@ -22,6 +22,7 @@ #include <sys/socket.h> #include <string> +#include <cstring> #include <android-base/logging.h> #include <android-base/stringprintf.h> @@ -31,7 +32,7 @@ static void set_error(std::string* error) { if (error) { - *error = strerror(errno); + *error = std::strerror(errno); } } --- android-tools-9.0.0_r47/core/libziparchive/zip_archive.cc.gcc 2019-05-15 07:36:30.000000000 +0200 +++ android-tools-9.0.0_r47/core/libziparchive/zip_archive.cc 2019-09-03 05:47:03.929095165 +0200 @@ -31,6 +31,7 @@ #include <unistd.h> #include <memory> +#include <string_view> #include <vector> #if defined(__APPLE__) --- android-tools-9.0.0_r47/core/libutils/include/utils/Vector.h.gcc 2019-09-03 06:24:31.875304226 +0200 +++ android-tools-9.0.0_r47/core/libutils/include/utils/Vector.h 2019-09-03 06:24:47.778185235 +0200 @@ -258,7 +258,7 @@ Vector<TYPE>& Vector<TYPE>::operator = ( template<class TYPE> inline const Vector<TYPE>& Vector<TYPE>::operator = (const Vector<TYPE>& rhs) const { - VectorImpl::operator = (static_cast<const VectorImpl&>(rhs)); + VectorImpl::operator = (rhs); return *this; } --- android-tools-9.0.0_r47/core/libbacktrace/Backtrace.cpp.gcc 2019-05-15 07:36:30.000000000 +0200 +++ android-tools-9.0.0_r47/core/libbacktrace/Backtrace.cpp 2019-09-03 06:58:16.624157885 +0200 @@ -27,7 +27,7 @@ #include <backtrace/Backtrace.h> #include <backtrace/BacktraceMap.h> -#include <demangle.h> +#include <cxxabi.h> #include "BacktraceLog.h" #include "UnwindStack.h" @@ -55,6 +55,7 @@ Backtrace::~Backtrace() { std::string Backtrace::GetFunctionName(uint64_t pc, uint64_t* offset, const backtrace_map_t* map) { backtrace_map_t map_value; + int status; if (map == nullptr) { FillInMap(pc, &map_value); map = &map_value; @@ -63,7 +64,10 @@ std::string Backtrace::GetFunctionName(u if (map->start == 0 || (map->flags & PROT_DEVICE_MAP)) { return ""; } - return demangle(GetFunctionNameRaw(pc, offset).c_str()); + char * cresult = abi::__cxa_demangle(GetFunctionNameRaw(pc, offset).c_str(), 0, 0, &status); + std::string result(cresult); + free(cresult); + return result; } bool Backtrace::VerifyReadWordArgs(uint64_t ptr, word_t* out_value) { --- android-tools-9.0.0_r47/core/libbacktrace/UnwindStack.cpp.gcc 2019-05-15 07:36:30.000000000 +0200 +++ android-tools-9.0.0_r47/core/libbacktrace/UnwindStack.cpp 2019-09-03 07:06:39.113384608 +0200 @@ -23,8 +23,9 @@ #include <set> #include <string> +#include <cxxabi.h> + #include <backtrace/Backtrace.h> -#include <demangle.h> #include <unwindstack/Elf.h> #include <unwindstack/MapInfo.h> #include <unwindstack/Maps.h> @@ -103,6 +104,7 @@ bool Backtrace::Unwind(unwindstack::Regs auto unwinder_frames = unwinder.frames(); frames->resize(unwinder.NumFrames() - num_ignore_frames); size_t cur_frame = 0; + int status; for (size_t i = num_ignore_frames; i < unwinder.NumFrames(); i++) { auto frame = &unwinder_frames[i]; @@ -114,7 +116,9 @@ bool Backtrace::Unwind(unwindstack::Regs back_frame->pc = frame->pc; back_frame->sp = frame->sp; - back_frame->func_name = demangle(frame->function_name.c_str()); + char * demangle_result = abi::__cxa_demangle(frame->function_name.c_str(), 0, 0, &status); + back_frame->func_name = demangle_result; + free(demangle_result); back_frame->func_offset = frame->function_offset; back_frame->map.name = frame->map_name; --- android-tools-9.0.0_r47/core/libbacktrace/UnwindStackMap.cpp.gcc 2019-05-15 07:36:30.000000000 +0200 +++ android-tools-9.0.0_r47/core/libbacktrace/UnwindStackMap.cpp 2019-09-03 07:09:14.786216083 +0200 @@ -18,6 +18,7 @@ #include <stdlib.h> #include <sys/types.h> +#include <algorithm> #include <string> #include <vector> --- android-tools-10.0.0_r2/core/adb/types.h.gcc 2019-07-16 04:56:34.000000000 +0200 +++ android-tools-10.0.0_r2/core/adb/types.h 2019-09-04 13:35:40.826662168 +0200 @@ -17,6 +17,7 @@ #pragma once #include <algorithm> +#include <cstring> #include <deque> #include <memory> #include <type_traits> @@ -234,7 +235,7 @@ struct IOVector { const block_type* first_block = chain_.front().get(); auto copy = std::make_unique<block_type>(first_block->size() - begin_offset_); - memcpy(copy->data(), first_block->data() + begin_offset_, copy->size()); + std::memcpy(copy->data(), first_block->data() + begin_offset_, copy->size()); chain_.front() = std::move(copy); chain_length_ -= begin_offset_; @@ -299,7 +300,7 @@ struct IOVector { size_t offset = 0; iterate_blocks([&offset, &result](const char* data, size_t len) { - memcpy(&result[offset], data, len); + std::memcpy(&result[offset], data, len); offset += len; }); --- android-tools-10.0.0_r2/core/base/include/android-base/logging.h.gcc 2019-07-16 04:56:34.000000000 +0200 +++ android-tools-10.0.0_r2/core/base/include/android-base/logging.h 2019-09-04 13:38:22.763485495 +0200 @@ -484,8 +484,12 @@ namespace std { // -Wno-user-defined-warnings to CPPFLAGS. #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wgcc-compat" +#ifdef __clang__ #define OSTREAM_STRING_POINTER_USAGE_WARNING \ __attribute__((diagnose_if(true, "Unexpected logging of string pointer", "warning"))) +#else +#define OSTREAM_STRING_POINTER_USAGE_WARNING +#endif inline std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer) OSTREAM_STRING_POINTER_USAGE_WARNING { return stream << static_cast<const void*>(string_pointer); --- android-tools-10.0.0_r2/core/base/include/android-base/thread_annotations.h.gcc 2019-07-16 04:56:34.000000000 +0200 +++ android-tools-10.0.0_r2/core/base/include/android-base/thread_annotations.h 2019-09-04 14:12:03.631917416 +0200 @@ -18,7 +18,11 @@ #include <mutex> +#ifdef __clang__ #define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x)) +#else +#define THREAD_ANNOTATION_ATTRIBUTE__(x) +#endif #define CAPABILITY(x) \ THREAD_ANNOTATION_ATTRIBUTE__(capability(x)) --- android-tools-10.0.0_r2/core/adb/socket_spec.cpp.gcc 2019-09-04 14:36:31.848338951 +0200 +++ android-tools-10.0.0_r2/core/adb/socket_spec.cpp 2019-09-04 14:36:50.774201910 +0200 @@ -314,7 +314,7 @@ int socket_spec_listen(std::string_view addr.svm_port = port == 0 ? VMADDR_PORT_ANY : port; addr.svm_cid = VMADDR_CID_ANY; socklen_t addr_len = sizeof(addr); - if (bind(serverfd, reinterpret_cast<struct sockaddr*>(&addr), addr_len)) { + if (::bind(serverfd, reinterpret_cast<struct sockaddr*>(&addr), addr_len)) { return -1; } if (listen(serverfd, 4)) { --- android-tools-10.0.0_r2/core/liblog/logger.h.gcc 2019-09-04 14:48:20.805274746 +0200 +++ android-tools-10.0.0_r2/core/liblog/logger.h 2019-09-04 14:49:09.715927217 +0200 @@ -16,7 +16,7 @@ #pragma once -#include <stdatomic.h> +#include <atomic> #include <stdbool.h> #include <cutils/list.h> @@ -30,10 +30,10 @@ __BEGIN_DECLS /* Union, sock or fd of zero is not allowed unless static initialized */ union android_log_context_union { void* priv; - atomic_int sock; - atomic_int fd; + std::atomic_int sock; + std::atomic_int fd; struct listnode* node; - atomic_uintptr_t atomic_pointer; + std::atomic_uintptr_t atomic_pointer; }; struct android_log_transport_write { --- android-tools-10.0.0_r2/core/liblog/logger_write.cpp.gcc 2019-07-16 04:56:34.000000000 +0200 +++ android-tools-10.0.0_r2/core/liblog/logger_write.cpp 2019-09-04 14:50:40.370282625 +0200 @@ -15,7 +15,7 @@ */ #include <errno.h> -#include <stdatomic.h> +#include <atomic> #include <stdlib.h> #include <string.h> #include <sys/time.h> --- android-tools-10.0.0_r2/core/liblog/stderr_write.cpp.gcc 2019-09-04 14:53:17.539163715 +0200 +++ android-tools-10.0.0_r2/core/liblog/stderr_write.cpp 2019-09-04 14:54:18.849726794 +0200 @@ -56,8 +56,8 @@ struct stderrContext { struct android_log_transport_write stderrLoggerWrite = { .node = {&stderrLoggerWrite.node, &stderrLoggerWrite.node}, - .context.priv = NULL, .name = "stderr", + .context = {.priv = NULL}, .available = stderrAvailable, .open = stderrOpen, .close = stderrClose, --- android-tools-10.0.0_r2/core/liblog/fake_writer.cpp.gcc 2019-07-16 04:56:34.000000000 +0200 +++ android-tools-10.0.0_r2/core/liblog/fake_writer.cpp 2019-09-04 14:55:16.881313013 +0200 @@ -33,8 +33,8 @@ static int logFds[(int)LOG_ID_MAX] = {-1 struct android_log_transport_write fakeLoggerWrite = { .node = {&fakeLoggerWrite.node, &fakeLoggerWrite.node}, - .context.priv = &logFds, .name = "fake", + .context = { .priv = &logFds }, .available = NULL, .open = fakeOpen, .close = fakeClose, --- android-tools-10.0.0_r2/core/libziparchive/zip_archive_common.h.gcc 2019-09-04 15:45:52.830691331 +0200 +++ android-tools-10.0.0_r2/core/libziparchive/zip_archive_common.h 2019-09-04 15:47:32.072996457 +0200 @@ -58,9 +58,9 @@ struct EocdRecord { // Length of the central directory comment. uint16_t comment_length; - private: - EocdRecord() = default; - DISALLOW_COPY_AND_ASSIGN(EocdRecord); +// private: +// EocdRecord() = default; +// DISALLOW_COPY_AND_ASSIGN(EocdRecord); } __attribute__((packed)); // A structure representing the fixed length fields for a single @@ -113,9 +113,9 @@ struct CentralDirectoryRecord { // beginning of this archive. uint32_t local_file_header_offset; - private: - CentralDirectoryRecord() = default; - DISALLOW_COPY_AND_ASSIGN(CentralDirectoryRecord); +// private: +// CentralDirectoryRecord() = default; +// DISALLOW_COPY_AND_ASSIGN(CentralDirectoryRecord); } __attribute__((packed)); // The local file header for a given entry. This duplicates information @@ -152,9 +152,9 @@ struct LocalFileHeader { // will appear immediately after the entry file name. uint16_t extra_field_length; - private: - LocalFileHeader() = default; - DISALLOW_COPY_AND_ASSIGN(LocalFileHeader); +// private: +// LocalFileHeader() = default; +// DISALLOW_COPY_AND_ASSIGN(LocalFileHeader); } __attribute__((packed)); struct DataDescriptor { @@ -168,9 +168,9 @@ struct DataDescriptor { // Uncompressed size of the entry. uint32_t uncompressed_size; - private: - DataDescriptor() = default; - DISALLOW_COPY_AND_ASSIGN(DataDescriptor); +// private: +// DataDescriptor() = default; +// DISALLOW_COPY_AND_ASSIGN(DataDescriptor); } __attribute__((packed)); // mask value that signifies that the entry has a DD --- android-tools-10.0.0_r2/core/fs_mgr/liblp/reader.cpp.gcc 2019-07-16 04:56:34.000000000 +0200 +++ android-tools-10.0.0_r2/core/fs_mgr/liblp/reader.cpp 2019-09-04 16:00:42.585427619 +0200 @@ -16,6 +16,7 @@ #include "reader.h" +#include <string.h> #include <stddef.h> #include <stdlib.h> #include <unistd.h> --- android-tools-10.0.0_r2/core/fs_mgr/liblp/writer.cpp.gcc 2019-07-16 04:56:34.000000000 +0200 +++ android-tools-10.0.0_r2/core/fs_mgr/liblp/writer.cpp 2019-09-04 16:02:16.611754242 +0200 @@ -17,6 +17,7 @@ #include "writer.h" #include <inttypes.h> +#include <string.h> #include <unistd.h> #include <string>