Skip to content

Update abseil-cpp to a new upstream #1111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Firestore/third_party/abseil-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ if(NOT ABSL_CCTZ_TARGET)
endif()

# commented: used only for standalone test
# Don't remove these or else CMake CI will break
#add_subdirectory(cctz)
#add_subdirectory(googletest)
check_target(${ABSL_CCTZ_TARGET})
Expand Down
1 change: 1 addition & 0 deletions Firestore/third_party/abseil-cpp/absl/base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ list(APPEND BASE_PUBLIC_HEADERS
list(APPEND BASE_INTERNAL_HEADERS
"internal/atomic_hook.h"
"internal/cycleclock.h"
"internal/direct_mmap.h"
"internal/endian.h"
"internal/exception_testing.h"
"internal/exception_safety_testing.h"
Expand Down
21 changes: 19 additions & 2 deletions Firestore/third_party/abseil-cpp/absl/base/attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -527,17 +527,34 @@
#define ABSL_ATTRIBUTE_PACKED
#endif

// ABSL_ATTRIBUTE_FUNC_ALIGN
//
// Tells the compiler to align the function start at least to certain
// alignment boundary
#if ABSL_HAVE_ATTRIBUTE(aligned) || (defined(__GNUC__) && !defined(__clang__))
#define ABSL_ATTRIBUTE_FUNC_ALIGN(bytes) __attribute__((aligned(bytes)))
#else
#define ABSL_ATTRIBUTE_FUNC_ALIGN(bytes)
#endif

// ABSL_CONST_INIT
//
// A variable declaration annotated with the `ABSL_CONST_INIT` attribute will
// not compile (on supported platforms) unless the variable has a constant
// initializer. This is useful for variables with static and thread storage
// duration, because it guarantees that they will not suffer from the so-called
// "static init order fiasco".
// "static init order fiasco". Prefer to put this attribute on the most visible
// declaration of the variable, if there's more than one, because code that
// accesses the variable can then use the attribute for optimization.
//
// Example:
//
// ABSL_CONST_INIT static MyType my_var = MakeMyType(...);
// class MyClass {
// public:
// ABSL_CONST_INIT static MyType my_var;
// };
//
// MyType MyClass::my_var = MakeMyType(...);
//
// Note that this attribute is redundant if the variable is declared constexpr.
#if ABSL_HAVE_CPP_ATTRIBUTE(clang::require_constant_initialization)
Expand Down
37 changes: 24 additions & 13 deletions Firestore/third_party/abseil-cpp/absl/base/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,16 @@
// supported.
#ifdef ABSL_HAVE_THREAD_LOCAL
#error ABSL_HAVE_THREAD_LOCAL cannot be directly set
#elif (!defined(__apple_build_version__) || \
(__apple_build_version__ >= 8000042)) && \
!(defined(__APPLE__) && TARGET_OS_IPHONE && \
__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0)
#elif defined(__APPLE__)
// Notes: Xcode's clang did not support `thread_local` until version
// 8, and even then not for all iOS < 9.0.
// 8, and even then not for all iOS < 9.0. Also, Xcode 9.3 started disallowing
// `thread_local` for 32-bit iOS simulator targeting iOS 9.x.
// `__has_feature` is only supported by Clang so it has be inside
// `defined(__APPLE__)` check.
#if __has_feature(cxx_thread_local)
#define ABSL_HAVE_THREAD_LOCAL 1
#endif
#else // !defined(__APPLE__)
#define ABSL_HAVE_THREAD_LOCAL 1
#endif

Expand Down Expand Up @@ -176,16 +180,22 @@
// Checks whether the __int128 compiler extension for a 128-bit integral type is
// supported.
//
// Notes: __SIZEOF_INT128__ is defined by Clang and GCC when __int128 is
// supported, except on ppc64 and aarch64 where __int128 exists but has exhibits
// a sporadic compiler crashing bug. Nvidia's nvcc also defines __GNUC__ and
// __SIZEOF_INT128__ but not all versions actually support __int128.
// Note: __SIZEOF_INT128__ is defined by Clang and GCC when __int128 is
// supported, but we avoid using it in certain cases:
// * On Clang:
// * Building using Clang for Windows, where the Clang runtime library has
// 128-bit support only on LP64 architectures, but Windows is LLP64.
// * Building for aarch64, where __int128 exists but has exhibits a sporadic
// compiler crashing bug.
// * On Nvidia's nvcc:
// * nvcc also defines __GNUC__ and __SIZEOF_INT128__, but not all versions
// actually support __int128.
#ifdef ABSL_HAVE_INTRINSIC_INT128
#error ABSL_HAVE_INTRINSIC_INT128 cannot be directly set
#elif defined(__SIZEOF_INT128__)
#if (defined(__clang__) && !defined(__aarch64__)) || \
(defined(__CUDACC__) && __CUDACC_VER_MAJOR__ >= 9) || \
(!defined(__clang__) && !defined(__CUDACC__) && defined(__GNUC__))
#if (defined(__clang__) && !defined(_WIN32) && !defined(__aarch64__)) || \
(defined(__CUDACC__) && __CUDACC_VER_MAJOR__ >= 9) || \
(defined(__GNUC__) && !defined(__clang__) && !defined(__CUDACC__))
#define ABSL_HAVE_INTRINSIC_INT128 1
#elif defined(__CUDACC__)
// __CUDACC_VER__ is a full version number before CUDA 9, and is defined to a
Expand Down Expand Up @@ -244,6 +254,7 @@
// Windows _WIN32
// NaCL __native_client__
// AsmJS __asmjs__
// WebAssembly __wasm__
// Fuchsia __Fuchsia__
//
// Note that since Android defines both __ANDROID__ and __linux__, one
Expand All @@ -257,7 +268,7 @@
#error ABSL_HAVE_MMAP cannot be directly set
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(__ros__) || defined(__native_client__) || defined(__asmjs__) || \
defined(__Fuchsia__)
defined(__wasm__) || defined(__Fuchsia__)
#define ABSL_HAVE_MMAP 1
#endif

Expand Down
21 changes: 8 additions & 13 deletions Firestore/third_party/abseil-cpp/absl/base/internal/raw_logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <cstdlib>
#include <cstring>

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


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

static constexpr int kLogBufSize = 3000;

namespace absl {
namespace raw_logging_internal {
void SafeWriteToStderr(const char *s, size_t len);
} // namespace raw_logging_internal
} // namespace absl

namespace {

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

void RawLogVA(absl::LogSeverity severity, const char* file, int line,
const char* format, va_list ap) ABSL_PRINTF_ATTRIBUTE(4, 0);
void RawLogVA(absl::LogSeverity severity, const char* file, int line,
const char* format, va_list ap) {
char buffer[kLogBufSize];
Expand Down Expand Up @@ -183,12 +182,6 @@ void RawLogVA(absl::LogSeverity severity, const char* file, int line,

namespace absl {
namespace raw_logging_internal {

// Writes the provided buffer directly to stderr, in a safe, low-level manner.
//
// In POSIX this means calling write(), which is async-signal safe and does
// not malloc. If the platform supports the SYS_write syscall, we invoke that
// directly to side-step any libc interception.
void SafeWriteToStderr(const char *s, size_t len) {
#if defined(ABSL_HAVE_SYSCALL_WRITE)
syscall(SYS_write, STDERR_FILENO, s, len);
Expand All @@ -203,6 +196,8 @@ void SafeWriteToStderr(const char *s, size_t len) {
#endif
}

void RawLog(absl::LogSeverity severity, const char* file, int line,
const char* format, ...) ABSL_PRINTF_ATTRIBUTE(4, 5);
void RawLog(absl::LogSeverity severity, const char* file, int line,
const char* format, ...) {
va_list ap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ namespace raw_logging_internal {
void RawLog(absl::LogSeverity severity, const char* file, int line,
const char* format, ...) ABSL_PRINTF_ATTRIBUTE(4, 5);

// Writes the provided buffer directly to stderr, in a safe, low-level manner.
//
// In POSIX this means calling write(), which is async-signal safe and does
// not malloc. If the platform supports the SYS_write syscall, we invoke that
// directly to side-step any libc interception.
void SafeWriteToStderr(const char *s, size_t len);

// compile-time function to get the "base" filename, that is, the part of
// a filename after the last "/" or "\" path separator. The search starts at
// the end of the std::string; the second parameter is the length of the std::string.
Expand Down
8 changes: 7 additions & 1 deletion Firestore/third_party/abseil-cpp/absl/base/log_severity.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

namespace absl {

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

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

// Note that out-of-range severities normalize to kInfo or kError, never kFatal.
// Values less than `kInfo` normalize to `kInfo`; values greater than `kFatal`
// normalize to `kError` (**NOT** `kFatal`).
constexpr absl::LogSeverity NormalizeLogSeverity(absl::LogSeverity s) {
return s < absl::LogSeverity::kInfo
? absl::LogSeverity::kInfo
Expand Down
2 changes: 1 addition & 1 deletion Firestore/third_party/abseil-cpp/absl/base/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
namespace absl {
namespace macros_internal {
template <typename T, size_t N>
char (&ArraySizeHelper(T (&array)[N]))[N];
auto ArraySizeHelper(const T (&array)[N]) -> char (&)[N];
} // namespace macros_internal
} // namespace absl
#define ABSL_ARRAYSIZE(array) \
Expand Down
30 changes: 26 additions & 4 deletions Firestore/third_party/abseil-cpp/absl/base/policy_checks.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,23 @@

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

// We support gcc 4.7 and later.
// This minimum will go up.
#if defined(__GNUC__) && !defined(__clang__)
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
#error "This package requires gcc 4.7 or higher"
#error "This package requires gcc 4.7 or higher."
#endif
#endif

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

// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -96,4 +96,26 @@
#error "STLPort is not supported."
#endif

// -----------------------------------------------------------------------------
// `char` Size Check
// -----------------------------------------------------------------------------

// Abseil currently assumes CHAR_BIT == 8. If you would like to use Abseil on a
// platform where this is not the case, please provide us with the details about
// your platform so we can consider relaxing this requirement.
#if CHAR_BIT != 8
#error "Abseil assumes CHAR_BIT == 8."
#endif

// -----------------------------------------------------------------------------
// `int` Size Check
// -----------------------------------------------------------------------------

// Abseil currently assumes that an int is 4 bytes. If you would like to use
// Abseil on a platform where this is not the case, please provide us with the
// details about your platform so we can consider relaxing this requirement.
#if INT_MAX < 2147483647
#error "Abseil assumes that int is at least 4 bytes. "
#endif

#endif // ABSL_BASE_POLICY_CHECKS_H_
4 changes: 4 additions & 0 deletions Firestore/third_party/abseil-cpp/absl/meta/type_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ struct is_trivially_destructible
: std::integral_constant<bool, __has_trivial_destructor(T) &&
std::is_destructible<T>::value> {
#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
private:
static constexpr bool compliant = std::is_trivially_destructible<T>::value ==
is_trivially_destructible::value;
static_assert(compliant || std::is_trivially_destructible<T>::value,
Expand Down Expand Up @@ -199,6 +200,7 @@ struct is_trivially_default_constructible
std::is_default_constructible<T>::value &&
is_trivially_destructible<T>::value> {
#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
private:
static constexpr bool compliant =
std::is_trivially_default_constructible<T>::value ==
is_trivially_default_constructible::value;
Expand Down Expand Up @@ -230,6 +232,7 @@ struct is_trivially_copy_constructible
std::is_copy_constructible<T>::value &&
is_trivially_destructible<T>::value> {
#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
private:
static constexpr bool compliant =
std::is_trivially_copy_constructible<T>::value ==
is_trivially_copy_constructible::value;
Expand Down Expand Up @@ -262,6 +265,7 @@ struct is_trivially_copy_assignable
: std::integral_constant<bool, __has_trivial_assign(T) &&
std::is_copy_assignable<T>::value> {
#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
private:
static constexpr bool compliant =
std::is_trivially_copy_assignable<T>::value ==
is_trivially_copy_assignable::value;
Expand Down
Loading