Commit 6aef90f3 authored by Danil Chapovalov's avatar Danil Chapovalov Committed by Commit Bot

Roll abseil_revision f624790b7f..41a6263fd0

Change Log:
https://chromium.googlesource.com/external/github.com/abseil/abseil-cpp/+log/f624790b7f..41a6263fd0
Full diff:
https://chromium.googlesource.com/external/github.com/abseil/abseil-cpp/+/f624790b7f..41a6263fd0

Bug: None
Change-Id: I79e04696901bf607d83ff66393340de2bd5da3f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2315143Reviewed-by: default avatarMirko Bonadei <mbonadei@chromium.org>
Commit-Queue: Danil Chapovalov <danilchap@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791269}
parent cce93de9
......@@ -22,16 +22,24 @@
cmake_minimum_required(VERSION 3.5)
# Compiler id for Apple Clang is now AppleClang.
cmake_policy(SET CMP0025 NEW)
if (POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif (POLICY CMP0025)
# if command can use IN_LIST
cmake_policy(SET CMP0057 NEW)
if (POLICY CMP0057)
cmake_policy(SET CMP0057 NEW)
endif (POLICY CMP0057)
# Project version variables are the empty string if version is unspecified
cmake_policy(SET CMP0048 NEW)
if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif (POLICY CMP0048)
# option() honor variables
cmake_policy(SET CMP0077 NEW)
if (POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif (POLICY CMP0077)
project(absl CXX)
......
......@@ -4,7 +4,7 @@ URL: https://github.com/abseil/abseil-cpp
License: Apache 2.0
License File: LICENSE
Version: 0
Revision: f624790b7f76ab92fed5ae966abb99a0d455c96f
Revision: 41a6263fd0bcc93a90ff739785f17260f8ea061e
Security Critical: yes
Description:
......
......@@ -154,6 +154,12 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
#define ABSL_INTERNAL_HAS_KEYWORD(x) 0
#endif
#ifdef __has_feature
#define ABSL_HAVE_FEATURE(f) __has_feature(f)
#else
#define ABSL_HAVE_FEATURE(f) 0
#endif
// ABSL_HAVE_TLS is defined to 1 when __thread should be supported.
// We assume __thread is supported on Linux when compiled with Clang or compiled
// against libstdc++ with _GLIBCXX_HAVE_TLS defined.
......@@ -226,11 +232,9 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
// * Xcode 9.3 started disallowing `thread_local` for 32-bit iOS simulator
// targeting iOS 9.x.
// * Xcode 10 moves the deployment target check for iOS < 9.0 to link time
// making __has_feature unreliable there.
// making ABSL_HAVE_FEATURE unreliable there.
//
// Otherwise, `__has_feature` is only supported by Clang so it has be inside
// `defined(__APPLE__)` check.
#if __has_feature(cxx_thread_local) && \
#if ABSL_HAVE_FEATURE(cxx_thread_local) && \
!(TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0)
#define ABSL_HAVE_THREAD_LOCAL 1
#endif
......@@ -312,15 +316,15 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
#if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 6)
// Clang >= 3.6
#if __has_feature(cxx_exceptions)
#if ABSL_HAVE_FEATURE(cxx_exceptions)
#define ABSL_HAVE_EXCEPTIONS 1
#endif // __has_feature(cxx_exceptions)
#endif // ABSL_HAVE_FEATURE(cxx_exceptions)
#else
// Clang < 3.6
// http://releases.llvm.org/3.6.0/tools/clang/docs/ReleaseNotes.html#the-exceptions-macro
#if defined(__EXCEPTIONS) && __has_feature(cxx_exceptions)
#if defined(__EXCEPTIONS) && ABSL_HAVE_FEATURE(cxx_exceptions)
#define ABSL_HAVE_EXCEPTIONS 1
#endif // defined(__EXCEPTIONS) && __has_feature(cxx_exceptions)
#endif // defined(__EXCEPTIONS) && ABSL_HAVE_FEATURE(cxx_exceptions)
#endif // __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 6)
// Handle remaining special cases and default to exceptions being supported.
......@@ -661,4 +665,50 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
#define ABSL_DLL
#endif // defined(_MSC_VER)
// ABSL_HAVE_MEMORY_SANITIZER
//
// MemorySanitizer (MSan) is a detector of uninitialized reads. It consists of
// a compiler instrumentation module and a run-time library.
#ifdef ABSL_HAVE_MEMORY_SANITIZER
#error "ABSL_HAVE_MEMORY_SANITIZER cannot be directly set."
#elif defined(MEMORY_SANITIZER)
// The MEMORY_SANITIZER macro is deprecated but we will continue to honor it
// for now.
#define ABSL_HAVE_MEMORY_SANITIZER 1
#elif defined(__SANITIZE_MEMORY__)
#define ABSL_HAVE_MEMORY_SANITIZER 1
#elif !defined(__native_client__) && ABSL_HAVE_FEATURE(memory_sanitizer)
#define ABSL_HAVE_MEMORY_SANITIZER 1
#endif
// ABSL_HAVE_THREAD_SANITIZER
//
// ThreadSanitizer (TSan) is a fast data race detector.
#ifdef ABSL_HAVE_THREAD_SANITIZER
#error "ABSL_HAVE_THREAD_SANITIZER cannot be directly set."
#elif defined(THREAD_SANITIZER)
// The THREAD_SANITIZER macro is deprecated but we will continue to honor it
// for now.
#define ABSL_HAVE_THREAD_SANITIZER 1
#elif defined(__SANITIZE_THREAD__)
#define ABSL_HAVE_THREAD_SANITIZER 1
#elif ABSL_HAVE_FEATURE(thread_sanitizer)
#define ABSL_HAVE_THREAD_SANITIZER 1
#endif
// ABSL_HAVE_ADDRESS_SANITIZER
//
// AddressSanitizer (ASan) is a fast memory error detector.
#ifdef ABSL_HAVE_ADDRESS_SANITIZER
#error "ABSL_HAVE_ADDRESS_SANITIZER cannot be directly set."
#elif defined(ADDRESS_SANITIZER)
// The ADDRESS_SANITIZER macro is deprecated but we will continue to honor it
// for now.
#define ABSL_HAVE_ADDRESS_SANITIZER 1
#elif defined(__SANITIZE_ADDRESS__)
#define ABSL_HAVE_ADDRESS_SANITIZER 1
#elif ABSL_HAVE_FEATURE(address_sanitizer)
#define ABSL_HAVE_ADDRESS_SANITIZER 1
#endif
#endif // ABSL_BASE_CONFIG_H_
......@@ -18,14 +18,14 @@
#include "absl/base/dynamic_annotations.h"
// Compiler-based ThreadSanitizer defines
// ABSL_DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL = 1
// DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL = 1
// and provides its own definitions of the functions.
#ifndef ABSL_DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL
# define ABSL_DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL 0
#ifndef DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL
# define DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL 0
#endif
#if ABSL_DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL == 0 && !defined(__native_client__)
#if DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL == 0 && !defined(__native_client__)
extern "C" {
......@@ -69,4 +69,4 @@ double AbslValgrindSlowdown(void) {
}
} // extern "C"
#endif // ABSL_DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL == 0
#endif // DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL == 0
......@@ -41,7 +41,7 @@
#endif
// -----------------------------------------------------------------------------
// Compiler Check
// Toolchain Check
// -----------------------------------------------------------------------------
// We support MSVC++ 14.0 update 2 and later.
......
......@@ -307,7 +307,7 @@
// Disables warnings for a single read operation. This can be used to avoid
// warnings when it is known that the read is not actually involved in a race,
// but the compiler cannot confirm that.
#define ABSL_TS_UNCHECKED_READ(x) absl::base_internal::absl_ts_unchecked_read(x)
#define ABSL_TS_UNCHECKED_READ(x) absl::base_internal::ts_unchecked_read(x)
namespace absl {
ABSL_NAMESPACE_BEGIN
......@@ -317,12 +317,12 @@ namespace base_internal {
// reference.
// Do not used this function directly, use ABSL_TS_UNCHECKED_READ instead.
template <typename T>
inline const T& absl_ts_unchecked_read(const T& v) ABSL_NO_THREAD_SAFETY_ANALYSIS {
inline const T& ts_unchecked_read(const T& v) ABSL_NO_THREAD_SAFETY_ANALYSIS {
return v;
}
template <typename T>
inline T& absl_ts_unchecked_read(T& v) ABSL_NO_THREAD_SAFETY_ANALYSIS {
inline T& ts_unchecked_read(T& v) ABSL_NO_THREAD_SAFETY_ANALYSIS {
return v;
}
......
......@@ -2509,6 +2509,39 @@ TEST(Btree,
EXPECT_THAT(m2,
ElementsAre(Pair(IsEmpty(), 1), Pair(ElementsAre(IsNull()), 2)));
}
TEST(Btree, HeterogeneousTryEmplace) {
absl::btree_map<std::string, int> m;
std::string s = "key";
absl::string_view sv = s;
m.try_emplace(sv, 1);
EXPECT_EQ(m[s], 1);
m.try_emplace(m.end(), sv, 2);
EXPECT_EQ(m[s], 1);
}
TEST(Btree, HeterogeneousOperatorMapped) {
absl::btree_map<std::string, int> m;
std::string s = "key";
absl::string_view sv = s;
m[sv] = 1;
EXPECT_EQ(m[s], 1);
m[sv] = 2;
EXPECT_EQ(m[s], 2);
}
TEST(Btree, HeterogeneousInsertOrAssign) {
absl::btree_map<std::string, int> m;
std::string s = "key";
absl::string_view sv = s;
m.insert_or_assign(sv, 1);
EXPECT_EQ(m[s], 1);
m.insert_or_assign(m.end(), sv, 2);
EXPECT_EQ(m[s], 2);
}
#endif
} // namespace
......
......@@ -81,6 +81,7 @@ list(APPEND ABSL_GCC_FLAGS
"-Wmissing-declarations"
"-Woverlength-strings"
"-Wpointer-arith"
"-Wundef"
"-Wunused-local-typedefs"
"-Wunused-result"
"-Wvarargs"
......
......@@ -82,6 +82,7 @@ ABSL_GCC_FLAGS = [
"-Wmissing-declarations",
"-Woverlength-strings",
"-Wpointer-arith",
"-Wundef",
"-Wunused-local-typedefs",
"-Wunused-result",
"-Wvarargs",
......
......@@ -128,6 +128,7 @@ COPT_VARS = {
"-Wmissing-declarations",
"-Woverlength-strings",
"-Wpointer-arith",
"-Wundef",
"-Wunused-local-typedefs",
"-Wunused-result",
"-Wvarargs",
......
......@@ -17,6 +17,7 @@
#include "absl/memory/memory.h"
#include <sys/types.h>
#include <cstddef>
#include <memory>
#include <string>
......@@ -36,10 +37,10 @@ using ::testing::Return;
// been called, via the instance_count variable.
class DestructorVerifier {
public:
DestructorVerifier() { ++instance_count_; }
DestructorVerifier() { ++instance_count_; }
DestructorVerifier(const DestructorVerifier&) = delete;
DestructorVerifier& operator=(const DestructorVerifier&) = delete;
~DestructorVerifier() { --instance_count_; }
~DestructorVerifier() { --instance_count_; }
// The number of instances of this class currently active.
static int instance_count() { return instance_count_; }
......@@ -156,9 +157,7 @@ struct ArrayWatch {
allocs().push_back(n);
return ::operator new[](n);
}
void operator delete[](void* p) {
return ::operator delete[](p);
}
void operator delete[](void* p) { return ::operator delete[](p); }
static std::vector<size_t>& allocs() {
static auto& v = *new std::vector<size_t>;
return v;
......@@ -171,8 +170,7 @@ TEST(Make_UniqueTest, Array) {
ArrayWatch::allocs().clear();
auto p = absl::make_unique<ArrayWatch[]>(5);
static_assert(std::is_same<decltype(p),
std::unique_ptr<ArrayWatch[]>>::value,
static_assert(std::is_same<decltype(p), std::unique_ptr<ArrayWatch[]>>::value,
"unexpected return type");
EXPECT_THAT(ArrayWatch::allocs(), ElementsAre(5 * sizeof(ArrayWatch)));
}
......@@ -181,7 +179,7 @@ TEST(Make_UniqueTest, NotAmbiguousWithStdMakeUnique) {
// Ensure that absl::make_unique is not ambiguous with std::make_unique.
// In C++14 mode, the below call to make_unique has both types as candidates.
struct TakesStdType {
explicit TakesStdType(const std::vector<int> &vec) {}
explicit TakesStdType(const std::vector<int>& vec) {}
};
using absl::make_unique;
(void)make_unique<TakesStdType>(std::vector<int>());
......@@ -541,8 +539,8 @@ struct MinimalMockAllocator {
MinimalMockAllocator(const MinimalMockAllocator& other)
: value(other.value) {}
using value_type = TestValue;
MOCK_METHOD1(allocate, value_type*(size_t));
MOCK_METHOD2(deallocate, void(value_type*, size_t));
MOCK_METHOD(value_type*, allocate, (size_t));
MOCK_METHOD(void, deallocate, (value_type*, size_t));
int value;
};
......@@ -579,13 +577,14 @@ struct FullMockAllocator {
explicit FullMockAllocator(int value) : value(value) {}
FullMockAllocator(const FullMockAllocator& other) : value(other.value) {}
using value_type = TestValue;
MOCK_METHOD1(allocate, value_type*(size_t));
MOCK_METHOD2(allocate, value_type*(size_t, const void*));
MOCK_METHOD2(construct, void(value_type*, int*));
MOCK_METHOD1(destroy, void(value_type*));
MOCK_CONST_METHOD0(max_size, size_t());
MOCK_CONST_METHOD0(select_on_container_copy_construction,
FullMockAllocator());
MOCK_METHOD(value_type*, allocate, (size_t));
MOCK_METHOD(value_type*, allocate, (size_t, const void*));
MOCK_METHOD(void, construct, (value_type*, int*));
MOCK_METHOD(void, destroy, (value_type*));
MOCK_METHOD(size_t, max_size, (),
(const));
MOCK_METHOD(FullMockAllocator, select_on_container_copy_construction, (),
(const));
int value;
};
......@@ -642,8 +641,7 @@ TEST(AllocatorNoThrowTest, CustomAllocator) {
struct CanThrowAllocator {
using is_nothrow = std::false_type;
};
struct UnspecifiedAllocator {
};
struct UnspecifiedAllocator {};
EXPECT_TRUE(absl::allocator_is_nothrow<NoThrowAllocator>::value);
EXPECT_FALSE(absl::allocator_is_nothrow<CanThrowAllocator>::value);
EXPECT_FALSE(absl::allocator_is_nothrow<UnspecifiedAllocator>::value);
......
......@@ -150,6 +150,7 @@ struct alignas(16) u64x2 {
#include <altivec.h>
// <altivec.h> #defines vector __vector; in C++, this is bad form.
#undef vector
#undef bool
// Rely on the PowerPC AltiVec vector operations for accelerated AES
// instructions. GCC support of the PPC vector types is described in:
......
#!/bin/bash
# This script renames all the functions and the macros defined in
# absl/base/dynamic_annotations.{h,cc} and absl/base/thread_annotations.h.
# absl/base/dynamic_annotations.{h,cc}.
#
# Chromium's dynamic_annotations live in //base/third_party/dynamic_annotations
# and its //base contains a copy of thread_annotations.h which conflict with
# Abseil's versions (ODR violations and macro clashing).
# which conflict with Abseil's versions (ODR violations).
# In order to avoid problems in Chromium, this copy of Abseil has its own
# dynamic_annotations and thread_annotations renamed.
# dynamic_annotations renamed.
# -------------------------- dynamic_annotations -------------------------
for w in \
AnnotateBarrierDestroy \
AnnotateBarrierInit \
AnnotateBarrierWaitAfter \
AnnotateBarrierWaitBefore \
AnnotateBenignRace \
AnnotateBenignRaceSized \
AnnotateCondVarSignal \
AnnotateCondVarSignalAll \
AnnotateCondVarWait \
AnnotateEnableRaceDetection \
AnnotateExpectRace \
AnnotateFlushExpectedRaces \
AnnotateFlushState \
AnnotateHappensAfter \
AnnotateHappensBefore \
AnnotateIgnoreReadsBegin \
AnnotateIgnoreReadsEnd \
AnnotateIgnoreSyncBegin \
AnnotateIgnoreSyncEnd \
AnnotateIgnoreWritesBegin \
AnnotateIgnoreWritesEnd \
AnnotateMemoryIsInitialized \
AnnotateMemoryIsUninitialized \
AnnotateMutexIsNotPHB \
AnnotateMutexIsUsedAsCondVar \
AnnotateNewMemory \
AnnotateNoOp \
AnnotatePCQCreate \
AnnotatePCQDestroy \
AnnotatePCQGet \
AnnotatePCQPut \
AnnotatePublishMemoryRange \
AnnotateRWLockAcquired \
AnnotateRWLockCreate \
AnnotateRWLockCreateStatic \
AnnotateRWLockDestroy \
AnnotateRWLockReleased \
AnnotateThreadName \
AnnotateTraceMemory \
AnnotateUnpublishMemoryRange \
GetRunningOnValgrind \
RunningOnValgrind \
StaticAnnotateIgnoreReadsBegin \
StaticAnnotateIgnoreReadsEnd \
StaticAnnotateIgnoreWritesBegin \
StaticAnnotateIgnoreWritesEnd \
ValgrindSlowdown \
; do
find absl/ -type f -exec sed -i "s/\b$w\b/Absl$w/g" {} \;
done
for w in \
ADDRESS_SANITIZER_REDZONE \
ANNOTALYSIS_ENABLED \
ANNOTATE_BARRIER_DESTROY \
ANNOTATE_BARRIER_INIT \
ANNOTATE_BARRIER_WAIT_AFTER \
ANNOTATE_BARRIER_WAIT_BEFORE \
ANNOTATE_BENIGN_RACE \
ANNOTATE_BENIGN_RACE_SIZED \
ANNOTATE_BENIGN_RACE_STATIC \
ANNOTATE_CONDVAR_LOCK_WAIT \
ANNOTATE_CONDVAR_SIGNAL \
ANNOTATE_CONDVAR_SIGNAL_ALL \
ANNOTATE_CONDVAR_WAIT \
ANNOTATE_CONTIGUOUS_CONTAINER \
ANNOTATE_ENABLE_RACE_DETECTION \
ANNOTATE_EXPECT_RACE \
ANNOTATE_FLUSH_EXPECTED_RACES \
ANNOTATE_FLUSH_STATE \
ANNOTATE_HAPPENS_AFTER \
ANNOTATE_HAPPENS_BEFORE \
ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN ANNOTATE_IGNORE_READS_AND_WRITES_END \
ANNOTATE_IGNORE_READS_BEGIN \
ANNOTATE_IGNORE_READS_END \
ANNOTATE_IGNORE_SYNC_BEGIN \
ANNOTATE_IGNORE_SYNC_END \
ANNOTATE_IGNORE_WRITES_BEGIN \
ANNOTATE_IGNORE_WRITES_END \
ANNOTATE_MEMORY_IS_INITIALIZED \
ANNOTATE_MEMORY_IS_UNINITIALIZED \
ANNOTATE_MUTEX_IS_USED_AS_CONDVAR \
ANNOTATE_NEW_MEMORY \
ANNOTATE_NOT_HAPPENS_BEFORE_MUTEX \
ANNOTATE_NO_OP \
ANNOTATE_PCQ_CREATE ANNOTATE_PCQ_DESTROY \
ANNOTATE_PCQ_GET ANNOTATE_PCQ_PUT \
ANNOTATE_PUBLISH_MEMORY_RANGE \
ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX \
ANNOTATE_RWLOCK_ACQUIRED \
ANNOTATE_RWLOCK_CREATE \
ANNOTATE_RWLOCK_CREATE_STATIC \
ANNOTATE_RWLOCK_DESTROY \
ANNOTATE_RWLOCK_RELEASED \
ANNOTATE_SWAP_MEMORY_RANGE \
ANNOTATE_THREAD_NAME \
ANNOTATE_TRACE_MEMORY \
ANNOTATE_UNPROTECTED_READ \
ANNOTATE_UNPUBLISH_MEMORY_RANGE \
ANNOTATIONS_ENABLED \
ATTRIBUTE_IGNORE_READS_BEGIN \
ATTRIBUTE_IGNORE_READS_END \
DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK \
DYNAMIC_ANNOTATIONS_ENABLED \
DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL \
DYNAMIC_ANNOTATIONS_GLUE \
DYNAMIC_ANNOTATIONS_GLUE0 \
DYNAMIC_ANNOTATIONS_IMPL \
DYNAMIC_ANNOTATIONS_NAME \
DYNAMIC_ANNOTATIONS_PREFIX \
DYNAMIC_ANNOTATIONS_PROVIDE_RUNNING_ON_VALGRIND \
DYNAMIC_ANNOTATIONS_WANT_ATTRIBUTE_WEAK \
; do
find absl/ -type f -exec sed -i "s/\b$w\b/ABSL_$w/g" {} \;
done
# -------------------------- thread_annotations -------------------------
for w in \
ts_unchecked_read \
; do
find absl/ -type f -exec sed -i "s/\b$w\b/absl_$w/g" {} \;
done
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment