Project import generated by Copybara.

GitOrigin-RevId: d89dba27e3
Change-Id: I0eae80578a93a580820bc90d42e6b42faf7fde0a
This commit is contained in:
Abseil Team
2018-06-20 06:25:23 -07:00
committed by Shaindel Schwartz
parent e5be80532b
commit 6c7de165d1
217 changed files with 5280 additions and 171 deletions

View File

@@ -371,11 +371,6 @@ cc_test(
size = "small",
srcs = ["internal/sysinfo_test.cc"],
copts = ABSL_TEST_COPTS,
tags = [
"no_test_android_arm",
"no_test_android_arm64",
"no_test_android_x86",
],
deps = [
":base",
"//absl/synchronization",

View File

@@ -22,6 +22,7 @@
#include "absl/base/macros.h"
namespace absl {
inline namespace lts_2018_06_20 {
namespace {
template <int N>
@@ -104,4 +105,5 @@ TEST(BitCast, Double) {
}
} // namespace
} // inline namespace lts_2018_06_20
} // namespace absl

View File

@@ -39,6 +39,7 @@
#include "absl/base/port.h"
namespace absl {
inline namespace lts_2018_06_20 {
class once_flag;
@@ -211,6 +212,7 @@ void call_once(absl::once_flag& flag, Callable&& fn, Args&&... args) {
}
}
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_BASE_CALL_ONCE_H_

View File

@@ -22,6 +22,7 @@
#include "absl/synchronization/mutex.h"
namespace absl {
inline namespace lts_2018_06_20 {
namespace {
absl::once_flag once;
@@ -99,4 +100,5 @@ TEST(CallOnceTest, ExecutionCount) {
}
} // namespace
} // inline namespace lts_2018_06_20
} // namespace absl

View File

@@ -30,6 +30,7 @@
#include "absl/base/internal/identity.h"
namespace absl {
inline namespace lts_2018_06_20 {
// implicit_cast()
//
@@ -135,6 +136,7 @@ inline Dest bit_cast(const Source& source) {
return dest;
}
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_BASE_CASTS_H_

View File

@@ -20,6 +20,7 @@
#include "gtest/gtest.h"
namespace absl {
inline namespace lts_2018_06_20 {
namespace inline_variable_testing_internal {
namespace {
@@ -59,4 +60,5 @@ TEST(InlineVariableTest, FunPtrType) {
} // namespace
} // namespace inline_variable_testing_internal
} // inline namespace lts_2018_06_20
} // namespace absl

View File

@@ -15,6 +15,7 @@
#include "absl/base/internal/inline_variable_testing.h"
namespace absl {
inline namespace lts_2018_06_20 {
namespace inline_variable_testing_internal {
const Foo& get_foo_a() { return inline_variable_foo; }
@@ -22,4 +23,5 @@ const Foo& get_foo_a() { return inline_variable_foo; }
const int& get_int_a() { return inline_variable_int; }
} // namespace inline_variable_testing_internal
} // inline namespace lts_2018_06_20
} // namespace absl

View File

@@ -15,6 +15,7 @@
#include "absl/base/internal/inline_variable_testing.h"
namespace absl {
inline namespace lts_2018_06_20 {
namespace inline_variable_testing_internal {
const Foo& get_foo_b() { return inline_variable_foo; }
@@ -22,4 +23,5 @@ const Foo& get_foo_b() { return inline_variable_foo; }
const int& get_int_b() { return inline_variable_int; }
} // namespace inline_variable_testing_internal
} // inline namespace lts_2018_06_20
} // namespace absl

View File

@@ -28,6 +28,7 @@
#endif
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
template <typename T>
@@ -160,6 +161,7 @@ class AtomicHook<ReturnType (*)(Args...)> {
#undef ABSL_HAVE_WORKING_ATOMIC_POINTER
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_BASE_INTERNAL_ATOMIC_HOOK_H_

View File

@@ -27,6 +27,7 @@
#include "absl/base/internal/unscaledcycleclock.h"
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
#if ABSL_USE_UNSCALED_CYCLECLOCK
@@ -78,4 +79,5 @@ double CycleClock::Frequency() {
#endif
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl

View File

@@ -46,6 +46,7 @@
#include <cstdint>
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
// -----------------------------------------------------------------------------
@@ -72,6 +73,7 @@ class CycleClock {
};
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_BASE_INTERNAL_CYCLECLOCK_H_

View File

@@ -62,6 +62,7 @@ extern "C" void* __mmap2(void*, size_t, int, int, int, size_t);
#endif // __BIONIC__
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
// Platform specific logic extracted from
@@ -122,6 +123,7 @@ inline int DirectMunmap(void* start, size_t length) {
}
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl
#else // !__linux__
@@ -130,6 +132,7 @@ inline int DirectMunmap(void* start, size_t length) {
// actual mmap()/munmap() methods.
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
inline void* DirectMmap(void* start, size_t length, int prot, int flags, int fd,
@@ -142,6 +145,7 @@ inline int DirectMunmap(void* start, size_t length) {
}
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // __linux__

View File

@@ -34,6 +34,7 @@
#include "absl/base/port.h"
namespace absl {
inline namespace lts_2018_06_20 {
// Use compiler byte-swapping intrinsics if they are available. 32-bit
// and 64-bit versions are available in Clang and GCC as of GCC 4.3.0.
@@ -264,6 +265,7 @@ inline void Store64(void *p, uint64_t v) {
} // namespace big_endian
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_BASE_INTERNAL_ENDIAN_H_

View File

@@ -24,6 +24,7 @@
#include "absl/base/config.h"
namespace absl {
inline namespace lts_2018_06_20 {
namespace {
const uint64_t kInitialNumber{0x0123456789abcdef};
@@ -276,4 +277,5 @@ TEST(EndianessTest, big_endian) {
}
} // namespace
} // inline namespace lts_2018_06_20
} // namespace absl

View File

@@ -18,6 +18,7 @@
#include <cstdint>
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
// Arbitrary value with high bits set. Xor'ing with it is unlikely
@@ -42,6 +43,7 @@ inline T* UnhidePtr(uintptr_t hidden) {
}
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_BASE_INTERNAL_HIDE_PTR_H_

View File

@@ -17,6 +17,7 @@
#define ABSL_BASE_INTERNAL_IDENTITY_H_
namespace absl {
inline namespace lts_2018_06_20 {
namespace internal {
template <typename T>
@@ -27,7 +28,8 @@ struct identity {
template <typename T>
using identity_t = typename identity<T>::type;
} // namespace internal
} // namespace absl
} // namespace internal
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_BASE_INTERNAL_IDENTITY_H_

View File

@@ -18,6 +18,7 @@
#include "absl/base/internal/inline_variable.h"
namespace absl {
inline namespace lts_2018_06_20 {
namespace inline_variable_testing_internal {
struct Foo {
@@ -39,6 +40,7 @@ const int& get_int_a();
const int& get_int_b();
} // namespace inline_variable_testing_internal
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_BASE_INLINE_VARIABLE_TESTING_H_

View File

@@ -43,6 +43,7 @@
// top of this file for the API documentation.
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
// The five classes below each implement one of the clauses from the definition
@@ -183,6 +184,7 @@ InvokeT<F, Args...> Invoke(F&& f, Args&&... args) {
std::forward<Args>(args)...);
}
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_BASE_INTERNAL_INVOKE_H_

View File

@@ -63,6 +63,7 @@
#endif // __APPLE__
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
// A first-fit allocator with amortized logarithmic free() time.
@@ -599,6 +600,7 @@ void *LowLevelAlloc::AllocWithArena(size_t request, Arena *arena) {
}
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_LOW_LEVEL_ALLOC_MISSING

View File

@@ -51,6 +51,7 @@
#include "absl/base/port.h"
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
class LowLevelAlloc {
@@ -115,5 +116,6 @@ class LowLevelAlloc {
};
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_BASE_INTERNAL_LOW_LEVEL_ALLOC_H_

View File

@@ -22,6 +22,7 @@
#include <utility>
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
namespace {
@@ -148,6 +149,7 @@ static struct BeforeMain {
} // namespace
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl
int main(int argc, char *argv[]) {

View File

@@ -28,6 +28,7 @@ extern "C" bool __google_disable_rescheduling(void);
extern "C" void __google_enable_rescheduling(bool disable_result);
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
class SchedulingHelper; // To allow use of SchedulingGuard.
@@ -100,5 +101,6 @@ inline void SchedulingGuard::EnableRescheduling(bool /* disable_result */) {
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_BASE_INTERNAL_LOW_LEVEL_SCHEDULING_H_

View File

@@ -181,6 +181,7 @@ void RawLogVA(absl::LogSeverity severity, const char* file, int line,
} // namespace
namespace absl {
inline namespace lts_2018_06_20 {
namespace raw_logging_internal {
void SafeWriteToStderr(const char *s, size_t len) {
#if defined(ABSL_HAVE_SYSCALL_WRITE)
@@ -215,4 +216,5 @@ bool RawLoggingFullySupported() {
}
} // namespace raw_logging_internal
} // inline namespace lts_2018_06_20
} // namespace absl

View File

@@ -65,6 +65,7 @@
::absl::NormalizeLogSeverity(severity)
namespace absl {
inline namespace lts_2018_06_20 {
namespace raw_logging_internal {
// Helper function to implement ABSL_RAW_LOG
@@ -132,6 +133,7 @@ using AbortHook = void (*)(const char* file, int line, const char* buf_start,
const char* prefix_end, const char* buf_end);
} // namespace raw_logging_internal
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_BASE_INTERNAL_RAW_LOGGING_H_

View File

@@ -19,6 +19,7 @@
#define ABSL_BASE_INTERNAL_SCHEDULING_MODE_H_
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
// Used to describe how a thread may be scheduled. Typically associated with
@@ -49,6 +50,7 @@ enum SchedulingMode {
};
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_BASE_INTERNAL_SCHEDULING_MODE_H_

View File

@@ -54,6 +54,7 @@
// holder to acquire the lock. There may be outstanding waiter(s).
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
ABSL_CONST_INIT static base_internal::AtomicHook<void (*)(const void *lock,
@@ -225,4 +226,5 @@ uint64_t SpinLock::DecodeWaitCycles(uint32_t lock_value) {
}
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl

View File

@@ -45,6 +45,7 @@
#include "absl/base/thread_annotations.h"
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
class LOCKABLE SpinLock {
@@ -234,6 +235,7 @@ inline uint32_t SpinLock::TryLockInternal(uint32_t lock_value,
}
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_BASE_INTERNAL_SPINLOCK_H_

View File

@@ -30,6 +30,7 @@
#endif
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
// See spinlock_wait.h for spec.
@@ -76,4 +77,5 @@ int SpinLockSuggestedDelayNS(int loop) {
}
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl

View File

@@ -24,6 +24,7 @@
#include "absl/base/internal/scheduling_mode.h"
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
// SpinLockWait() waits until it can perform one of several transitions from
@@ -62,6 +63,7 @@ void SpinLockDelay(std::atomic<uint32_t> *w, uint32_t value, int loop,
int SpinLockSuggestedDelayNS(int loop);
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl
// In some build configurations we pass --detect-odr-violations to the
@@ -84,7 +86,7 @@ inline void absl::base_internal::SpinLockWake(std::atomic<uint32_t> *w,
inline void absl::base_internal::SpinLockDelay(
std::atomic<uint32_t> *w, uint32_t value, int loop,
base_internal::SchedulingMode scheduling_mode) {
absl::base_internal::SchedulingMode scheduling_mode) {
AbslInternalSpinLockDelay(w, value, loop, scheduling_mode);
}

View File

@@ -56,6 +56,7 @@
#include "absl/base/internal/unscaledcycleclock.h"
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
static once_flag init_system_info_once;
@@ -401,4 +402,5 @@ pid_t GetTID() {
#endif
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl

View File

@@ -33,6 +33,7 @@
#include "absl/base/port.h"
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
// Nominal core processor cycles per second of each processor. This is _not_
@@ -58,6 +59,7 @@ using pid_t = DWORD;
pid_t GetTID();
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_BASE_INTERNAL_SYSINFO_H_

View File

@@ -28,6 +28,7 @@
#include "absl/synchronization/mutex.h"
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
namespace {
@@ -95,4 +96,5 @@ TEST(SysinfoTest, LinuxGetTID) {
} // namespace
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl

View File

@@ -28,6 +28,7 @@
#include "absl/base/internal/spinlock.h"
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
#if ABSL_THREAD_IDENTITY_MODE != ABSL_THREAD_IDENTITY_MODE_USE_CPP11
@@ -120,4 +121,5 @@ ThreadIdentity* CurrentThreadIdentityIfPresent() {
#endif
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl

View File

@@ -33,6 +33,7 @@
#include "absl/base/internal/per_thread_tls.h"
namespace absl {
inline namespace lts_2018_06_20 {
struct SynchLocksHeld;
struct SynchWaitParams;
@@ -236,5 +237,6 @@ inline ThreadIdentity* CurrentThreadIdentityIfPresent() {
#endif
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_BASE_INTERNAL_THREAD_IDENTITY_H_

View File

@@ -25,6 +25,7 @@
#include "absl/synchronization/mutex.h"
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
namespace {
@@ -123,4 +124,5 @@ TEST(ThreadIdentityTest, ReusedThreadIdentityMutexTest) {
} // namespace
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl

View File

@@ -22,6 +22,7 @@
#include "absl/base/internal/raw_logging.h"
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
namespace {
@@ -103,4 +104,5 @@ void ThrowStdBadFunctionCall() { Throw(std::bad_function_call()); }
void ThrowStdBadAlloc() { Throw(std::bad_alloc()); }
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl

View File

@@ -20,6 +20,7 @@
#include <string>
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
// Helper functions that allow throwing exceptions consistently from anywhere.
@@ -66,6 +67,7 @@ namespace base_internal {
// [[noreturn]] void ThrowStdBadArrayNewLength();
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_BASE_INTERNAL_THROW_DELEGATE_H_

View File

@@ -65,6 +65,7 @@ void __sanitizer_unaligned_store64(void *p, uint64_t v);
} // extern "C"
namespace absl {
inline namespace lts_2018_06_20 {
inline uint16_t UnalignedLoad16(const void *p) {
return __sanitizer_unaligned_load16(p);
@@ -90,6 +91,7 @@ inline void UnalignedStore64(void *p, uint64_t v) {
__sanitizer_unaligned_store64(p, v);
}
} // inline namespace lts_2018_06_20
} // namespace absl
#define ABSL_INTERNAL_UNALIGNED_LOAD16(_p) (absl::UnalignedLoad16(_p))
@@ -158,6 +160,7 @@ inline void UnalignedStore64(void *p, uint64_t v) {
// so we do that.
namespace absl {
inline namespace lts_2018_06_20 {
namespace internal {
struct Unaligned16Struct {
@@ -171,6 +174,7 @@ struct Unaligned32Struct {
} ABSL_ATTRIBUTE_PACKED;
} // namespace internal
} // inline namespace lts_2018_06_20
} // namespace absl
#define ABSL_INTERNAL_UNALIGNED_LOAD16(_p) \
@@ -186,6 +190,7 @@ struct Unaligned32Struct {
(_val))
namespace absl {
inline namespace lts_2018_06_20 {
inline uint64_t UnalignedLoad64(const void *p) {
uint64_t t;
@@ -195,6 +200,7 @@ inline uint64_t UnalignedLoad64(const void *p) {
inline void UnalignedStore64(void *p, uint64_t v) { memcpy(p, &v, sizeof v); }
} // inline namespace lts_2018_06_20
} // namespace absl
#define ABSL_INTERNAL_UNALIGNED_LOAD64(_p) (absl::UnalignedLoad64(_p))
@@ -211,6 +217,7 @@ inline void UnalignedStore64(void *p, uint64_t v) { memcpy(p, &v, sizeof v); }
// unaligned loads and stores.
namespace absl {
inline namespace lts_2018_06_20 {
inline uint16_t UnalignedLoad16(const void *p) {
uint16_t t;
@@ -236,6 +243,7 @@ inline void UnalignedStore32(void *p, uint32_t v) { memcpy(p, &v, sizeof v); }
inline void UnalignedStore64(void *p, uint64_t v) { memcpy(p, &v, sizeof v); }
} // inline namespace lts_2018_06_20
} // namespace absl
#define ABSL_INTERNAL_UNALIGNED_LOAD16(_p) (absl::UnalignedLoad16(_p))

View File

@@ -27,6 +27,7 @@
#include "absl/base/internal/sysinfo.h"
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
#if defined(__i386__)
@@ -96,6 +97,7 @@ double UnscaledCycleClock::Frequency() {
#endif
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_USE_UNSCALED_CYCLECLOCK

View File

@@ -84,6 +84,7 @@
#define ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY
#endif
namespace absl {
inline namespace lts_2018_06_20 {
namespace time_internal {
class UnscaledCycleClockWrapperForGetCurrentTime;
} // namespace time_internal
@@ -113,6 +114,7 @@ class UnscaledCycleClock {
};
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_USE_UNSCALED_CYCLECLOCK

View File

@@ -25,6 +25,7 @@
#include "absl/strings/str_cat.h"
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
namespace {
@@ -197,4 +198,5 @@ TEST(InvokeTest, SfinaeFriendly) {
} // namespace
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl

View File

@@ -21,6 +21,7 @@
#include "absl/base/attributes.h"
namespace absl {
inline namespace lts_2018_06_20 {
// Four severity levels are defined. Logging APIs should terminate the program
// when a message is logged at severity `kFatal`; the other levels have no
@@ -62,6 +63,7 @@ constexpr absl::LogSeverity NormalizeLogSeverity(int s) {
return NormalizeLogSeverity(static_cast<absl::LogSeverity>(s));
}
} // inline namespace lts_2018_06_20
} // namespace absl
#endif // ABSL_BASE_INTERNAL_LOG_SEVERITY_H_

View File

@@ -43,12 +43,14 @@
(sizeof(::absl::macros_internal::ArraySizeHelper(array)))
namespace absl {
inline namespace lts_2018_06_20 {
namespace macros_internal {
// Note: this internal template function declaration is used by ABSL_ARRAYSIZE.
// The function doesn't need a definition, as we only use its type.
template <typename T, size_t N>
auto ArraySizeHelper(const T (&array)[N]) -> char (&)[N];
} // namespace macros_internal
} // inline namespace lts_2018_06_20
} // namespace absl
// kLinkerInitialized
@@ -72,11 +74,13 @@ auto ArraySizeHelper(const T (&array)[N]) -> char (&)[N];
// // Invocation
// static MyClass my_global(absl::base_internal::kLinkerInitialized);
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
enum LinkerInitialized {
kLinkerInitialized = 0,
};
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl
// ABSL_FALLTHROUGH_INTENDED
@@ -194,8 +198,9 @@ enum LinkerInitialized {
#if defined(NDEBUG)
#define ABSL_ASSERT(expr) (false ? (void)(expr) : (void)0)
#else
#define ABSL_ASSERT(expr) \
(ABSL_PREDICT_TRUE((expr)) ? (void)0 : [] { assert(false && #expr); }())
#define ABSL_ASSERT(expr) \
(ABSL_PREDICT_TRUE((expr)) ? (void)0 \
: [] { assert(false && #expr); }()) // NOLINT
#endif
#endif // ABSL_BASE_MACROS_H_

View File

@@ -36,6 +36,7 @@ constexpr int32_t kNumThreads = 10;
constexpr int32_t kIters = 1000;
namespace absl {
inline namespace lts_2018_06_20 {
namespace base_internal {
// This is defined outside of anonymous namespace so that it can be
@@ -263,4 +264,5 @@ TEST(SpinLockWithThreads, DoesNotDeadlock) {
} // namespace
} // namespace base_internal
} // inline namespace lts_2018_06_20
} // namespace absl