Skip to content

Update abseil-cpp to a new upstream #754

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
Feb 6, 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
48 changes: 30 additions & 18 deletions Firestore/third_party/abseil-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,17 @@ include(AbseilHelpers)


# config options
set(ABSL_STD_CXX_FLAG "-std=c++11" CACHE STRING "c++ std flag (default: c++11)")
if (MSVC)
# /wd4005 macro-redefinition
# /wd4068 unknown pragma
# /wd4244 conversion from 'type1' to 'type2'
# /wd4267 conversion from 'size_t' to 'type2'
# /wd4800 force value to bool 'true' or 'false' (performance warning)
add_compile_options(/W3 /WX /wd4005 /wd4068 /wd4244 /wd4267 /wd4800)
add_definitions(/DNOMINMAX /DWIN32_LEAN_AND_MEAN=1 /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS)
else()
set(ABSL_STD_CXX_FLAG "-std=c++11" CACHE STRING "c++ std flag (default: c++11)")
endif()



Expand All @@ -48,32 +58,34 @@ list(APPEND ABSL_COMMON_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_CXX_FLAGS "${ABSL_STD_CXX_FLAG} ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_WARNING_VLA} ${CMAKE_CXX_FLAGS} ")

# -fexceptions
set(ABSL_EXCEPTIONS_FLAG "${CMAKE_CXX_EXCEPTIONS}")

# find dependencies
## pthread
find_package(Threads REQUIRED)

if(NOT ABSL_CCTZ_TARGET)
set(ABSL_CCTZ_TARGET cctz)
endif()

# commented: used only for standalone test
#add_subdirectory(cctz)
#add_subdirectory(googletest)
check_target(${ABSL_CCTZ_TARGET})

## check targets
check_target(cctz)
check_target(gtest)
check_target(gtest_main)
check_target(gmock)

# -fexceptions
set(ABSL_EXCEPTIONS_FLAG "${CMAKE_CXX_EXCEPTIONS}")

# fix stuff
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FIX_MSVC} ${CMAKE_CXX_FLAGS}")

list(APPEND ABSL_TEST_COMMON_LIBRARIES
gtest_main
gtest
gmock
${CMAKE_THREAD_LIBS_INIT}
)
if(BUILD_TESTING)
check_target(gtest)
check_target(gtest_main)
check_target(gmock)

list(APPEND ABSL_TEST_COMMON_LIBRARIES
gtest_main
gtest
gmock
${CMAKE_THREAD_LIBS_INIT}
)
endif()

