Skip to content

Commit e904797

Browse files
committed
Update abseil-cpp to a new upstream
Actually update to bf7fc9986e20f664958fc227547fd8d2fdcf863e Change firebase#754 didn't completely do this. This makes the rest of the sources match optional, which was imported at this change in firebase#1083. Also add: absl/types/optional_test.cc absl/types/CMakeLists.txt absl/utility/CMakeLists.txt
1 parent 4691ed2 commit e904797

28 files changed

+2451
-282
lines changed

Firestore/third_party/abseil-cpp/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ if(NOT ABSL_CCTZ_TARGET)
7070
endif()
7171

7272
# commented: used only for standalone test
73+
# Don't remove these or else CMake CI will break
7374
#add_subdirectory(cctz)
7475
#add_subdirectory(googletest)
7576
check_target(${ABSL_CCTZ_TARGET})

Firestore/third_party/abseil-cpp/absl/base/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ list(APPEND BASE_PUBLIC_HEADERS
3232
list(APPEND BASE_INTERNAL_HEADERS
3333
"internal/atomic_hook.h"
3434
"internal/cycleclock.h"
35+
"internal/direct_mmap.h"
3536
"internal/endian.h"
3637
"internal/exception_testing.h"
3738
"internal/exception_safety_testing.h"

Firestore/third_party/abseil-cpp/absl/base/attributes.h

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,17 +527,34 @@
527527
#define ABSL_ATTRIBUTE_PACKED
528528
#endif
529529

530+
// ABSL_ATTRIBUTE_FUNC_ALIGN
531+
//
532+
// Tells the compiler to align the function start at least to certain
533+
// alignment boundary
534+
#if ABSL_HAVE_ATTRIBUTE(aligned) || (defined(__GNUC__) && !defined(__clang__))
535+
#define ABSL_ATTRIBUTE_FUNC_ALIGN(bytes) __attribute__((aligned(bytes)))
536+
#else
537+
#define ABSL_ATTRIBUTE_FUNC_ALIGN(bytes)
538+
#endif
539+
530540
// ABSL_CONST_INIT
531541
//
532542
// A variable declaration annotated with the `ABSL_CONST_INIT` attribute will
533543
// not compile (on supported platforms) unless the variable has a constant
534544
// initializer. This is useful for variables with static and thread storage
535545
// duration, because it guarantees that they will not suffer from the so-called
536-
// "static init order fiasco".
546+
// "static init order fiasco". Prefer to put this attribute on the most visible
547+
// declaration of the variable, if there's more than one, because code that
548+
// accesses the variable can then use the attribute for optimization.
537549
//
538550
// Example:
539551
//
540-
// ABSL_CONST_INIT static MyType my_var = MakeMyType(...);
552+
// class MyClass {
553+
// public:
554+
// ABSL_CONST_INIT static MyType my_var;
555+
// };
556+
//
557+
// MyType MyClass::my_var = MakeMyType(...);
541558
//
542559
// Note that this attribute is redundant if the variable is declared constexpr.
543560
#if ABSL_HAVE_CPP_ATTRIBUTE(clang::require_constant_initialization)

Firestore/third_party/abseil-cpp/absl/base/config.h

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,16 @@
138138
// supported.
139139
#ifdef ABSL_HAVE_THREAD_LOCAL
140140
#error ABSL_HAVE_THREAD_LOCAL cannot be directly set
141-
#elif (!defined(__apple_build_version__) || \
142-
(__apple_build_version__ >= 8000042)) && \
143-
!(defined(__APPLE__) && TARGET_OS_IPHONE && \
144-
__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0)
141+
#elif defined(__APPLE__)
145142
// Notes: Xcode's clang did not support `thread_local` until version
146-
// 8, and even then not for all iOS < 9.0.
143+
// 8, and even then not for all iOS < 9.0. Also, Xcode 9.3 started disallowing
144+
// `thread_local` for 32-bit iOS simulator targeting iOS 9.x.
145+
// `__has_feature` is only supported by Clang so it has be inside
146+
// `defined(__APPLE__)` check.
147+
#if __has_feature(cxx_thread_local)
148+
#define ABSL_HAVE_THREAD_LOCAL 1
149+
#endif
150+
#else // !defined(__APPLE__)
147151
#define ABSL_HAVE_THREAD_LOCAL 1
148152
#endif
149153

@@ -176,16 +180,22 @@
176180
// Checks whether the __int128 compiler extension for a 128-bit integral type is
177181
// supported.
178182
//
179-
// Notes: __SIZEOF_INT128__ is defined by Clang and GCC when __int128 is
180-
// supported, except on ppc64 and aarch64 where __int128 exists but has exhibits
181-
// a sporadic compiler crashing bug. Nvidia's nvcc also defines __GNUC__ and
182-
// __SIZEOF_INT128__ but not all versions actually support __int128.
183+
// Note: __SIZEOF_INT128__ is defined by Clang and GCC when __int128 is
184+
// supported, but we avoid using it in certain cases:
185+
// * On Clang:
186+
// * Building using Clang for Windows, where the Clang runtime library has
187+
// 128-bit support only on LP64 architectures, but Windows is LLP64.
188+
// * Building for aarch64, where __int128 exists but has exhibits a sporadic
189+
// compiler crashing bug.
190+
// * On Nvidia's nvcc:
191+
// * nvcc also defines __GNUC__ and __SIZEOF_INT128__, but not all versions
192+
// actually support __int128.
183193
#ifdef ABSL_HAVE_INTRINSIC_INT128
184194
#error ABSL_HAVE_INTRINSIC_INT128 cannot be directly set
185195
#elif defined(__SIZEOF_INT128__)
186-
#if (defined(__clang__) && !defined(__aarch64__)) || \
187-
(defined(__CUDACC__) && __CUDACC_VER_MAJOR__ >= 9) || \
188-
(!defined(__clang__) && !defined(__CUDACC__) && defined(__GNUC__))
196+
#if (defined(__clang__) && !defined(_WIN32) && !defined(__aarch64__)) || \
197+
(defined(__CUDACC__) && __CUDACC_VER_MAJOR__ >= 9) || \
198+
(defined(__GNUC__) && !defined(__clang__) && !defined(__CUDACC__))
189199
#define ABSL_HAVE_INTRINSIC_INT128 1
190200
#elif defined(__CUDACC__)
191201
// __CUDACC_VER__ is a full version number before CUDA 9, and is defined to a
@@ -244,6 +254,7 @@
244254
// Windows _WIN32
245255
// NaCL __native_client__
246256
// AsmJS __asmjs__
257+
// WebAssembly __wasm__
247258
// Fuchsia __Fuchsia__
248259
//
249260
// Note that since Android defines both __ANDROID__ and __linux__, one
@@ -257,7 +268,7 @@
257268
#error ABSL_HAVE_MMAP cannot be directly set
258269
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
259270
defined(__ros__) || defined(__native_client__) || defined(__asmjs__) || \
260-
defined(__Fuchsia__)
271+
defined(__wasm__) || defined(__Fuchsia__)
261272
#define ABSL_HAVE_MMAP 1
262273
#endif
263274

Firestore/third_party/abseil-cpp/absl/base/internal/raw_logging.cc

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <cstdlib>
2121
#include <cstring>
2222

23+
#include "absl/base/attributes.h"
2324
#include "absl/base/config.h"
2425
#include "absl/base/internal/atomic_hook.h"
2526
#include "absl/base/log_severity.h"
@@ -35,7 +36,7 @@
3536
// This preprocessor token is also defined in raw_io.cc. If you need to copy
3637
// this, consider moving both to config.h instead.
3738
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
38-
defined(__Fuchsia__)
39+
defined(__Fuchsia__) || defined(__native_client__)
3940
#include <unistd.h>
4041

4142

@@ -81,6 +82,8 @@ static const char kTruncated[] = " ... (message truncated)\n";
8182
// consumed bytes, and return whether the message fit without truncation. If
8283
// truncation occurred, if possible leave room in the buffer for the message
8384
// kTruncated[].
85+
inline static bool VADoRawLog(char** buf, int* size, const char* format,
86+
va_list ap) ABSL_PRINTF_ATTRIBUTE(3, 0);
8487
inline static bool VADoRawLog(char** buf, int* size,
8588
const char* format, va_list ap) {
8689
int n = vsnprintf(*buf, *size, format, ap);
@@ -101,12 +104,6 @@ inline static bool VADoRawLog(char** buf, int* size,
101104

102105
static constexpr int kLogBufSize = 3000;
103106

104-
namespace absl {
105-
namespace raw_logging_internal {
106-
void SafeWriteToStderr(const char *s, size_t len);
107-
} // namespace raw_logging_internal
108-
} // namespace absl
109-
110107
namespace {
111108

112109
// CAVEAT: vsnprintf called from *DoRawLog below has some (exotic) code paths
@@ -128,6 +125,8 @@ bool DoRawLog(char** buf, int* size, const char* format, ...) {
128125
return true;
129126
}
130127

128+
void RawLogVA(absl::LogSeverity severity, const char* file, int line,
129+
const char* format, va_list ap) ABSL_PRINTF_ATTRIBUTE(4, 0);
131130
void RawLogVA(absl::LogSeverity severity, const char* file, int line,
132131
const char* format, va_list ap) {
133132
char buffer[kLogBufSize];
@@ -183,12 +182,6 @@ void RawLogVA(absl::LogSeverity severity, const char* file, int line,
183182

184183
namespace absl {
185184
namespace raw_logging_internal {
186-
187-
// Writes the provided buffer directly to stderr, in a safe, low-level manner.
188-
//
189-
// In POSIX this means calling write(), which is async-signal safe and does
190-
// not malloc. If the platform supports the SYS_write syscall, we invoke that
191-
// directly to side-step any libc interception.
192185
void SafeWriteToStderr(const char *s, size_t len) {
193186
#if defined(ABSL_HAVE_SYSCALL_WRITE)
194187
syscall(SYS_write, STDERR_FILENO, s, len);
@@ -203,6 +196,8 @@ void SafeWriteToStderr(const char *s, size_t len) {
203196
#endif
204197
}
205198

199+
void RawLog(absl::LogSeverity severity, const char* file, int line,
200+
const char* format, ...) ABSL_PRINTF_ATTRIBUTE(4, 5);
206201
void RawLog(absl::LogSeverity severity, const char* file, int line,
207202
const char* format, ...) {
208203
va_list ap;

Firestore/third_party/abseil-cpp/absl/base/internal/raw_logging.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ namespace raw_logging_internal {
7474
void RawLog(absl::LogSeverity severity, const char* file, int line,
7575
const char* format, ...) ABSL_PRINTF_ATTRIBUTE(4, 5);
7676

77+
// Writes the provided buffer directly to stderr, in a safe, low-level manner.
78+
//
79+
// In POSIX this means calling write(), which is async-signal safe and does
80+
// not malloc. If the platform supports the SYS_write syscall, we invoke that
81+
// directly to side-step any libc interception.
82+
void SafeWriteToStderr(const char *s, size_t len);
83+
7784
// compile-time function to get the "base" filename, that is, the part of
7885
// a filename after the last "/" or "\" path separator. The search starts at
7986
// the end of the std::string; the second parameter is the length of the std::string.

Firestore/third_party/abseil-cpp/absl/base/log_severity.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323
namespace absl {
2424

25+
// Four severity levels are defined. Logging APIs should terminate the program
26+
// when a message is logged at severity `kFatal`; the other levels have no
27+
// special semantics.
2528
enum class LogSeverity : int {
2629
kInfo = 0,
2730
kWarning = 1,
@@ -36,6 +39,8 @@ constexpr std::array<absl::LogSeverity, 4> LogSeverities() {
3639
absl::LogSeverity::kError, absl::LogSeverity::kFatal}};
3740
}
3841

42+
// Returns the all-caps std::string representation (e.g. "INFO") of the specified
43+
// severity level if it is one of the normal levels and "UNKNOWN" otherwise.
3944
constexpr const char* LogSeverityName(absl::LogSeverity s) {
4045
return s == absl::LogSeverity::kInfo
4146
? "INFO"
@@ -46,7 +51,8 @@ constexpr const char* LogSeverityName(absl::LogSeverity s) {
4651
: s == absl::LogSeverity::kFatal ? "FATAL" : "UNKNOWN";
4752
}
4853

49-
// Note that out-of-range severities normalize to kInfo or kError, never kFatal.
54+
// Values less than `kInfo` normalize to `kInfo`; values greater than `kFatal`
55+
// normalize to `kError` (**NOT** `kFatal`).
5056
constexpr absl::LogSeverity NormalizeLogSeverity(absl::LogSeverity s) {
5157
return s < absl::LogSeverity::kInfo
5258
? absl::LogSeverity::kInfo

Firestore/third_party/abseil-cpp/absl/base/macros.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
namespace absl {
4747
namespace macros_internal {
4848
template <typename T, size_t N>
49-
char (&ArraySizeHelper(T (&array)[N]))[N];
49+
auto ArraySizeHelper(const T (&array)[N]) -> char (&)[N];
5050
} // namespace macros_internal
5151
} // namespace absl
5252
#define ABSL_ARRAYSIZE(array) \

Firestore/third_party/abseil-cpp/absl/base/policy_checks.h

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,23 @@
4646

4747
// We support MSVC++ 14.0 update 2 and later.
4848
// This minimum will go up.
49-
#if defined(_MSC_FULL_VER) && _MSC_FULL_VER < 190023918
50-
#error "This package requires Visual Studio 2015 Update 2 or higher"
49+
#if defined(_MSC_FULL_VER) && _MSC_FULL_VER < 190023918 && !defined(__clang__)
50+
#error "This package requires Visual Studio 2015 Update 2 or higher."
5151
#endif
5252

5353
// We support gcc 4.7 and later.
5454
// This minimum will go up.
5555
#if defined(__GNUC__) && !defined(__clang__)
5656
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
57-
#error "This package requires gcc 4.7 or higher"
57+
#error "This package requires gcc 4.7 or higher."
5858
#endif
5959
#endif
6060

6161
// We support Apple Xcode clang 4.2.1 (version 421.11.65) and later.
6262
// This corresponds to Apple Xcode version 4.5.
6363
// This minimum will go up.
6464
#if defined(__apple_build_version__) && __apple_build_version__ < 4211165
65-
#error "This package requires __apple_build_version__ of 4211165 or higher"
65+
#error "This package requires __apple_build_version__ of 4211165 or higher."
6666
#endif
6767

6868
// -----------------------------------------------------------------------------
@@ -96,4 +96,26 @@
9696
#error "STLPort is not supported."
9797
#endif
9898

99+
// -----------------------------------------------------------------------------
100+
// `char` Size Check
101+
// -----------------------------------------------------------------------------
102+
103+
// Abseil currently assumes CHAR_BIT == 8. If you would like to use Abseil on a
104+
// platform where this is not the case, please provide us with the details about
105+
// your platform so we can consider relaxing this requirement.
106+
#if CHAR_BIT != 8
107+
#error "Abseil assumes CHAR_BIT == 8."
108+
#endif
109+
110+
// -----------------------------------------------------------------------------
111+
// `int` Size Check
112+
// -----------------------------------------------------------------------------
113+
114+
// Abseil currently assumes that an int is 4 bytes. If you would like to use
115+
// Abseil on a platform where this is not the case, please provide us with the
116+
// details about your platform so we can consider relaxing this requirement.
117+
#if INT_MAX < 2147483647
118+
#error "Abseil assumes that int is at least 4 bytes. "
119+
#endif
120+
99121
#endif // ABSL_BASE_POLICY_CHECKS_H_

Firestore/third_party/abseil-cpp/absl/meta/type_traits.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ struct is_trivially_destructible
150150
: std::integral_constant<bool, __has_trivial_destructor(T) &&
151151
std::is_destructible<T>::value> {
152152
#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
153+
private:
153154
static constexpr bool compliant = std::is_trivially_destructible<T>::value ==
154155
is_trivially_destructible::value;
155156
static_assert(compliant || std::is_trivially_destructible<T>::value,
@@ -199,6 +200,7 @@ struct is_trivially_default_constructible
199200
std::is_default_constructible<T>::value &&
200201
is_trivially_destructible<T>::value> {
201202
#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
203+
private:
202204
static constexpr bool compliant =
203205
std::is_trivially_default_constructible<T>::value ==
204206
is_trivially_default_constructible::value;
@@ -230,6 +232,7 @@ struct is_trivially_copy_constructible
230232
std::is_copy_constructible<T>::value &&
231233
is_trivially_destructible<T>::value> {
232234
#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
235+
private:
233236
static constexpr bool compliant =
234237
std::is_trivially_copy_constructible<T>::value ==
235238
is_trivially_copy_constructible::value;
@@ -262,6 +265,7 @@ struct is_trivially_copy_assignable
262265
: std::integral_constant<bool, __has_trivial_assign(T) &&
263266
std::is_copy_assignable<T>::value> {
264267
#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
268+
private:
265269
static constexpr bool compliant =
266270
std::is_trivially_copy_assignable<T>::value ==
267271
is_trivially_copy_assignable::value;

0 commit comments

Comments
 (0)