Export of internal Abseil changes
-- b842b7fd9b1289be31f0b7ee8e62e48e550747cf by Greg Falcon <gfalcon@google.com>: Change the Cord str_format formatter to use iteration instead of CordReader. When Cord is publicly released, CordReader is not going with it. PiperOrigin-RevId: 284780736 -- 28e76c08ea7185a7ff9f4e0e02ae565fbbf7980f by Greg Falcon <gfalcon@google.com>: Implementation detail change. Introduce ABSL_NAMESPACE_BEGIN and _END annotation macros which indicate the beginning and end of a `namespace absl` scope. Currently these do nothing, but they will be used to inject an inline namespace for LTS builds (to avoid symbol collisions against other Abseil versions). These macros should not be used by end users, because end users should never write `namespace absl {` in their own code. This CL applies these annotations to all code under //absl/base/. The rest of Abseil will be annotated in this way in follow-up CLs. PiperOrigin-RevId: 284776410 -- e1711dc6d696dcca50d4e7d4b4d8f3076575b7ec by Abseil Team <absl-team@google.com>: --help changed to report long flags. PiperOrigin-RevId: 284757720 -- 78f66a68f428bbbd19d8d60e1125f43ba765fd35 by Tom Manshreck <shreck@google.com>: Update comment on + or - in SimpleAToi() PiperOrigin-RevId: 284231843 GitOrigin-RevId: b842b7fd9b1289be31f0b7ee8e62e48e550747cf Change-Id: I3046b31391bd11c8bc4abab7785a863c377cd757
This commit is contained in:
parent
77f87009a3
commit
1e39f8626a
65 changed files with 253 additions and 55 deletions
|
@ -34,6 +34,7 @@ cc_library(
|
|||
visibility = [
|
||||
"//absl:__subpackages__",
|
||||
],
|
||||
deps = [":config"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
|
@ -42,7 +43,10 @@ cc_library(
|
|||
hdrs = ["log_severity.h"],
|
||||
copts = ABSL_DEFAULT_COPTS,
|
||||
linkopts = ABSL_DEFAULT_LINKOPTS,
|
||||
deps = [":core_headers"],
|
||||
deps = [
|
||||
":config",
|
||||
":core_headers",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
|
@ -165,6 +169,7 @@ cc_library(
|
|||
"//absl:__subpackages__",
|
||||
],
|
||||
deps = [
|
||||
":config",
|
||||
"//absl/meta:type_traits",
|
||||
],
|
||||
)
|
||||
|
@ -545,7 +550,10 @@ cc_library(
|
|||
visibility = [
|
||||
"//absl:__subpackages__",
|
||||
],
|
||||
deps = [":core_headers"],
|
||||
deps = [
|
||||
":config",
|
||||
":core_headers",
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
|
@ -568,7 +576,10 @@ cc_library(
|
|||
visibility = [
|
||||
"//absl:__subpackages__",
|
||||
],
|
||||
deps = [":core_headers"],
|
||||
deps = [
|
||||
":config",
|
||||
":core_headers",
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
|
@ -635,7 +646,10 @@ cc_library(
|
|||
visibility = [
|
||||
"//absl:__subpackages__",
|
||||
],
|
||||
deps = [":raw_logging_internal"],
|
||||
deps = [
|
||||
":config",
|
||||
":raw_logging_internal",
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
|
|
|
@ -21,6 +21,8 @@ absl_cc_library(
|
|||
atomic_hook
|
||||
HDRS
|
||||
"internal/atomic_hook.h"
|
||||
DEPS
|
||||
absl::config
|
||||
COPTS
|
||||
${ABSL_DEFAULT_COPTS}
|
||||
)
|
||||
|
@ -148,6 +150,7 @@ absl_cc_library(
|
|||
COPTS
|
||||
${ABSL_DEFAULT_COPTS}
|
||||
DEPS
|
||||
absl::config
|
||||
absl::type_traits
|
||||
)
|
||||
|
||||
|
@ -493,6 +496,7 @@ absl_cc_library(
|
|||
COPTS
|
||||
${ABSL_DEFAULT_COPTS}
|
||||
DEPS
|
||||
absl::config
|
||||
absl::core_headers
|
||||
)
|
||||
|
||||
|
@ -518,6 +522,7 @@ absl_cc_library(
|
|||
COPTS
|
||||
${ABSL_DEFAULT_COPTS}
|
||||
DEPS
|
||||
absl::config
|
||||
absl::core_headers
|
||||
)
|
||||
|
||||
|
@ -571,6 +576,7 @@ absl_cc_library(
|
|||
COPTS
|
||||
${ABSL_DEFAULT_COPTS}
|
||||
DEPS
|
||||
absl::config
|
||||
absl::raw_logging_internal
|
||||
)
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "absl/base/macros.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace {
|
||||
|
||||
template <int N>
|
||||
|
@ -104,4 +105,5 @@ TEST(BitCast, Double) {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "absl/base/port.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
|
||||
class once_flag;
|
||||
|
||||
|
@ -219,6 +220,7 @@ void call_once(absl::once_flag& flag, Callable&& fn, Args&&... args) {
|
|||
}
|
||||
}
|
||||
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_CALL_ONCE_H_
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "absl/synchronization/mutex.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace {
|
||||
|
||||
absl::once_flag once;
|
||||
|
@ -102,4 +103,5 @@ TEST(CallOnceTest, ExecutionCount) {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "absl/meta/type_traits.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
|
||||
namespace internal_casts {
|
||||
|
||||
|
@ -177,6 +178,7 @@ inline Dest bit_cast(const Source& source) {
|
|||
return dest;
|
||||
}
|
||||
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_CASTS_H_
|
||||
|
|
|
@ -66,6 +66,33 @@
|
|||
#include "absl/base/options.h"
|
||||
#include "absl/base/policy_checks.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Abseil namespace annotations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// ABSL_NAMESPACE_BEGIN/ABSL_NAMESPACE_END
|
||||
//
|
||||
// An annotation placed at the beginning/end of each `namespace absl` scope.
|
||||
// This is used to inject an inline namespace.
|
||||
//
|
||||
// The proper way to write Abseil code in the `absl` namespace is:
|
||||
//
|
||||
// namespace absl {
|
||||
// ABSL_NAMESPACE_BEGIN
|
||||
//
|
||||
// void Foo(); // absl::Foo().
|
||||
//
|
||||
// ABSL_NAMESPACE_END
|
||||
// } // namespace absl
|
||||
//
|
||||
// Users of Abseil should not use these macros, because users of Abseil should
|
||||
// not write `namespace absl {` in their own code for any reason. (Abseil does
|
||||
// not support forward declarations of its own types, nor does it support
|
||||
// user-provided specialization of Abseil templates. Code that violates these
|
||||
// rules may be broken without warning.)
|
||||
#define ABSL_NAMESPACE_BEGIN
|
||||
#define ABSL_NAMESPACE_END
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Compiler Feature Checks
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#ifndef ABSL_BASE_CONST_INIT_H_
|
||||
#define ABSL_BASE_CONST_INIT_H_
|
||||
|
||||
#include "absl/base/config.h"
|
||||
|
||||
// In general, objects with static storage duration (such as global variables)
|
||||
// can trigger tricky object lifetime situations. Attempting to access them
|
||||
// from the constructors or destructors of other global objects can result in
|
||||
|
@ -62,11 +64,13 @@
|
|||
// or thread_local storage duration.
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
|
||||
enum ConstInitType {
|
||||
kConstInit,
|
||||
};
|
||||
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_CONST_INIT_H_
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "gtest/gtest.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace inline_variable_testing_internal {
|
||||
namespace {
|
||||
|
||||
|
@ -59,4 +60,5 @@ TEST(InlineVariableTest, FunPtrType) {
|
|||
|
||||
} // namespace
|
||||
} // namespace inline_variable_testing_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "absl/base/internal/inline_variable_testing.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
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
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "absl/base/internal/inline_variable_testing.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
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
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/base/config.h"
|
||||
|
||||
#ifdef _MSC_FULL_VER
|
||||
#define ABSL_HAVE_WORKING_ATOMIC_POINTER 0
|
||||
#define ABSL_HAVE_WORKING_CONSTEXPR_STATIC_INIT 0
|
||||
|
@ -29,6 +31,7 @@
|
|||
#endif
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
template <typename T>
|
||||
|
@ -170,6 +173,7 @@ class AtomicHook<ReturnType (*)(Args...)> {
|
|||
#undef ABSL_HAVE_WORKING_CONSTEXPR_STATIC_INIT
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_INTERNAL_ATOMIC_HOOK_H_
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "absl/base/internal/atomic_hook.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace atomic_hook_internal {
|
||||
|
||||
ABSL_CONST_INIT absl::base_internal::AtomicHook<VoidF> func(DefaultFunc);
|
||||
|
@ -26,4 +27,5 @@ void DefaultFunc() { default_func_calls++; }
|
|||
void RegisterFunc(VoidF f) { func.Store(f); }
|
||||
|
||||
} // namespace atomic_hook_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "absl/base/internal/atomic_hook.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace atomic_hook_internal {
|
||||
|
||||
using VoidF = void (*)();
|
||||
|
@ -27,6 +28,7 @@ void DefaultFunc();
|
|||
void RegisterFunc(VoidF func);
|
||||
|
||||
} // namespace atomic_hook_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_ATOMIC_HOOK_TEST_HELPER_H_
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include <cstdint>
|
||||
|
||||
#include "absl/base/config.h"
|
||||
|
||||
// Clang on Windows has __builtin_clzll; otherwise we need to use the
|
||||
// windows intrinsic functions.
|
||||
#if defined(_MSC_VER)
|
||||
|
@ -46,6 +48,7 @@
|
|||
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
ABSL_BASE_INTERNAL_FORCEINLINE int CountLeadingZeros64Slow(uint64_t n) {
|
||||
|
@ -209,6 +212,7 @@ ABSL_BASE_INTERNAL_FORCEINLINE int CountTrailingZerosNonZero32(uint32_t n) {
|
|||
#undef ABSL_BASE_INTERNAL_FORCEINLINE
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_INTERNAL_BITS_H_
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "absl/base/internal/unscaledcycleclock.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
#if ABSL_USE_UNSCALED_CYCLECLOCK
|
||||
|
@ -102,4 +103,5 @@ double CycleClock::Frequency() {
|
|||
#endif
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -44,7 +44,10 @@
|
|||
|
||||
#include <cstdint>
|
||||
|
||||
#include "absl/base/config.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -85,6 +88,7 @@ class CycleClockSource {
|
|||
};
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_INTERNAL_CYCLECLOCK_H_
|
||||
|
|
|
@ -62,6 +62,7 @@ extern "C" void* __mmap2(void*, size_t, int, int, int, size_t);
|
|||
#endif // __BIONIC__
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
// Platform specific logic extracted from
|
||||
|
@ -128,6 +129,7 @@ inline int DirectMunmap(void* start, size_t length) {
|
|||
}
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#else // !__linux__
|
||||
|
@ -136,6 +138,7 @@ inline int DirectMunmap(void* start, size_t length) {
|
|||
// actual mmap()/munmap() methods.
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
inline void* DirectMmap(void* start, size_t length, int prot, int flags, int fd,
|
||||
|
@ -148,6 +151,7 @@ inline int DirectMunmap(void* start, size_t length) {
|
|||
}
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // __linux__
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "absl/base/port.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
|
||||
// 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.
|
||||
|
@ -259,6 +260,7 @@ inline void Store64(void *p, uint64_t v) {
|
|||
|
||||
} // namespace big_endian
|
||||
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_INTERNAL_ENDIAN_H_
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "absl/base/config.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace {
|
||||
|
||||
const uint64_t kInitialNumber{0x0123456789abcdef};
|
||||
|
@ -260,4 +261,5 @@ TEST(EndianessTest, big_endian) {
|
|||
}
|
||||
|
||||
} // namespace
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "absl/base/optimization.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
// The algorithm generates a random number between 0 and 1 and applies the
|
||||
|
@ -88,4 +89,5 @@ void ExponentialBiased::Initialize() {
|
|||
}
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -17,9 +17,11 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "absl/base/config.h"
|
||||
#include "absl/base/macros.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
// ExponentialBiased provides a small and fast random number generator for a
|
||||
|
@ -122,6 +124,7 @@ inline uint64_t ExponentialBiased::NextRandom(uint64_t rnd) {
|
|||
}
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_INTERNAL_EXPONENTIAL_BIASED_H_
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
using ::testing::Ge;
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
MATCHER_P2(IsBetween, a, b,
|
||||
|
@ -194,4 +195,5 @@ TEST(ExponentialBiasedTest, InitializationModes) {
|
|||
}
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -17,7 +17,10 @@
|
|||
|
||||
#include <cstdint>
|
||||
|
||||
#include "absl/base/config.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
// Arbitrary value with high bits set. Xor'ing with it is unlikely
|
||||
|
@ -42,6 +45,7 @@ inline T* UnhidePtr(uintptr_t hidden) {
|
|||
}
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_INTERNAL_HIDE_PTR_H_
|
||||
|
|
|
@ -16,7 +16,10 @@
|
|||
#ifndef ABSL_BASE_INTERNAL_IDENTITY_H_
|
||||
#define ABSL_BASE_INTERNAL_IDENTITY_H_
|
||||
|
||||
#include "absl/base/config.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace internal {
|
||||
|
||||
template <typename T>
|
||||
|
@ -28,6 +31,7 @@ template <typename T>
|
|||
using identity_t = typename identity<T>::type;
|
||||
|
||||
} // namespace internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_INTERNAL_IDENTITY_H_
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "absl/base/internal/inline_variable.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
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
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_INLINE_VARIABLE_TESTING_H_
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
// top of this file for the API documentation.
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
// The five classes below each implement one of the clauses from the definition
|
||||
|
@ -180,6 +181,7 @@ InvokeT<F, Args...> Invoke(F&& f, Args&&... args) {
|
|||
std::forward<Args>(args)...);
|
||||
}
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_INTERNAL_INVOKE_H_
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#endif // __APPLE__
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
// A first-fit allocator with amortized logarithmic free() time.
|
||||
|
@ -612,6 +613,7 @@ void *LowLevelAlloc::AllocWithArena(size_t request, Arena *arena) {
|
|||
}
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_LOW_LEVEL_ALLOC_MISSING
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include "absl/base/port.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
class LowLevelAlloc {
|
||||
|
@ -119,6 +120,7 @@ class LowLevelAlloc {
|
|||
};
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_INTERNAL_LOW_LEVEL_ALLOC_H_
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <utility>
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
namespace {
|
||||
|
||||
|
@ -149,6 +150,7 @@ static struct BeforeMain {
|
|||
|
||||
} // namespace
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
|
|
@ -28,6 +28,7 @@ extern "C" bool __google_disable_rescheduling(void);
|
|||
extern "C" void __google_enable_rescheduling(bool disable_result);
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
class SchedulingHelper; // To allow use of SchedulingGuard.
|
||||
|
@ -100,6 +101,7 @@ inline void SchedulingGuard::EnableRescheduling(bool /* disable_result */) {
|
|||
}
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_INTERNAL_LOW_LEVEL_SCHEDULING_H_
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "absl/base/internal/exponential_biased.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
int64_t PeriodicSamplerBase::GetExponentialBiased(int period) noexcept {
|
||||
|
@ -48,4 +49,5 @@ bool PeriodicSamplerBase::SubtleConfirmSample() noexcept {
|
|||
}
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "absl/base/optimization.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
// PeriodicSamplerBase provides the basic period sampler implementation.
|
||||
|
@ -204,6 +205,7 @@ template <typename Tag, int default_period>
|
|||
std::atomic<int> PeriodicSampler<Tag, default_period>::period_(default_period);
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_INTERNAL_PERIODIC_SAMPLER_H_
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "absl/base/internal/periodic_sampler.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
namespace {
|
||||
|
||||
|
@ -74,4 +75,5 @@ BENCHMARK(BM_PeriodicSampler_Disabled);
|
|||
|
||||
} // namespace
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "absl/base/macros.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
namespace {
|
||||
|
||||
|
@ -172,4 +173,5 @@ TEST(PeriodicSamplerTest, SetGlobalPeriod) {
|
|||
|
||||
} // namespace
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -182,6 +182,7 @@ void RawLogVA(absl::LogSeverity severity, const char* file, int line,
|
|||
} // namespace
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace raw_logging_internal {
|
||||
void SafeWriteToStderr(const char *s, size_t len) {
|
||||
#if defined(ABSL_HAVE_SYSCALL_WRITE)
|
||||
|
@ -232,4 +233,5 @@ void RegisterInternalLogFunction(InternalLogFunction func) {
|
|||
}
|
||||
|
||||
} // namespace raw_logging_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -93,6 +93,7 @@
|
|||
::absl::NormalizeLogSeverity(severity)
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace raw_logging_internal {
|
||||
|
||||
// Helper function to implement ABSL_RAW_LOG
|
||||
|
@ -172,6 +173,7 @@ extern base_internal::AtomicHook<InternalLogFunction> internal_log_function;
|
|||
void RegisterInternalLogFunction(InternalLogFunction func);
|
||||
|
||||
} // namespace raw_logging_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_INTERNAL_RAW_LOGGING_H_
|
||||
|
|
|
@ -18,7 +18,10 @@
|
|||
#ifndef ABSL_BASE_INTERNAL_SCHEDULING_MODE_H_
|
||||
#define ABSL_BASE_INTERNAL_SCHEDULING_MODE_H_
|
||||
|
||||
#include "absl/base/config.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
// Used to describe how a thread may be scheduled. Typically associated with
|
||||
|
@ -49,6 +52,7 @@ enum SchedulingMode {
|
|||
};
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_INTERNAL_SCHEDULING_MODE_H_
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "absl/base/internal/raw_logging.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
namespace {
|
||||
|
@ -76,4 +77,5 @@ ScopedSetEnv::~ScopedSetEnv() {
|
|||
}
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -19,7 +19,10 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "absl/base/config.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
class ScopedSetEnv {
|
||||
|
@ -36,6 +39,7 @@ class ScopedSetEnv {
|
|||
};
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_INTERNAL_SCOPED_SET_ENV_H_
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
// holder to acquire the lock. There may be outstanding waiter(s).
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
ABSL_CONST_INIT static base_internal::AtomicHook<void (*)(const void *lock,
|
||||
|
@ -228,4 +229,5 @@ uint64_t SpinLock::DecodeWaitCycles(uint32_t lock_value) {
|
|||
}
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "absl/base/thread_annotations.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
class ABSL_LOCKABLE SpinLock {
|
||||
|
@ -236,6 +237,7 @@ inline uint32_t SpinLock::TryLockInternal(uint32_t lock_value,
|
|||
}
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_INTERNAL_SPINLOCK_H_
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#endif
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
// See spinlock_wait.h for spec.
|
||||
|
@ -76,4 +77,5 @@ int SpinLockSuggestedDelayNS(int loop) {
|
|||
}
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "absl/base/internal/scheduling_mode.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
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
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
// In some build configurations we pass --detect-odr-violations to the
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include "absl/base/internal/unscaledcycleclock.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
static once_flag init_system_info_once;
|
||||
|
@ -409,4 +410,5 @@ pid_t GetTID() {
|
|||
#endif
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "absl/base/port.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
// Nominal core processor cycles per second of each processor. This is _not_
|
||||
|
@ -59,6 +60,7 @@ using pid_t = uint32_t;
|
|||
pid_t GetTID();
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_INTERNAL_SYSINFO_H_
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "absl/synchronization/mutex.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
namespace {
|
||||
|
||||
|
@ -95,4 +96,5 @@ TEST(SysinfoTest, LinuxGetTID) {
|
|||
|
||||
} // namespace
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "absl/base/internal/spinlock.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
#if ABSL_THREAD_IDENTITY_MODE != ABSL_THREAD_IDENTITY_MODE_USE_CPP11
|
||||
|
@ -135,4 +136,5 @@ ThreadIdentity* CurrentThreadIdentityIfPresent() {
|
|||
#endif
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "absl/base/internal/per_thread_tls.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
|
||||
struct SynchLocksHeld;
|
||||
struct SynchWaitParams;
|
||||
|
@ -243,6 +244,7 @@ inline ThreadIdentity* CurrentThreadIdentityIfPresent() {
|
|||
#endif
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_INTERNAL_THREAD_IDENTITY_H_
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "absl/synchronization/mutex.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
namespace {
|
||||
|
||||
|
@ -123,4 +124,5 @@ TEST(ThreadIdentityTest, ReusedThreadIdentityMutexTest) {
|
|||
|
||||
} // namespace
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "absl/base/internal/raw_logging.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
namespace {
|
||||
|
@ -103,4 +104,5 @@ void ThrowStdBadFunctionCall() { Throw(std::bad_function_call()); }
|
|||
void ThrowStdBadAlloc() { Throw(std::bad_alloc()); }
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -19,7 +19,10 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "absl/base/config.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
// Helper functions that allow throwing exceptions consistently from anywhere.
|
||||
|
@ -66,6 +69,7 @@ namespace base_internal {
|
|||
// [[noreturn]] void ThrowStdBadArrayNewLength();
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_INTERNAL_THROW_DELEGATE_H_
|
||||
|
|
|
@ -18,9 +18,11 @@
|
|||
#define ABSL_BASE_INTERNAL_UNALIGNED_ACCESS_H_
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "absl/base/attributes.h"
|
||||
#include "absl/base/config.h"
|
||||
|
||||
// unaligned APIs
|
||||
|
||||
|
@ -56,6 +58,7 @@ void __sanitizer_unaligned_store64(void *p, uint64_t v);
|
|||
} // extern "C"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
inline uint16_t UnalignedLoad16(const void *p) {
|
||||
|
@ -83,6 +86,7 @@ inline void UnalignedStore64(void *p, uint64_t v) {
|
|||
}
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#define ABSL_INTERNAL_UNALIGNED_LOAD16(_p) \
|
||||
|
@ -102,6 +106,7 @@ inline void UnalignedStore64(void *p, uint64_t v) {
|
|||
#else
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
inline uint16_t UnalignedLoad16(const void *p) {
|
||||
|
@ -129,6 +134,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); }
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#define ABSL_INTERNAL_UNALIGNED_LOAD16(_p) \
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "absl/base/internal/sysinfo.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
#if defined(__i386__)
|
||||
|
@ -96,6 +97,7 @@ double UnscaledCycleClock::Frequency() {
|
|||
#endif
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_USE_UNSCALED_CYCLECLOCK
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
#endif
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace time_internal {
|
||||
class UnscaledCycleClockWrapperForGetCurrentTime;
|
||||
} // namespace time_internal
|
||||
|
@ -115,6 +116,7 @@ class UnscaledCycleClock {
|
|||
};
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_USE_UNSCALED_CYCLECLOCK
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "absl/strings/str_cat.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
namespace {
|
||||
|
||||
|
@ -218,4 +219,5 @@ TEST(InvokeTest, SfinaeFriendly) {
|
|||
|
||||
} // namespace
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -17,9 +17,11 @@
|
|||
#include <ostream>
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, absl::LogSeverity s) {
|
||||
if (s == absl::NormalizeLogSeverity(s)) return os << absl::LogSeverityName(s);
|
||||
return os << "absl::LogSeverity(" << static_cast<int>(s) << ")";
|
||||
}
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -19,8 +19,10 @@
|
|||
#include <ostream>
|
||||
|
||||
#include "absl/base/attributes.h"
|
||||
#include "absl/base/config.h"
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
|
||||
// Four severity levels are defined. Logging APIs should terminate the program
|
||||
// when a message is logged at severity `kFatal`; the other levels have no
|
||||
|
@ -79,6 +81,7 @@ constexpr absl::LogSeverity NormalizeLogSeverity(int s) {
|
|||
// unspecified; do not rely on it.
|
||||
std::ostream& operator<<(std::ostream& os, absl::LogSeverity s);
|
||||
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_INTERNAL_LOG_SEVERITY_H_
|
||||
|
|
|
@ -44,12 +44,14 @@
|
|||
(sizeof(::absl::macros_internal::ArraySizeHelper(array)))
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
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
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
// kLinkerInitialized
|
||||
|
@ -73,11 +75,13 @@ auto ArraySizeHelper(const T (&array)[N]) -> char (&)[N];
|
|||
// // Invocation
|
||||
// static MyClass my_global(absl::base_internal::kLinkerInitialized);
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
enum LinkerInitialized {
|
||||
kLinkerInitialized = 0,
|
||||
};
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
// ABSL_FALLTHROUGH_INTENDED
|
||||
|
|
|
@ -36,6 +36,7 @@ constexpr int32_t kNumThreads = 10;
|
|||
constexpr int32_t kIters = 1000;
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
// This is defined outside of anonymous namespace so that it can be
|
||||
|
@ -266,4 +267,5 @@ TEST(SpinLockWithThreads, DoesNotDeadlock) {
|
|||
|
||||
} // namespace
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#ifndef ABSL_BASE_THREAD_ANNOTATIONS_H_
|
||||
#define ABSL_BASE_THREAD_ANNOTATIONS_H_
|
||||
|
||||
#include "absl/base/config.h"
|
||||
// TODO(mbonadei): Remove after the backward compatibility period.
|
||||
#include "absl/base/internal/thread_annotations.h" // IWYU pragma: export
|
||||
|
||||
|
@ -256,6 +257,7 @@
|
|||
#define ABSL_TS_UNCHECKED_READ(x) absl::base_internal::ts_unchecked_read(x)
|
||||
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
// Takes a reference to a guarded data member, and returns an unguarded
|
||||
|
@ -272,6 +274,7 @@ inline T& ts_unchecked_read(T& v) ABSL_NO_THREAD_SAFETY_ANALYSIS {
|
|||
}
|
||||
|
||||
} // namespace base_internal
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
#endif // ABSL_BASE_THREAD_ANNOTATIONS_H_
|
||||
|
|
|
@ -200,7 +200,7 @@ void FlagHelpHumanReadable(const flags_internal::CommandLineFlag& flag,
|
|||
FlagHelpPrettyPrinter printer(80, out); // Max line length is 80.
|
||||
|
||||
// Flag name.
|
||||
printer.Write(absl::StrCat("-", flag.Name()));
|
||||
printer.Write(absl::StrCat("--", flag.Name()));
|
||||
|
||||
// Flag help.
|
||||
printer.Write(absl::StrCat("(", flag.Help(), ");"), /*wrap_line=*/true);
|
||||
|
|
|
@ -111,7 +111,7 @@ TEST_F(UsageReportingTest, TestFlagHelpHRF_on_flag_01) {
|
|||
flags::FlagHelp(test_buf, *flag, flags::HelpFormat::kHumanReadable);
|
||||
EXPECT_EQ(
|
||||
test_buf.str(),
|
||||
R"( -usage_reporting_test_flag_01 (usage_reporting_test_flag_01 help message);
|
||||
R"( --usage_reporting_test_flag_01 (usage_reporting_test_flag_01 help message);
|
||||
default: 101;
|
||||
)");
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ TEST_F(UsageReportingTest, TestFlagHelpHRF_on_flag_02) {
|
|||
flags::FlagHelp(test_buf, *flag, flags::HelpFormat::kHumanReadable);
|
||||
EXPECT_EQ(
|
||||
test_buf.str(),
|
||||
R"( -usage_reporting_test_flag_02 (usage_reporting_test_flag_02 help message);
|
||||
R"( --usage_reporting_test_flag_02 (usage_reporting_test_flag_02 help message);
|
||||
default: false;
|
||||
)");
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ TEST_F(UsageReportingTest, TestFlagHelpHRF_on_flag_03) {
|
|||
flags::FlagHelp(test_buf, *flag, flags::HelpFormat::kHumanReadable);
|
||||
EXPECT_EQ(
|
||||
test_buf.str(),
|
||||
R"( -usage_reporting_test_flag_03 (usage_reporting_test_flag_03 help message);
|
||||
R"( --usage_reporting_test_flag_03 (usage_reporting_test_flag_03 help message);
|
||||
default: 1.03;
|
||||
)");
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ TEST_F(UsageReportingTest, TestFlagHelpHRF_on_flag_04) {
|
|||
flags::FlagHelp(test_buf, *flag, flags::HelpFormat::kHumanReadable);
|
||||
EXPECT_EQ(
|
||||
test_buf.str(),
|
||||
R"( -usage_reporting_test_flag_04 (usage_reporting_test_flag_04 help message);
|
||||
R"( --usage_reporting_test_flag_04 (usage_reporting_test_flag_04 help message);
|
||||
default: 1000000000000004;
|
||||
)");
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ TEST_F(UsageReportingTest, TestFlagHelpHRF_on_flag_05) {
|
|||
flags::FlagHelp(test_buf, *flag, flags::HelpFormat::kHumanReadable);
|
||||
EXPECT_EQ(
|
||||
test_buf.str(),
|
||||
R"( -usage_reporting_test_flag_05 (usage_reporting_test_flag_05 help message);
|
||||
R"( --usage_reporting_test_flag_05 (usage_reporting_test_flag_05 help message);
|
||||
default: UDT{};
|
||||
)");
|
||||
}
|
||||
|
@ -171,17 +171,17 @@ TEST_F(UsageReportingTest, TestFlagsHelpHRF) {
|
|||
R"(usage_test: Custom usage message
|
||||
|
||||
Flags from absl/flags/internal/usage_test.cc:
|
||||
-usage_reporting_test_flag_01 (usage_reporting_test_flag_01 help message);
|
||||
--usage_reporting_test_flag_01 (usage_reporting_test_flag_01 help message);
|
||||
default: 101;
|
||||
-usage_reporting_test_flag_02 (usage_reporting_test_flag_02 help message);
|
||||
--usage_reporting_test_flag_02 (usage_reporting_test_flag_02 help message);
|
||||
default: false;
|
||||
-usage_reporting_test_flag_03 (usage_reporting_test_flag_03 help message);
|
||||
--usage_reporting_test_flag_03 (usage_reporting_test_flag_03 help message);
|
||||
default: 1.03;
|
||||
-usage_reporting_test_flag_04 (usage_reporting_test_flag_04 help message);
|
||||
--usage_reporting_test_flag_04 (usage_reporting_test_flag_04 help message);
|
||||
default: 1000000000000004;
|
||||
-usage_reporting_test_flag_05 (usage_reporting_test_flag_05 help message);
|
||||
--usage_reporting_test_flag_05 (usage_reporting_test_flag_05 help message);
|
||||
default: UDT{};
|
||||
-usage_reporting_test_flag_06 (usage_reporting_test_flag_06 help message.
|
||||
--usage_reporting_test_flag_06 (usage_reporting_test_flag_06 help message.
|
||||
|
||||
Some more help.
|
||||
Even more long long long long long long long long long long long long help
|
||||
|
@ -247,17 +247,17 @@ TEST_F(UsageReportingTest, TestUsageFlag_helpshort) {
|
|||
R"(usage_test: Custom usage message
|
||||
|
||||
Flags from absl/flags/internal/usage_test.cc:
|
||||
-usage_reporting_test_flag_01 (usage_reporting_test_flag_01 help message);
|
||||
--usage_reporting_test_flag_01 (usage_reporting_test_flag_01 help message);
|
||||
default: 101;
|
||||
-usage_reporting_test_flag_02 (usage_reporting_test_flag_02 help message);
|
||||
--usage_reporting_test_flag_02 (usage_reporting_test_flag_02 help message);
|
||||
default: false;
|
||||
-usage_reporting_test_flag_03 (usage_reporting_test_flag_03 help message);
|
||||
--usage_reporting_test_flag_03 (usage_reporting_test_flag_03 help message);
|
||||
default: 1.03;
|
||||
-usage_reporting_test_flag_04 (usage_reporting_test_flag_04 help message);
|
||||
--usage_reporting_test_flag_04 (usage_reporting_test_flag_04 help message);
|
||||
default: 1000000000000004;
|
||||
-usage_reporting_test_flag_05 (usage_reporting_test_flag_05 help message);
|
||||
--usage_reporting_test_flag_05 (usage_reporting_test_flag_05 help message);
|
||||
default: UDT{};
|
||||
-usage_reporting_test_flag_06 (usage_reporting_test_flag_06 help message.
|
||||
--usage_reporting_test_flag_06 (usage_reporting_test_flag_06 help message.
|
||||
|
||||
Some more help.
|
||||
Even more long long long long long long long long long long long long help
|
||||
|
@ -276,17 +276,17 @@ TEST_F(UsageReportingTest, TestUsageFlag_help) {
|
|||
R"(usage_test: Custom usage message
|
||||
|
||||
Flags from absl/flags/internal/usage_test.cc:
|
||||
-usage_reporting_test_flag_01 (usage_reporting_test_flag_01 help message);
|
||||
--usage_reporting_test_flag_01 (usage_reporting_test_flag_01 help message);
|
||||
default: 101;
|
||||
-usage_reporting_test_flag_02 (usage_reporting_test_flag_02 help message);
|
||||
--usage_reporting_test_flag_02 (usage_reporting_test_flag_02 help message);
|
||||
default: false;
|
||||
-usage_reporting_test_flag_03 (usage_reporting_test_flag_03 help message);
|
||||
--usage_reporting_test_flag_03 (usage_reporting_test_flag_03 help message);
|
||||
default: 1.03;
|
||||
-usage_reporting_test_flag_04 (usage_reporting_test_flag_04 help message);
|
||||
--usage_reporting_test_flag_04 (usage_reporting_test_flag_04 help message);
|
||||
default: 1000000000000004;
|
||||
-usage_reporting_test_flag_05 (usage_reporting_test_flag_05 help message);
|
||||
--usage_reporting_test_flag_05 (usage_reporting_test_flag_05 help message);
|
||||
default: UDT{};
|
||||
-usage_reporting_test_flag_06 (usage_reporting_test_flag_06 help message.
|
||||
--usage_reporting_test_flag_06 (usage_reporting_test_flag_06 help message.
|
||||
|
||||
Some more help.
|
||||
Even more long long long long long long long long long long long long help
|
||||
|
@ -307,17 +307,17 @@ TEST_F(UsageReportingTest, TestUsageFlag_helppackage) {
|
|||
R"(usage_test: Custom usage message
|
||||
|
||||
Flags from absl/flags/internal/usage_test.cc:
|
||||
-usage_reporting_test_flag_01 (usage_reporting_test_flag_01 help message);
|
||||
--usage_reporting_test_flag_01 (usage_reporting_test_flag_01 help message);
|
||||
default: 101;
|
||||
-usage_reporting_test_flag_02 (usage_reporting_test_flag_02 help message);
|
||||
--usage_reporting_test_flag_02 (usage_reporting_test_flag_02 help message);
|
||||
default: false;
|
||||
-usage_reporting_test_flag_03 (usage_reporting_test_flag_03 help message);
|
||||
--usage_reporting_test_flag_03 (usage_reporting_test_flag_03 help message);
|
||||
default: 1.03;
|
||||
-usage_reporting_test_flag_04 (usage_reporting_test_flag_04 help message);
|
||||
--usage_reporting_test_flag_04 (usage_reporting_test_flag_04 help message);
|
||||
default: 1000000000000004;
|
||||
-usage_reporting_test_flag_05 (usage_reporting_test_flag_05 help message);
|
||||
--usage_reporting_test_flag_05 (usage_reporting_test_flag_05 help message);
|
||||
default: UDT{};
|
||||
-usage_reporting_test_flag_06 (usage_reporting_test_flag_06 help message.
|
||||
--usage_reporting_test_flag_06 (usage_reporting_test_flag_06 help message.
|
||||
|
||||
Some more help.
|
||||
Even more long long long long long long long long long long long long help
|
||||
|
@ -372,17 +372,17 @@ TEST_F(UsageReportingTest, TestUsageFlag_helpon) {
|
|||
R"(usage_test: Custom usage message
|
||||
|
||||
Flags from absl/flags/internal/usage_test.cc:
|
||||
-usage_reporting_test_flag_01 (usage_reporting_test_flag_01 help message);
|
||||
--usage_reporting_test_flag_01 (usage_reporting_test_flag_01 help message);
|
||||
default: 101;
|
||||
-usage_reporting_test_flag_02 (usage_reporting_test_flag_02 help message);
|
||||
--usage_reporting_test_flag_02 (usage_reporting_test_flag_02 help message);
|
||||
default: false;
|
||||
-usage_reporting_test_flag_03 (usage_reporting_test_flag_03 help message);
|
||||
--usage_reporting_test_flag_03 (usage_reporting_test_flag_03 help message);
|
||||
default: 1.03;
|
||||
-usage_reporting_test_flag_04 (usage_reporting_test_flag_04 help message);
|
||||
--usage_reporting_test_flag_04 (usage_reporting_test_flag_04 help message);
|
||||
default: 1000000000000004;
|
||||
-usage_reporting_test_flag_05 (usage_reporting_test_flag_05 help message);
|
||||
--usage_reporting_test_flag_05 (usage_reporting_test_flag_05 help message);
|
||||
default: UDT{};
|
||||
-usage_reporting_test_flag_06 (usage_reporting_test_flag_06 help message.
|
||||
--usage_reporting_test_flag_06 (usage_reporting_test_flag_06 help message.
|
||||
|
||||
Some more help.
|
||||
Even more long long long long long long long long long long long long help
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
#include "absl/strings/internal/str_format/extension.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
|
||||
class CordReader;
|
||||
|
||||
namespace absl {
|
||||
|
||||
class Cord;
|
||||
|
@ -67,8 +65,7 @@ ConvertResult<Conv::s | Conv::p> FormatConvertImpl(const char* v,
|
|||
FormatSinkImpl* sink);
|
||||
template <class AbslCord,
|
||||
typename std::enable_if<
|
||||
std::is_same<AbslCord, absl::Cord>::value>::type* = nullptr,
|
||||
class AbslCordReader = ::CordReader>
|
||||
std::is_same<AbslCord, absl::Cord>::value>::type* = nullptr>
|
||||
ConvertResult<Conv::s> FormatConvertImpl(const AbslCord& value,
|
||||
ConversionSpec conv,
|
||||
FormatSinkImpl* sink) {
|
||||
|
@ -90,11 +87,17 @@ ConvertResult<Conv::s> FormatConvertImpl(const AbslCord& value,
|
|||
|
||||
if (space_remaining > 0 && !is_left) sink->Append(space_remaining, ' ');
|
||||
|
||||
string_view piece;
|
||||
for (AbslCordReader reader(value);
|
||||
to_write > 0 && reader.ReadFragment(&piece); to_write -= piece.size()) {
|
||||
if (piece.size() > to_write) piece.remove_suffix(piece.size() - to_write);
|
||||
for (string_view piece : value.Chunks()) {
|
||||
if (piece.size() > to_write) {
|
||||
piece.remove_suffix(piece.size() - to_write);
|
||||
to_write = 0;
|
||||
} else {
|
||||
to_write -= piece.size();
|
||||
}
|
||||
sink->Append(piece);
|
||||
if (to_write == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (space_remaining > 0 && is_left) sink->Append(space_remaining, ' ');
|
||||
|
|
|
@ -54,18 +54,20 @@ namespace absl {
|
|||
|
||||
// SimpleAtoi()
|
||||
//
|
||||
// Converts the given string into an integer value, returning `true` if
|
||||
// successful. The string must reflect a base-10 integer (optionally followed or
|
||||
// preceded by ASCII whitespace) whose value falls within the range of the
|
||||
// integer type. If any errors are encountered, this function returns `false`,
|
||||
// leaving `out` in an unspecified state.
|
||||
// Converts the given string (optionally followed or preceded by ASCII
|
||||
// whitespace) into an integer value, returning `true` if successful. The string
|
||||
// must reflect a base-10 integer whose value falls within the range of the
|
||||
// integer type (optionally preceded by a `+` or `-`). If any errors are
|
||||
// encountered, this function returns `false`, leaving `out` in an unspecified
|
||||
// state.
|
||||
template <typename int_type>
|
||||
ABSL_MUST_USE_RESULT bool SimpleAtoi(absl::string_view str, int_type* out);
|
||||
|
||||
// SimpleAtof()
|
||||
//
|
||||
// Converts the given string (optionally followed or preceded by ASCII
|
||||
// whitespace) into a float, which may be rounded on overflow or underflow.
|
||||
// whitespace) into a float, which may be rounded on overflow or underflow,
|
||||
// returning `true` if successful.
|
||||
// See https://en.cppreference.com/w/c/string/byte/strtof for details about the
|
||||
// allowed formats for `str`, except SimpleAtof() is locale-independent and will
|
||||
// always use the "C" locale. If any errors are encountered, this function
|
||||
|
@ -75,7 +77,8 @@ ABSL_MUST_USE_RESULT bool SimpleAtof(absl::string_view str, float* out);
|
|||
// SimpleAtod()
|
||||
//
|
||||
// Converts the given string (optionally followed or preceded by ASCII
|
||||
// whitespace) into a double, which may be rounded on overflow or underflow.
|
||||
// whitespace) into a double, which may be rounded on overflow or underflow,
|
||||
// returning `true` if successful.
|
||||
// See https://en.cppreference.com/w/c/string/byte/strtof for details about the
|
||||
// allowed formats for `str`, except SimpleAtod is locale-independent and will
|
||||
// always use the "C" locale. If any errors are encountered, this function
|
||||
|
|
Loading…
Reference in a new issue