add_subdirectory(absl)
64 changes: 61 additions & 3 deletions Firestore/third_party/abseil-cpp/absl/base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ list(APPEND BASE_PUBLIC_HEADERS
"casts.h"
"config.h"
"dynamic_annotations.h"
"log_severity.h"
"macros.h"
"optimization.h"
"policy_checks.h"
Expand All @@ -33,17 +34,18 @@ list(APPEND BASE_INTERNAL_HEADERS
"internal/cycleclock.h"
"internal/endian.h"
"internal/exception_testing.h"
"internal/exception_safety_testing.h"
"internal/identity.h"
"internal/invoke.h"
"internal/log_severity.h"
"internal/inline_variable.h"
"internal/low_level_alloc.h"
"internal/low_level_scheduling.h"
"internal/malloc_extension_c.h"
"internal/malloc_extension.h"
"internal/malloc_hook_c.h"
"internal/malloc_hook.h"
"internal/malloc_hook_invoke.h"
"internal/per_thread_tls.h"
"internal/pretty_function.h"
"internal/raw_logging.h"
"internal/scheduling_mode.h"
"internal/spinlock.h"
Expand All @@ -58,7 +60,7 @@ list(APPEND BASE_INTERNAL_HEADERS


# absl_base main library
list(APPEND BASE_SRC
list(APPEND BASE_SRC
"internal/cycleclock.cc"
"internal/raw_logging.cc"
"internal/spinlock.cc"
Expand Down Expand Up @@ -114,6 +116,28 @@ absl_library(
throw_delegate
)

if(BUILD_TESTING)
# exception-safety testing library
set(EXCEPTION_SAFETY_TESTING_SRC "internal/exception_safety_testing.cc")
set(EXCEPTION_SAFETY_TESTING_PUBLIC_LIBRARIES
${ABSL_TEST_COMMON_LIBRARIES}
absl::base
absl::memory
absl::meta
absl::strings
absl::types
)

absl_library(
TARGET
absl_base_internal_exception_safety_testing
SOURCES
${EXCEPTION_SAFETY_TESTING_SRC}
PUBLIC_LIBRARIES
${EXCEPTION_SAFETY_TESTING_PUBLIC_LIBRARIES}
)
endif()


# dynamic_annotations library
set(DYNAMIC_ANNOTATIONS_SRC "dynamic_annotations.cc")
Expand Down Expand Up @@ -212,6 +236,26 @@ absl_test(
)


# test inline_variable_test
list(APPEND INLINE_VARIABLE_TEST_SRC
"internal/inline_variable_testing.h"
"inline_variable_test.cc"
"inline_variable_test_a.cc"
"inline_variable_test_b.cc"
)

set(INLINE_VARIABLE_TEST_PUBLIC_LIBRARIES absl::base)

absl_test(
TARGET
inline_variable_test
SOURCES
${INLINE_VARIABLE_TEST_SRC}
PUBLIC_LIBRARIES
${INLINE_VARIABLE_TEST_PUBLIC_LIBRARIES}
)


# test spinlock_test_common
set(SPINLOCK_TEST_COMMON_SRC "spinlock_test_common.cc")
set(SPINLOCK_TEST_COMMON_PUBLIC_LIBRARIES absl::base absl::synchronization)
Expand Down Expand Up @@ -319,6 +363,20 @@ absl_test(
${THREAD_IDENTITY_TEST_PUBLIC_LIBRARIES}
)

#test exceptions_safety_testing_test
set(EXCEPTION_SAFETY_TESTING_TEST_SRC "exception_safety_testing_test.cc")
set(EXCEPTION_SAFETY_TESTING_TEST_PUBLIC_LIBRARIES absl::base absl::memory absl::meta absl::strings absl::optional)

absl_test(
TARGET
absl_exception_safety_testing_test
SOURCES
${EXCEPTION_SAFETY_TESTING_TEST_SRC}
PUBLIC_LIBRARIES
${EXCEPTION_SAFETY_TESTING_TEST_PUBLIC_LIBRARIES}
PRIVATE_COMPILE_FLAGS
${ABSL_EXCEPTIONS_FLAG}
)

# test absl_malloc_extension_system_malloc_test
set(MALLOC_EXTENSION_SYSTEM_MALLOC_TEST_SRC "internal/malloc_extension_test.cc")
Expand Down
15 changes: 15 additions & 0 deletions Firestore/third_party/abseil-cpp/absl/base/attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,18 @@
#define ABSL_ATTRIBUTE_NO_SANITIZE_CFI
#endif

// ABSL_ATTRIBUTE_RETURNS_NONNULL
//
// Tells the compiler that a particular function never returns a null pointer.
#if ABSL_HAVE_ATTRIBUTE(returns_nonnull) || \
(defined(__GNUC__) && \
(__GNUC__ > 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)) && \
!defined(__clang__))
#define ABSL_ATTRIBUTE_RETURNS_NONNULL __attribute__((returns_nonnull))
#else
#define ABSL_ATTRIBUTE_RETURNS_NONNULL
#endif

// ABSL_HAVE_ATTRIBUTE_SECTION
//
// Indicates whether labeled sections are supported. Labeled sections are not
Expand All @@ -305,6 +317,7 @@
__attribute__((section(#name))) __attribute__((noinline))
#endif


// ABSL_ATTRIBUTE_SECTION_VARIABLE
//
// Tells the compiler/linker to put a given variable into a section and define
Expand Down Expand Up @@ -344,6 +357,7 @@
(reinterpret_cast<void *>(__start_##name))
#define ABSL_ATTRIBUTE_SECTION_STOP(name) \
(reinterpret_cast<void *>(__stop_##name))

#else // !ABSL_HAVE_ATTRIBUTE_SECTION

#define ABSL_HAVE_ATTRIBUTE_SECTION 0
Expand All @@ -356,6 +370,7 @@
#define ABSL_DECLARE_ATTRIBUTE_SECTION_VARS(name)
#define ABSL_ATTRIBUTE_SECTION_START(name) (reinterpret_cast<void *>(0))
#define ABSL_ATTRIBUTE_SECTION_STOP(name) (reinterpret_cast<void *>(0))

#endif // ABSL_ATTRIBUTE_SECTION

// ABSL_ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC
Expand Down
41 changes: 22 additions & 19 deletions Firestore/third_party/abseil-cpp/absl/base/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,10 @@
// supported.
#ifdef ABSL_HAVE_THREAD_LOCAL
#error ABSL_HAVE_THREAD_LOCAL cannot be directly set
#elif !defined(__apple_build_version__) || \
((__apple_build_version__ >= 8000042) && \
!(TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0))
#elif (!defined(__apple_build_version__) || \
(__apple_build_version__ >= 8000042)) && \
!(defined(__APPLE__) && TARGET_OS_IPHONE && \
__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0)
// Notes: Xcode's clang did not support `thread_local` until version
// 8, and even then not for all iOS < 9.0.
#define ABSL_HAVE_THREAD_LOCAL 1
Expand Down Expand Up @@ -181,21 +182,21 @@
// __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(__clang__) && defined(__SIZEOF_INT128__) && \
!defined(__aarch64__)) || \
(defined(__CUDACC__) && defined(__SIZEOF_INT128__) && \
__CUDACC_VER_MAJOR__ >= 9) || \
(!defined(__clang__) && !defined(__CUDACC__) && defined(__GNUC__) && \
defined(__SIZEOF_INT128__))
#elif defined(__SIZEOF_INT128__)
#if (defined(__clang__) && !defined(__aarch64__)) || \
(defined(__CUDACC__) && __CUDACC_VER_MAJOR__ >= 9) || \
(!defined(__clang__) && !defined(__CUDACC__) && defined(__GNUC__))
#define ABSL_HAVE_INTRINSIC_INT128 1
#elif defined(__CUDACC__)
// __CUDACC_VER__ is a full version number before CUDA 9, and is defined to a
// std::string explaining that it has been removed starting with CUDA 9. We can't
// compare both variants in a single boolean expression because there is no
// short-circuiting in the preprocessor.
#elif defined(__CUDACC__) && defined(__SIZEOF_INT128__) && \
__CUDACC_VER__ >= 7000
// std::string explaining that it has been removed starting with CUDA 9. We use
// nested #ifs because there is no short-circuiting in the preprocessor.
// NOTE: `__CUDACC__` could be undefined while `__CUDACC_VER__` is defined.
#if __CUDACC_VER__ >= 70000
#define ABSL_HAVE_INTRINSIC_INT128 1
#endif
#endif // __CUDACC_VER__ >= 70000
#endif // defined(__CUDACC__)
#endif // ABSL_HAVE_INTRINSIC_INT128

// ABSL_HAVE_EXCEPTIONS
//
Expand Down Expand Up @@ -243,7 +244,7 @@
// Windows _WIN32
// NaCL __native_client__
// AsmJS __asmjs__
// Fuschia __Fuchsia__
// Fuchsia __Fuchsia__
//
// Note that since Android defines both __ANDROID__ and __linux__, one
// may probe for either Linux or Android by simply testing for __linux__.
Expand All @@ -254,8 +255,9 @@
// POSIX.1-2001.
#ifdef ABSL_HAVE_MMAP
#error ABSL_HAVE_MMAP cannot be directly set
#elif defined(__linux__) || defined(__APPLE__) || defined(__ros__) || \
defined(__native_client__) || defined(__asmjs__) || defined(__Fuchsia__)
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(__ros__) || defined(__native_client__) || defined(__asmjs__) || \
defined(__Fuchsia__)
#define ABSL_HAVE_MMAP 1
#endif

Expand All @@ -265,7 +267,8 @@
// functions as defined in POSIX.1-2001.
#ifdef ABSL_HAVE_PTHREAD_GETSCHEDPARAM
#error ABSL_HAVE_PTHREAD_GETSCHEDPARAM cannot be directly set
#elif defined(__linux__) || defined(__APPLE__) || defined(__ros__)
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(__ros__)
#define ABSL_HAVE_PTHREAD_GETSCHEDPARAM 1
#endif

Expand Down
2 changes: 2 additions & 0 deletions Firestore/third_party/abseil-cpp/absl/base/internal/endian.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#elif defined(__APPLE__)
// Mac OS X / Darwin features
#include <libkern/OSByteOrder.h>
#elif defined(__FreeBSD__)
#include <sys/endian.h>
#elif defined(__GLIBC__)
#include <byteswap.h> // IWYU pragma: export
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "absl/base/config.h"
#include "absl/base/internal/atomic_hook.h"
#include "absl/base/internal/log_severity.h"
#include "absl/base/log_severity.h"

// We know how to perform low-level writes to stderr in POSIX and Windows. For
// these platforms, we define the token ABSL_LOW_LEVEL_WRITE_SUPPORTED.
Expand All @@ -34,7 +34,8 @@
//
// 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(__Fuchsia__)
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(__Fuchsia__)
#include <unistd.h>


Expand All @@ -47,7 +48,7 @@
// ABSL_HAVE_SYSCALL_WRITE is defined when the platform provides the syscall
// syscall(SYS_write, /*int*/ fd, /*char* */ buf, /*size_t*/ len);
// for low level operations that want to avoid libc.
#if defined(__linux__) && !defined(__ANDROID__)
#if (defined(__linux__) || defined(__FreeBSD__)) && !defined(__ANDROID__)
#include <sys/syscall.h>
#define ABSL_HAVE_SYSCALL_WRITE 1
#define ABSL_LOW_LEVEL_WRITE_SUPPORTED 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#define ABSL_BASE_INTERNAL_RAW_LOGGING_H_

#include "absl/base/attributes.h"
#include "absl/base/internal/log_severity.h"
#include "absl/base/log_severity.h"
#include "absl/base/macros.h"
#include "absl/base/port.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ inline void UnalignedStore64(void *p, uint64_t v) {
// and 32-bit values (not 64-bit); older versions either raise a fatal signal,
// do an unaligned read and rotate the words around a bit, or do the reads very
// slowly (trip through kernel mode). There's no simple #define that says just
// ARMv7 or higher, so we have to filter away all ARMv5 and ARMv6
// "ARMv7 or higher", so we have to filter away all ARMv5 and ARMv6
// sub-architectures. Newer gcc (>= 4.6) set an __ARM_FEATURE_ALIGNED #define,
// so in time, maybe we can move on to that.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#ifndef ABSL_BASE_INTERNAL_LOG_SEVERITY_H_
#define ABSL_BASE_INTERNAL_LOG_SEVERITY_H_

#include <array>

#include "absl/base/attributes.h"

namespace absl {
Expand All @@ -27,6 +29,13 @@ enum class LogSeverity : int {
kFatal = 3,
};

// Returns an iterable of all standard `absl::LogSeverity` values, ordered from
// least to most severe.
constexpr std::array<absl::LogSeverity, 4> LogSeverities() {
return {{absl::LogSeverity::kInfo, absl::LogSeverity::kWarning,
absl::LogSeverity::kError, absl::LogSeverity::kFatal}};
}

constexpr const char* LogSeverityName(absl::LogSeverity s) {
return s == absl::LogSeverity::kInfo
? "INFO"
Expand All @@ -37,7 +46,7 @@ constexpr const char* LogSeverityName(absl::LogSeverity s) {
: s == absl::LogSeverity::kFatal ? "FATAL" : "UNKNOWN";
}

// Note that out-of-range large severities normalize to kError, not kFatal.
// Note that out-of-range severities normalize to kInfo or kError, never kFatal.
constexpr absl::LogSeverity NormalizeLogSeverity(absl::LogSeverity s) {
return s < absl::LogSeverity::kInfo
? absl::LogSeverity::kInfo
Expand Down
Loading