From a4d2614d73ccea3bac9dbade6b13326cbfc8cabc Mon Sep 17 00:00:00 2001 From: Gil Date: Mon, 11 Dec 2017 19:50:14 -0800 Subject: Remove prerelease abseil code (#558) * Add abseil bits to the iOS build * Migrate from prerelease to published abseil bits in ordered_code * Remove prerelease abseil code --- FirebaseFirestore.podspec | 12 +- Firestore/Port/absl/absl_attributes.h | 644 ------------------------------ Firestore/Port/absl/absl_config.h | 306 -------------- Firestore/Port/absl/absl_endian.h | 342 ---------------- Firestore/Port/absl/absl_integral_types.h | 148 ------- Firestore/Port/absl/absl_port.h | 535 ------------------------- Firestore/Port/ordered_code.cc | 12 +- 7 files changed, 16 insertions(+), 1983 deletions(-) delete mode 100644 Firestore/Port/absl/absl_attributes.h delete mode 100644 Firestore/Port/absl/absl_config.h delete mode 100644 Firestore/Port/absl/absl_endian.h delete mode 100644 Firestore/Port/absl/absl_integral_types.h delete mode 100644 Firestore/Port/absl/absl_port.h diff --git a/FirebaseFirestore.podspec b/FirebaseFirestore.podspec index ed7346c..eabac1e 100644 --- a/FirebaseFirestore.podspec +++ b/FirebaseFirestore.podspec @@ -33,7 +33,8 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling, 'Firestore/Port/**/*', 'Firestore/Protos/objc/**/*.[hm]', 'Firestore/core/src/**/*.{h,cc}', - 'Firestore/third_party/Immutable/*.[mh]' + 'Firestore/third_party/Immutable/*.[mh]', + 'Firestore/third_party/abseil-cpp/absl/*.{h,cc}' ] s.requires_arc = [ 'Firestore/Source/**/*', @@ -54,9 +55,10 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling, s.frameworks = 'MobileCoreServices' s.library = 'c++' s.pod_target_xcconfig = { - 'GCC_PREPROCESSOR_DEFINITIONS' => - 'GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1 ', - 'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"', - 'OTHER_CFLAGS' => '-DFIRFirestore_VERSION=' + s.version.to_s + 'GCC_PREPROCESSOR_DEFINITIONS' => 'GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1 ', + 'HEADER_SEARCH_PATHS' => + '"${PODS_TARGET_SRCROOT}" ' + + '"${PODS_TARGET_SRCROOT}/Firestore/third_party/abseil-cpp"', + 'OTHER_CFLAGS' => '-DFIRFirestore_VERSION=' + s.version.to_s } end diff --git a/Firestore/Port/absl/absl_attributes.h b/Firestore/Port/absl/absl_attributes.h deleted file mode 100644 index d43930c..0000000 --- a/Firestore/Port/absl/absl_attributes.h +++ /dev/null @@ -1,644 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Various macros for C++ attributes -// Most macros here are exposing GCC or Clang features, and are stubbed out for -// other compilers. -// GCC attributes documentation: -// https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Function-Attributes.html -// https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Variable-Attributes.html -// https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Type-Attributes.html -// -// Most attributes in this file are already supported by GCC 4.7. -// However, some of them are not supported in older version of Clang. -// Thus, we check __has_attribute() first. If the check fails, we check if we -// are on GCC and assume the attribute exists on GCC (which is verified on GCC -// 4.7). -// -// For sanitizer-related attributes, define the following macros -// using -D along with the given value for -fsanitize: -// - ADDRESS_SANITIZER with -fsanitize=address (GCC 4.8+, Clang) -// - MEMORY_SANITIZER with -fsanitize=memory (Clang) -// - THREAD_SANITIZER with -fsanitize=thread (GCC 4.8+, Clang) -// - UNDEFINED_BEHAVIOR_SANITIZER with -fsanitize=undefined (GCC 4.9+, Clang) -// - CONTROL_FLOW_INTEGRITY with -fsanitize=cfi (Clang) -// Since these are only supported by GCC and Clang now, we only check for -// __GNUC__ (GCC or Clang) and the above macros. -#ifndef THIRD_PARTY_ABSL_BASE_ATTRIBUTES_H_ -#define THIRD_PARTY_ABSL_BASE_ATTRIBUTES_H_ - -// ABSL_HAVE_ATTRIBUTE is a function-like feature checking macro. -// It's a wrapper around __has_attribute, which is defined by GCC 5+ and Clang. -// It evaluates to a nonzero constant integer if the attribute is supported -// or 0 if not. -// It evaluates to zero if __has_attribute is not defined by the compiler. -// GCC: https://gcc.gnu.org/gcc-5/changes.html -// Clang: https://clang.llvm.org/docs/LanguageExtensions.html -#ifdef __has_attribute -#define ABSL_HAVE_ATTRIBUTE(x) __has_attribute(x) -#else -#define ABSL_HAVE_ATTRIBUTE(x) 0 -#endif - -// ABSL_HAVE_CPP_ATTRIBUTE is a function-like feature checking macro that -// accepts C++11 style attributes. It's a wrapper around __has_cpp_attribute, -// defined by ISO C++ SD-6 -// (http://en.cppreference.com/w/cpp/experimental/feature_test). If we don't -// find __has_cpp_attribute, will evaluate to 0. -#if defined(__cplusplus) && defined(__has_cpp_attribute) -// NOTE: requiring __cplusplus above should not be necessary, but -// works around https://bugs.llvm.org/show_bug.cgi?id=23435. -#define ABSL_HAVE_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) -#else -#define ABSL_HAVE_CPP_ATTRIBUTE(x) 0 -#endif - -// ----------------------------------------------------------------------------- -// Function Attributes -// ----------------------------------------------------------------------------- -// GCC: https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html -// Clang: https://clang.llvm.org/docs/AttributeReference.html - -// PRINTF_ATTRIBUTE, SCANF_ATTRIBUTE -// Tell the compiler to do printf format std::string checking if the -// compiler supports it; see the 'format' attribute in -// . -// -// N.B.: As the GCC manual states, "[s]ince non-static C++ methods -// have an implicit 'this' argument, the arguments of such methods -// should be counted from two, not one." -#if ABSL_HAVE_ATTRIBUTE(format) || (defined(__GNUC__) && !defined(__clang__)) -#define ABSL_PRINTF_ATTRIBUTE(string_index, first_to_check) \ - __attribute__((__format__(__printf__, string_index, first_to_check))) -#define ABSL_SCANF_ATTRIBUTE(string_index, first_to_check) \ - __attribute__((__format__(__scanf__, string_index, first_to_check))) -#else -#define ABSL_PRINTF_ATTRIBUTE(string_index, first_to_check) -#define ABSL_SCANF_ATTRIBUTE(string_index, first_to_check) -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(format) || (defined(__GNUC__) && !defined(__clang__)) -#define PRINTF_ATTRIBUTE(string_index, first_to_check) \ - __attribute__((__format__(__printf__, string_index, first_to_check))) -#define SCANF_ATTRIBUTE(string_index, first_to_check) \ - __attribute__((__format__(__scanf__, string_index, first_to_check))) -#else -#define PRINTF_ATTRIBUTE(string_index, first_to_check) -#define SCANF_ATTRIBUTE(string_index, first_to_check) -#endif - -// ATTRIBUTE_ALWAYS_INLINE, ATTRIBUTE_NOINLINE -// For functions we want to force inline or not inline. -// Introduced in gcc 3.1. -#if ABSL_HAVE_ATTRIBUTE(always_inline) || (defined(__GNUC__) && !defined(__clang__)) -#define ABSL_ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline)) -#define ABSL_HAVE_ATTRIBUTE_ALWAYS_INLINE 1 -#else -#define ABSL_ATTRIBUTE_ALWAYS_INLINE -#endif - -#if ABSL_HAVE_ATTRIBUTE(noinline) || (defined(__GNUC__) && !defined(__clang__)) -#define ABSL_ATTRIBUTE_NOINLINE __attribute__((noinline)) -#define ABSL_HAVE_ATTRIBUTE_NOINLINE 1 -#else -#define ABSL_ATTRIBUTE_NOINLINE -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(always_inline) || (defined(__GNUC__) && !defined(__clang__)) -#define ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline)) -#define HAVE_ATTRIBUTE_ALWAYS_INLINE 1 -#else -#define ATTRIBUTE_ALWAYS_INLINE -#endif - -#if ABSL_HAVE_ATTRIBUTE(noinline) || (defined(__GNUC__) && !defined(__clang__)) -#define ATTRIBUTE_NOINLINE __attribute__((noinline)) -#define HAVE_ATTRIBUTE_NOINLINE 1 -#else -#define ATTRIBUTE_NOINLINE -#endif - -// ATTRIBUTE_NO_TAIL_CALL -// Prevent the compiler from optimizing away stack frames for functions which -// end in a call to another function. -#if ABSL_HAVE_ATTRIBUTE(disable_tail_calls) -#define ABSL_HAVE_ATTRIBUTE_NO_TAIL_CALL 1 -#define ABSL_ATTRIBUTE_NO_TAIL_CALL __attribute__((disable_tail_calls)) -#elif defined(__GNUC__) && !defined(__clang__) -#define ABSL_HAVE_ATTRIBUTE_NO_TAIL_CALL 1 -#define ABSL_ATTRIBUTE_NO_TAIL_CALL __attribute__((optimize("no-optimize-sibling-calls"))) -#else -#define ABSL_ATTRIBUTE_NO_TAIL_CALL -#define ABSL_HAVE_ATTRIBUTE_NO_TAIL_CALL 0 -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(disable_tail_calls) -#define HAVE_ATTRIBUTE_NO_TAIL_CALL 1 -#define ATTRIBUTE_NO_TAIL_CALL __attribute__((disable_tail_calls)) -#elif defined(__GNUC__) && !defined(__clang__) -#define HAVE_ATTRIBUTE_NO_TAIL_CALL 1 -#define ATTRIBUTE_NO_TAIL_CALL __attribute__((optimize("no-optimize-sibling-calls"))) -#else -#define ATTRIBUTE_NO_TAIL_CALL -#define HAVE_ATTRIBUTE_NO_TAIL_CALL 0 -#endif - -// ATTRIBUTE_WEAK -// For weak functions -#if ABSL_HAVE_ATTRIBUTE(weak) || (defined(__GNUC__) && !defined(__clang__)) -#undef ABSL_ATTRIBUTE_WEAK -#define ABSL_ATTRIBUTE_WEAK __attribute__((weak)) -#define ABSL_HAVE_ATTRIBUTE_WEAK 1 -#else -#define ABSL_ATTRIBUTE_WEAK -#define ABSL_HAVE_ATTRIBUTE_WEAK 0 -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(weak) || (defined(__GNUC__) && !defined(__clang__)) -#undef ATTRIBUTE_WEAK -#define ATTRIBUTE_WEAK __attribute__((weak)) -#define HAVE_ATTRIBUTE_WEAK 1 -#else -#define ATTRIBUTE_WEAK -#define HAVE_ATTRIBUTE_WEAK 0 -#endif - -// ATTRIBUTE_NONNULL -// Tell the compiler either that a particular function parameter -// should be a non-null pointer, or that all pointer arguments should -// be non-null. -// -// Note: As the GCC manual states, "[s]ince non-static C++ methods -// have an implicit 'this' argument, the arguments of such methods -// should be counted from two, not one." -// -// Args are indexed starting at 1. -// For non-static class member functions, the implicit "this" argument -// is arg 1, and the first explicit argument is arg 2. -// For static class member functions, there is no implicit "this", and -// the first explicit argument is arg 1. -// -// /* arg_a cannot be null, but arg_b can */ -// void Function(void* arg_a, void* arg_b) ATTRIBUTE_NONNULL(1); -// -// class C { -// /* arg_a cannot be null, but arg_b can */ -// void Method(void* arg_a, void* arg_b) ATTRIBUTE_NONNULL(2); -// -// /* arg_a cannot be null, but arg_b can */ -// static void StaticMethod(void* arg_a, void* arg_b) ATTRIBUTE_NONNULL(1); -// }; -// -// If no arguments are provided, then all pointer arguments should be non-null. -// -// /* No pointer arguments may be null. */ -// void Function(void* arg_a, void* arg_b, int arg_c) ATTRIBUTE_NONNULL(); -// -// NOTE: The GCC nonnull attribute actually accepts a list of arguments, but -// ATTRIBUTE_NONNULL does not. -#if ABSL_HAVE_ATTRIBUTE(nonnull) || (defined(__GNUC__) && !defined(__clang__)) -#define ABSL_ATTRIBUTE_NONNULL(arg_index) __attribute__((nonnull(arg_index))) -#else -#define ABSL_ATTRIBUTE_NONNULL(...) -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(nonnull) || (defined(__GNUC__) && !defined(__clang__)) -#define ATTRIBUTE_NONNULL(arg_index) __attribute__((nonnull(arg_index))) -#else -#define ATTRIBUTE_NONNULL(...) -#endif - -// ATTRIBUTE_NORETURN -// Tell the compiler that a given function never returns -#if ABSL_HAVE_ATTRIBUTE(noreturn) || (defined(__GNUC__) && !defined(__clang__)) -#define ABSL_ATTRIBUTE_NORETURN __attribute__((noreturn)) -#elif defined(_MSC_VER) -#define ABSL_ATTRIBUTE_NORETURN __declspec(noreturn) -#else -#define ABSL_ATTRIBUTE_NORETURN -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(noreturn) || (defined(__GNUC__) && !defined(__clang__)) -#define ATTRIBUTE_NORETURN __attribute__((noreturn)) -#elif defined(_MSC_VER) -#define ATTRIBUTE_NORETURN __declspec(noreturn) -#else -#define ATTRIBUTE_NORETURN -#endif - -// ATTRIBUTE_NO_SANITIZE_ADDRESS -// Tell AddressSanitizer (or other memory testing tools) to ignore a given -// function. Useful for cases when a function reads random locations on stack, -// calls _exit from a cloned subprocess, deliberately accesses buffer -// out of bounds or does other scary things with memory. -// NOTE: GCC supports AddressSanitizer(asan) since 4.8. -// https://gcc.gnu.org/gcc-4.8/changes.html -#if defined(__GNUC__) && defined(ADDRESS_SANITIZER) -#define ABSL_ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address)) -#else -#define ABSL_ATTRIBUTE_NO_SANITIZE_ADDRESS -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if defined(__GNUC__) && defined(ADDRESS_SANITIZER) -#define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address)) -#else -#define ATTRIBUTE_NO_SANITIZE_ADDRESS -#endif - -// ATTRIBUTE_NO_SANITIZE_MEMORY -// Tell MemorySanitizer to relax the handling of a given function. All "Use of -// uninitialized value" warnings from such functions will be suppressed, and all -// values loaded from memory will be considered fully initialized. -// This is similar to the ADDRESS_SANITIZER attribute above, but deals with -// initializedness rather than addressability issues. -// NOTE: MemorySanitizer(msan) is supported by Clang but not GCC. -#if defined(__GNUC__) && defined(MEMORY_SANITIZER) -#define ABSL_ATTRIBUTE_NO_SANITIZE_MEMORY __attribute__((no_sanitize_memory)) -#else -#define ABSL_ATTRIBUTE_NO_SANITIZE_MEMORY -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if defined(__GNUC__) && defined(MEMORY_SANITIZER) -#define ATTRIBUTE_NO_SANITIZE_MEMORY __attribute__((no_sanitize_memory)) -#else -#define ATTRIBUTE_NO_SANITIZE_MEMORY -#endif - -// ATTRIBUTE_NO_SANITIZE_THREAD -// Tell ThreadSanitizer to not instrument a given function. -// If you are adding this attribute, please cc dynamic-tools@ on the cl. -// NOTE: GCC supports ThreadSanitizer(tsan) since 4.8. -// https://gcc.gnu.org/gcc-4.8/changes.html -#if defined(__GNUC__) && defined(THREAD_SANITIZER) -#define ABSL_ATTRIBUTE_NO_SANITIZE_THREAD __attribute__((no_sanitize_thread)) -#else -#define ABSL_ATTRIBUTE_NO_SANITIZE_THREAD -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if defined(__GNUC__) && defined(THREAD_SANITIZER) -#define ATTRIBUTE_NO_SANITIZE_THREAD __attribute__((no_sanitize_thread)) -#else -#define ATTRIBUTE_NO_SANITIZE_THREAD -#endif - -// ATTRIBUTE_NO_SANITIZE_UNDEFINED -// Tell UndefinedSanitizer to ignore a given function. Useful for cases -// where certain behavior (eg. devision by zero) is being used intentionally. -// NOTE: GCC supports UndefinedBehaviorSanitizer(ubsan) since 4.9. -// https://gcc.gnu.org/gcc-4.9/changes.html -#if defined(__GNUC__) && defined(UNDEFINED_BEHAVIOR_SANITIZER) -#define ABSL_ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize("undefined"))) -#else -#define ABSL_ATTRIBUTE_NO_SANITIZE_UNDEFINED -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if defined(__GNUC__) && defined(UNDEFINED_BEHAVIOR_SANITIZER) -#define ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize("undefined"))) -#else -#define ATTRIBUTE_NO_SANITIZE_UNDEFINED -#endif - -// ATTRIBUTE_NO_SANITIZE_CFI -// Tell ControlFlowIntegrity sanitizer to not instrument a given function. -#if defined(__GNUC__) && defined(CONTROL_FLOW_INTEGRITY) -#define ABSL_ATTRIBUTE_NO_SANITIZE_CFI __attribute__((no_sanitize("cfi"))) -#else -#define ABSL_ATTRIBUTE_NO_SANITIZE_CFI -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if defined(__GNUC__) && defined(CONTROL_FLOW_INTEGRITY) -#define ATTRIBUTE_NO_SANITIZE_CFI __attribute__((no_sanitize("cfi"))) -#else -#define ATTRIBUTE_NO_SANITIZE_CFI -#endif - -// ATTRIBUTE_SECTION -// Labeled sections are not supported on Darwin/iOS. -#ifdef ABSL_HAVE_ATTRIBUTE_SECTION -#error ABSL_HAVE_ATTRIBUTE_SECTION cannot be directly set -#elif (ABSL_HAVE_ATTRIBUTE(section) || (defined(__GNUC__) && !defined(__clang__))) && \ - !(defined(__APPLE__) && defined(__MACH__)) -#define ABSL_HAVE_ATTRIBUTE_SECTION 1 -// -// Tell the compiler/linker to put a given function into a section and define -// "__start_ ## name" and "__stop_ ## name" symbols to bracket the section. -// This functionality is supported by GNU linker. -// Any function with ATTRIBUTE_SECTION must not be inlined, or it will -// be placed into whatever section its caller is placed into. -// -#ifndef ABSL_ATTRIBUTE_SECTION -#define ABSL_ATTRIBUTE_SECTION(name) __attribute__((section(#name))) __attribute__((noinline)) -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#ifndef ATTRIBUTE_SECTION -#define ATTRIBUTE_SECTION(name) __attribute__((section(#name))) __attribute__((noinline)) -#endif - -// Tell the compiler/linker to put a given variable into a section and define -// "__start_ ## name" and "__stop_ ## name" symbols to bracket the section. -// This functionality is supported by GNU linker. -#ifndef ABSL_ATTRIBUTE_SECTION_VARIABLE -#define ABSL_ATTRIBUTE_SECTION_VARIABLE(name) __attribute__((section(#name))) -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#ifndef ATTRIBUTE_SECTION_VARIABLE -#define ATTRIBUTE_SECTION_VARIABLE(name) __attribute__((section(#name))) -#endif - -// -// Weak section declaration to be used as a global declaration -// for ATTRIBUTE_SECTION_START|STOP(name) to compile and link -// even without functions with ATTRIBUTE_SECTION(name). -// DEFINE_ATTRIBUTE_SECTION should be in the exactly one file; it's -// a no-op on ELF but not on Mach-O. -// -#ifndef ABSL_DECLARE_ATTRIBUTE_SECTION_VARS -#define ABSL_DECLARE_ATTRIBUTE_SECTION_VARS(name) \ - extern char __start_##name[] ATTRIBUTE_WEAK; \ - extern char __stop_##name[] ATTRIBUTE_WEAK -#endif -#ifndef ABSL_DEFINE_ATTRIBUTE_SECTION_VARS -#define ABSL_INIT_ATTRIBUTE_SECTION_VARS(name) -#define ABSL_DEFINE_ATTRIBUTE_SECTION_VARS(name) -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#ifndef DECLARE_ATTRIBUTE_SECTION_VARS -#define DECLARE_ATTRIBUTE_SECTION_VARS(name) \ - extern char __start_##name[] ATTRIBUTE_WEAK; \ - extern char __stop_##name[] ATTRIBUTE_WEAK -#endif -#ifndef DEFINE_ATTRIBUTE_SECTION_VARS -#define INIT_ATTRIBUTE_SECTION_VARS(name) -#define DEFINE_ATTRIBUTE_SECTION_VARS(name) -#endif - -// -// Return void* pointers to start/end of a section of code with -// functions having ATTRIBUTE_SECTION(name). -// Returns 0 if no such functions exits. -// One must DECLARE_ATTRIBUTE_SECTION_VARS(name) for this to compile and link. -// -#define ABSL_ATTRIBUTE_SECTION_START(name) (reinterpret_cast(__start_##name)) -#define ABSL_ATTRIBUTE_SECTION_STOP(name) (reinterpret_cast(__stop_##name)) - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#define ATTRIBUTE_SECTION_START(name) (reinterpret_cast(__start_##name)) -#define ATTRIBUTE_SECTION_STOP(name) (reinterpret_cast(__stop_##name)) - -#else // !ABSL_HAVE_ATTRIBUTE_SECTION - -#define ABSL_HAVE_ATTRIBUTE_SECTION 0 - -// provide dummy definitions -#define ABSL_ATTRIBUTE_SECTION(name) -#define ABSL_ATTRIBUTE_SECTION_VARIABLE(name) -#define ABSL_INIT_ATTRIBUTE_SECTION_VARS(name) -#define ABSL_DEFINE_ATTRIBUTE_SECTION_VARS(name) -#define ABSL_DECLARE_ATTRIBUTE_SECTION_VARS(name) -#define ABSL_ATTRIBUTE_SECTION_START(name) (reinterpret_cast(0)) -#define ABSL_ATTRIBUTE_SECTION_STOP(name) (reinterpret_cast(0)) - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#define ATTRIBUTE_SECTION(name) -#define ATTRIBUTE_SECTION_VARIABLE(name) -#define INIT_ATTRIBUTE_SECTION_VARS(name) -#define DEFINE_ATTRIBUTE_SECTION_VARS(name) -#define DECLARE_ATTRIBUTE_SECTION_VARS(name) -#define ATTRIBUTE_SECTION_START(name) (reinterpret_cast(0)) -#define ATTRIBUTE_SECTION_STOP(name) (reinterpret_cast(0)) - -#endif // ATTRIBUTE_SECTION - -// ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC -// Support for aligning the stack on 32-bit x86. -#if ABSL_HAVE_ATTRIBUTE(force_align_arg_pointer) || (defined(__GNUC__) && !defined(__clang__)) -#if defined(__i386__) -#define ABSL_ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC __attribute__((force_align_arg_pointer)) -#define ABSL_REQUIRE_STACK_ALIGN_TRAMPOLINE (0) -#elif defined(__x86_64__) -#define ABSL_REQUIRE_STACK_ALIGN_TRAMPOLINE (1) -#define ABSL_ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC -#else // !__i386__ && !__x86_64 -#define ABSL_REQUIRE_STACK_ALIGN_TRAMPOLINE (0) -#define ABSL_ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC -#endif // __i386__ -#else -#define ABSL_ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC -#define ABSL_REQUIRE_STACK_ALIGN_TRAMPOLINE (0) -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(force_align_arg_pointer) || (defined(__GNUC__) && !defined(__clang__)) -#if defined(__i386__) -#define ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC __attribute__((force_align_arg_pointer)) -#define REQUIRE_STACK_ALIGN_TRAMPOLINE (0) -#elif defined(__x86_64__) -#define REQUIRE_STACK_ALIGN_TRAMPOLINE (1) -#define ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC -#else // !__i386__ && !__x86_64 -#define REQUIRE_STACK_ALIGN_TRAMPOLINE (0) -#define ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC -#endif // __i386__ -#else -#define ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC -#define REQUIRE_STACK_ALIGN_TRAMPOLINE (0) -#endif - -// MUST_USE_RESULT -// Tell the compiler to warn about unused return values for functions declared -// with this macro. The macro must appear as the very first part of a function -// declaration or definition: -// -// MUST_USE_RESULT Sprocket* AllocateSprocket(); -// -// This placement has the broadest compatibility with GCC, Clang, and MSVC, with -// both defs and decls, and with GCC-style attributes, MSVC declspec, and C++11 -// attributes. Note: past advice was to place the macro after the argument list. -#if ABSL_HAVE_ATTRIBUTE(warn_unused_result) || (defined(__GNUC__) && !defined(__clang__)) -#define ABSL_MUST_USE_RESULT __attribute__((warn_unused_result)) -#else -#define ABSL_MUST_USE_RESULT -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(warn_unused_result) || (defined(__GNUC__) && !defined(__clang__)) -#define MUST_USE_RESULT __attribute__((warn_unused_result)) -#else -#define MUST_USE_RESULT -#endif - -// ATTRIBUTE_HOT, ATTRIBUTE_COLD -// Tell GCC that a function is hot or cold. GCC can use this information to -// improve static analysis, i.e. a conditional branch to a cold function -// is likely to be not-taken. -// This annotation is used for function declarations, e.g.: -// int foo() ATTRIBUTE_HOT; -#if ABSL_HAVE_ATTRIBUTE(hot) || (defined(__GNUC__) && !defined(__clang__)) -#define ABSL_ATTRIBUTE_HOT __attribute__((hot)) -#else -#define ABSL_ATTRIBUTE_HOT -#endif - -#if ABSL_HAVE_ATTRIBUTE(cold) || (defined(__GNUC__) && !defined(__clang__)) -#define ABSL_ATTRIBUTE_COLD __attribute__((cold)) -#else -#define ABSL_ATTRIBUTE_COLD -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(hot) || (defined(__GNUC__) && !defined(__clang__)) -#define ATTRIBUTE_HOT __attribute__((hot)) -#else -#define ATTRIBUTE_HOT -#endif - -#if ABSL_HAVE_ATTRIBUTE(cold) || (defined(__GNUC__) && !defined(__clang__)) -#define ATTRIBUTE_COLD __attribute__((cold)) -#else -#define ATTRIBUTE_COLD -#endif - -// ABSL_XRAY_ALWAYS_INSTRUMENT, ABSL_XRAY_NEVER_INSTRUMENT, ABSL_XRAY_LOG_ARGS -// -// We define the ABSL_XRAY_ALWAYS_INSTRUMENT and ABSL_XRAY_NEVER_INSTRUMENT -// macro used as an attribute to mark functions that must always or never be -// instrumented by XRay. Currently, this is only supported in Clang/LLVM. -// -// For reference on the LLVM XRay instrumentation, see -// http://llvm.org/docs/XRay.html. -// -// A function with the XRAY_ALWAYS_INSTRUMENT macro attribute in its declaration -// will always get the XRay instrumentation sleds. These sleds may introduce -// some binary size and runtime overhead and must be used sparingly. -// -// These attributes only take effect when the following conditions are met: -// -// - The file/target is built in at least C++11 mode, with a Clang compiler -// that supports XRay attributes. -// - The file/target is built with the -fxray-instrument flag set for the -// Clang/LLVM compiler. -// - The function is defined in the translation unit (the compiler honors the -// attribute in either the definition or the declaration, and must match). -// -// There are cases when, even when building with XRay instrumentation, users -// might want to control specifically which functions are instrumented for a -// particular build using special-case lists provided to the compiler. These -// special case lists are provided to Clang via the -// -fxray-always-instrument=... and -fxray-never-instrument=... flags. The -// attributes in source take precedence over these special-case lists. -// -// To disable the XRay attributes at build-time, users may define -// ABSL_NO_XRAY_ATTRIBUTES. Do NOT define ABSL_NO_XRAY_ATTRIBUTES on specific -// packages/targets, as this may lead to conflicting definitions of functions at -// link-time. -// -#if ABSL_HAVE_CPP_ATTRIBUTE(clang::xray_always_instrument) && !defined(ABSL_NO_XRAY_ATTRIBUTES) -#define ABSL_XRAY_ALWAYS_INSTRUMENT [[clang::xray_always_instrument]] -#define ABSL_XRAY_NEVER_INSTRUMENT [[clang::xray_never_instrument]] -#define ABSL_XRAY_LOG_ARGS(N) [[ clang::xray_always_instrument, clang::xray_log_args(N) ]] -#else -#define ABSL_XRAY_ALWAYS_INSTRUMENT -#define ABSL_XRAY_NEVER_INSTRUMENT -#define ABSL_XRAY_LOG_ARGS(N) -#endif - -// ----------------------------------------------------------------------------- -// Variable Attributes -// ----------------------------------------------------------------------------- - -// ATTRIBUTE_UNUSED -// Prevent the compiler from complaining about or optimizing away variables -// that appear unused. -#if ABSL_HAVE_ATTRIBUTE(unused) || (defined(__GNUC__) && !defined(__clang__)) -#undef ABSL_ATTRIBUTE_UNUSED -#define ABSL_ATTRIBUTE_UNUSED __attribute__((__unused__)) -#else -#define ABSL_ATTRIBUTE_UNUSED -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(unused) || (defined(__GNUC__) && !defined(__clang__)) -#undef ATTRIBUTE_UNUSED -#define ATTRIBUTE_UNUSED __attribute__((__unused__)) -#else -#define ATTRIBUTE_UNUSED -#endif - -// ATTRIBUTE_INITIAL_EXEC -// Tell the compiler to use "initial-exec" mode for a thread-local variable. -// See http://people.redhat.com/drepper/tls.pdf for the gory details. -#if ABSL_HAVE_ATTRIBUTE(tls_model) || (defined(__GNUC__) && !defined(__clang__)) -#define ABSL_ATTRIBUTE_INITIAL_EXEC __attribute__((tls_model("initial-exec"))) -#else -#define ABSL_ATTRIBUTE_INITIAL_EXEC -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(tls_model) || (defined(__GNUC__) && !defined(__clang__)) -#define ATTRIBUTE_INITIAL_EXEC __attribute__((tls_model("initial-exec"))) -#else -#define ATTRIBUTE_INITIAL_EXEC -#endif - -// ATTRIBUTE_PACKED -// Prevent the compiler from padding a structure to natural alignment -#if ABSL_HAVE_ATTRIBUTE(packed) || (defined(__GNUC__) && !defined(__clang__)) -#define ABSL_ATTRIBUTE_PACKED __attribute__((__packed__)) -#else -#define ABSL_ATTRIBUTE_PACKED -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(packed) || (defined(__GNUC__) && !defined(__clang__)) -#define ATTRIBUTE_PACKED __attribute__((__packed__)) -#else -#define ATTRIBUTE_PACKED -#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". -// -// Sample usage: -// -// ABSL_CONST_INIT static MyType my_var = MakeMyType(...); -// -// Note that this attribute is redundant if the variable is declared constexpr. -#if ABSL_HAVE_CPP_ATTRIBUTE(clang::require_constant_initialization) -// NOLINTNEXTLINE(whitespace/braces) (b/36288871) -#define ABSL_CONST_INIT [[clang::require_constant_initialization]] -#else -#define ABSL_CONST_INIT -#endif // ABSL_HAVE_CPP_ATTRIBUTE(clang::require_constant_initialization) - -#endif // THIRD_PARTY_ABSL_BASE_ATTRIBUTES_H_ diff --git a/Firestore/Port/absl/absl_config.h b/Firestore/Port/absl/absl_config.h deleted file mode 100644 index 70f4d86..0000000 --- a/Firestore/Port/absl/absl_config.h +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Defines preprocessor macros describing the presence of "features" available. -// This facilitates writing portable code by parameterizing the compilation -// based on the presence or lack of a feature. -// -// We define a feature as some interface we wish to program to: for example, -// some library function or system call. -// -// For example, suppose a programmer wants to write a program that uses the -// 'mmap' system call. Then one might write: -// -// #include "absl/base/config.h" -// -// #ifdef ABSL_HAVE_MMAP -// #include "sys/mman.h" -// #endif //ABSL_HAVE_MMAP -// -// ... -// #ifdef ABSL_HAVE_MMAP -// void *ptr = mmap(...); -// ... -// #endif // ABSL_HAVE_MMAP -// -// As a special note, using feature macros from config.h to determine whether -// to include a particular header requires violating the style guide's required -// ordering for headers: this is permitted. - -#ifndef THIRD_PARTY_ABSL_BASE_CONFIG_H_ -#define THIRD_PARTY_ABSL_BASE_CONFIG_H_ - -// Included for the __GLIBC__ macro (or similar macros on other systems). -#include - -#ifdef __cplusplus -// Included for __GLIBCXX__, _LIBCPP_VERSION -#include -#endif // __cplusplus - -// If we're using glibc, make sure we meet a minimum version requirement -// before we proceed much further. -// -// We have chosen glibc 2.12 as the minimum as it was tagged for release -// in May, 2010 and includes some functionality used in Google software -// (for instance pthread_setname_np): -// https://sourceware.org/ml/libc-alpha/2010-05/msg00000.html -#ifdef __GLIBC_PREREQ -#if !__GLIBC_PREREQ(2, 12) -#error "Minimum required version of glibc is 2.12." -#endif -#endif - -// ABSL_HAVE_BUILTIN is a function-like feature checking macro. -// It's a wrapper around __has_builtin, which is defined by only clang now. -// It evaluates to 1 if the builtin is supported or 0 if not. -// Define it to avoid an extra level of #ifdef __has_builtin check. -// http://releases.llvm.org/3.3/tools/clang/docs/LanguageExtensions.html -#ifdef __has_builtin -#define ABSL_HAVE_BUILTIN(x) __has_builtin(x) -#else -#define ABSL_HAVE_BUILTIN(x) 0 -#endif - -// ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE is defined when -// std::is_trivially_destructible is supported. -// -// All supported compilers using libc++ have it, as does gcc >= 4.8 -// using libstdc++, as does Visual Studio. -// https://gcc.gnu.org/onlinedocs/gcc-4.8.1/libstdc++/manual/manual/status.html#status.iso.2011 -// is the first version where std::is_trivially_destructible no longer -// appeared as missing in the Type properties row. -#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE -#error ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE cannot be directly set -#elif defined(_LIBCPP_VERSION) || \ - (!defined(__clang__) && defined(__GNUC__) && defined(__GLIBCXX__) && \ - (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) || \ - defined(_MSC_VER) -#define ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE 1 -#endif - -// ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE is defined when -// std::is_trivially_default_constructible and -// std::is_trivially_copy_constructible are supported. -// -// ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE is defined when -// std::is_trivially_copy_assignable is supported. -// -// Clang with libc++ supports it, as does gcc >= 5.1 with either -// libc++ or libstdc++, as does Visual Studio. -// https://gcc.gnu.org/gcc-5/changes.html lists as new -// "std::is_trivially_constructible, std::is_trivially_assignable -// etc." -#if defined(ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE) -#error ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE cannot be directly set -#elif defined(ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE) -#error ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE cannot directly set -#elif (defined(__clang__) && defined(_LIBCPP_VERSION)) || \ - (!defined(__clang__) && defined(__GNUC__) && \ - (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)) && \ - (defined(_LIBCPP_VERSION) || defined(__GLIBCXX__))) || \ - defined(_MSC_VER) -#define ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE 1 -#define ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE 1 -#endif - -// ABSL_HAVE_THREAD_LOCAL is defined when C++11's thread_local is available. -// Clang implements thread_local keyword but Xcode did not support the -// implementation until Xcode 8. -#ifdef ABSL_HAVE_THREAD_LOCAL -#error ABSL_HAVE_THREAD_LOCAL cannot be directly set -#elif !defined(__apple_build_version__) || __apple_build_version__ >= 8000042 -#define ABSL_HAVE_THREAD_LOCAL 1 -#endif - -// ABSL_HAVE_INTRINSIC_INT128 is defined when the implementation provides the -// 128 bit integral type: __int128. -// -// __SIZEOF_INT128__ is defined by Clang and GCC when __int128 is supported. -// Clang on ppc64 and aarch64 are exceptions where __int128 exists but has a -// sporadic compiler crashing bug. Nvidia's nvcc also defines __GNUC__ and -// __SIZEOF_INT128__ but not all versions that do this support __int128. Support -// has been tested for versions >= 7. -#ifdef ABSL_HAVE_INTRINSIC_INT128 -#error ABSL_HAVE_INTRINSIC_INT128 cannot be directly set -#elif (defined(__clang__) && defined(__SIZEOF_INT128__) && !defined(__ppc64__) && \ - !defined(__aarch64__)) || \ - (defined(__CUDACC__) && defined(__SIZEOF_INT128__) && __CUDACC_VER__ >= 70000) || \ - (!defined(__clang__) && !defined(__CUDACC__) && defined(__GNUC__) && \ - defined(__SIZEOF_INT128__)) -#define ABSL_HAVE_INTRINSIC_INT128 1 -#endif - -// Operating system-specific features. -// -// Currently supported operating systems and associated preprocessor -// symbols: -// -// Linux and Linux-derived __linux__ -// Android __ANDROID__ (implies __linux__) -// Linux (non-Android) __linux__ && !__ANDROID__ -// Darwin (Mac OS X and iOS) __APPLE__ && __MACH__ -// Akaros (http://akaros.org) __ros__ -// Windows _WIN32 -// NaCL __native_client__ -// AsmJS __asmjs__ -// Fuschia __Fuchsia__ -// -// Note that since Android defines both __ANDROID__ and __linux__, one -// may probe for either Linux or Android by simply testing for __linux__. -// - -// ABSL_HAVE_MMAP is defined when the system has an mmap(2) implementation -// as defined in POSIX.1-2001. -#ifdef ABSL_HAVE_MMAP -#error ABSL_HAVE_MMAP cannot be directly set -#elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__ros__) || \ - defined(__native_client__) || defined(__asmjs__) || defined(__Fuchsia__) -#define ABSL_HAVE_MMAP 1 -#endif - -// ABSL_HAS_PTHREAD_GETSCHEDPARAM is defined when the system implements the -// pthread_(get|set)schedparam(3) 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(__MACH__)) || defined(__ros__) -#define ABSL_HAVE_PTHREAD_GETSCHEDPARAM 1 -#endif - -// ABSL_HAVE_SCHED_YIELD is defined when the system implements -// sched_yield(2) as defined in POSIX.1-2001. -#ifdef ABSL_HAVE_SCHED_YIELD -#error ABSL_HAVE_SCHED_YIELD cannot be directly set -#elif defined(__linux__) || defined(__ros__) || defined(__native_client__) -#define ABSL_HAVE_SCHED_YIELD 1 -#endif - -// ABSL_HAVE_SEMAPHORE_H is defined when the system supports the -// header and sem_open(3) family of functions as standardized in POSIX.1-2001. -// -// Note: While Apple does have for both iOS and macOS, it is -// explicity deprecated and will cause build failures if enabled for those -// systems. We side-step the issue by not defining it here for Apple platforms. -#ifdef ABSL_HAVE_SEMAPHORE_H -#error ABSL_HAVE_SEMAPHORE_H cannot be directly set -#elif defined(__linux__) || defined(__ros__) -#define ABSL_HAVE_SEMAPHORE_H 1 -#endif - -// Library-specific features. -#ifdef ABSL_HAVE_ALARM -#error ABSL_HAVE_ALARM cannot be directly set -#elif defined(__GOOGLE_GRTE_VERSION__) -// feature tests for Google's GRTE -#define ABSL_HAVE_ALARM 1 -#elif defined(__GLIBC__) -// feature test for glibc -#define ABSL_HAVE_ALARM 1 -#elif defined(_MSC_VER) -// feature tests for Microsoft's library -#elif defined(__native_client__) -#else -// other standard libraries -#define ABSL_HAVE_ALARM 1 -#endif - -#if defined(_STLPORT_VERSION) -#error "STLPort is not supported." -#endif - -// ----------------------------------------------------------------------------- -// Endianness -// ----------------------------------------------------------------------------- -// Define ABSL_IS_LITTLE_ENDIAN, ABSL_IS_BIG_ENDIAN. -// Some compilers or system headers provide macros to specify endianness. -// Unfortunately, there is no standard for the names of the macros or even of -// the header files. -// Reference: https://sourceforge.net/p/predef/wiki/Endianness/ -#if defined(ABSL_IS_BIG_ENDIAN) || defined(ABSL_IS_LITTLE_ENDIAN) -#error "ABSL_IS_(BIG|LITTLE)_ENDIAN cannot be directly set." - -#elif defined(__GLIBC__) || defined(__linux__) -// Operating systems that use the GNU C library generally provide -// containing __BYTE_ORDER, __LITTLE_ENDIAN, __BIG_ENDIAN. -#include - -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define ABSL_IS_LITTLE_ENDIAN 1 -#elif __BYTE_ORDER == __BIG_ENDIAN -#define ABSL_IS_BIG_ENDIAN 1 -#else // __BYTE_ORDER != __LITTLE_ENDIAN && __BYTE_ORDER != __BIG_ENDIAN -#error "Unknown endianness" -#endif // __BYTE_ORDER - -#elif defined(__APPLE__) && defined(__MACH__) -// Apple has containing BYTE_ORDER, BIG_ENDIAN, -// LITTLE_ENDIAN. -#include // NOLINT(build/include) - -#if BYTE_ORDER == LITTLE_ENDIAN -#define ABSL_IS_LITTLE_ENDIAN 1 -#elif BYTE_ORDER == BIG_ENDIAN -#define ABSL_IS_BIG_ENDIAN 1 -#else // BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN -#error "Unknown endianness" -#endif // BYTE_ORDER - -#elif defined(_WIN32) -// Assume Windows is little-endian. -#define ABSL_IS_LITTLE_ENDIAN 1 - -#elif defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || defined(__THUMBEL__) || \ - defined(__AARCH64EL__) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) -#define ABSL_IS_LITTLE_ENDIAN 1 - -#elif defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || \ - defined(__AARCH64EB__) || defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) -#define ABSL_IS_BIG_ENDIAN 1 - -#else -#error "absl endian detection needs to be set up on your platform." -#endif - -// ABSL_HAVE_EXCEPTIONS is defined when exceptions are enabled. Many -// compilers support a "no exceptions" mode that disables exceptions. -// -// Generally, when ABSL_HAVE_EXCEPTIONS is not defined: -// -// - Code using `throw` and `try` may not compile. -// - The `noexcept` specifier will still compile and behave as normal. -// - The `noexcept` operator may still return `false`. -// -// For further details, consult the compiler's documentation. -#ifdef ABSL_HAVE_EXCEPTIONS -#error ABSL_HAVE_EXCEPTIONS cannot be directly set. - -#elif defined(__clang__) -// TODO -// Switch to using __cpp_exceptions when we no longer support versions < 3.6. -// For details on this check, see: -// https://goo.gl/PilDrJ -#if defined(__EXCEPTIONS) && __has_feature(cxx_exceptions) -#define ABSL_HAVE_EXCEPTIONS 1 -#endif // defined(__EXCEPTIONS) && __has_feature(cxx_exceptions) - -// Handle remaining special cases and default to exceptions being supported. -#elif !(defined(__GNUC__) && (__GNUC__ < 5) && !defined(__EXCEPTIONS)) && \ - !(defined(__GNUC__) && (__GNUC__ >= 5) && !defined(__cpp_exceptions)) && \ - !(defined(_MSC_VER) && !defined(_CPPUNWIND)) -#define ABSL_HAVE_EXCEPTIONS 1 -#endif - -#endif // THIRD_PARTY_ABSL_BASE_CONFIG_H_ diff --git a/Firestore/Port/absl/absl_endian.h b/Firestore/Port/absl/absl_endian.h deleted file mode 100644 index 2c51a27..0000000 --- a/Firestore/Port/absl/absl_endian.h +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ABSL_BASE_INTERNAL_ENDIAN_H_ -#define ABSL_BASE_INTERNAL_ENDIAN_H_ - -// The following guarantees declaration of the byte swap functions -#ifdef _MSC_VER -#include // NOLINT(build/include) -#elif defined(__APPLE__) && defined(__MACH__) -// Mac OS X / Darwin features -#include -#elif defined(__GLIBC__) -#include // IWYU pragma: export -#endif - -#include -#include "Firestore/Port/absl/absl_port.h" - -namespace absl { - -// 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. -// The 16-bit version is available in Clang and GCC only as of GCC 4.8.0. -// For simplicity, we enable them all only for GCC 4.8.0 or later. -#if defined(__clang__) || \ - (defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || __GNUC__ >= 5)) -inline uint64_t gbswap_64(uint64_t host_int) { - return __builtin_bswap64(host_int); -} -inline uint32_t gbswap_32(uint32_t host_int) { - return __builtin_bswap32(host_int); -} -inline uint16 gbswap_16(uint16 host_int) { - return __builtin_bswap16(host_int); -} - -#elif defined(_MSC_VER) -inline uint64_t gbswap_64(uint64_t host_int) { - return _byteswap_uint64(host_int); -} -inline uint32_t gbswap_32(uint32_t host_int) { - return _byteswap_ulong(host_int); -} -inline uint16 gbswap_16(uint16 host_int) { - return _byteswap_ushort(host_int); -} - -#elif defined(__APPLE__) && defined(__MACH__) -inline uint64_t gbswap_64(uint64_t host_int) { - return OSSwapInt16(host_int); -} -inline uint32_t gbswap_32(uint32_t host_int) { - return OSSwapInt32(host_int); -} -inline uint16 gbswap_16(uint16 host_int) { - return OSSwapInt64(host_int); -} - -#else -inline uint64_t gbswap_64(uint64_t host_int) { -#if defined(__GNUC__) && defined(__x86_64__) && !(defined(__APPLE__) && defined(__MACH__)) - // Adapted from /usr/include/byteswap.h. Not available on Mac. - if (__builtin_constant_p(host_int)) { - return __bswap_constant_64(host_int); - } else { - register uint64_t result; - __asm__("bswap %0" : "=r"(result) : "0"(host_int)); - return result; - } -#elif defined(__GLIBC__) - return bswap_64(host_int); -#else - return (((x & GG_ULONGLONG(0xFF)) << 56) | ((x & GG_ULONGLONG(0xFF00)) << 40) | - ((x & GG_ULONGLONG(0xFF0000)) << 24) | ((x & GG_ULONGLONG(0xFF000000)) << 8) | - ((x & GG_ULONGLONG(0xFF00000000)) >> 8) | ((x & GG_ULONGLONG(0xFF0000000000)) >> 24) | - ((x & GG_ULONGLONG(0xFF000000000000)) >> 40) | - ((x & GG_ULONGLONG(0xFF00000000000000)) >> 56)); -#endif // bswap_64 -} - -inline uint32_t gbswap_32(uint32_t host_int) { -#if defined(__GLIBC__) - return bswap_32(host_int); -#else - return (((x & 0xFF) << 24) | ((x & 0xFF00) << 8) | ((x & 0xFF0000) >> 8) | - ((x & 0xFF000000) >> 24)); -#endif -} - -inline uint16 gbswap_16(uint16 host_int) { -#if defined(__GLIBC__) - return bswap_16(host_int); -#else - return (uint16)(((x & 0xFF) << 8) | ((x & 0xFF00) >> 8)); // NOLINT -#endif -} - -#endif // intrinics available - -#ifdef ABSL_IS_LITTLE_ENDIAN - -// Definitions for ntohl etc. that don't require us to include -// netinet/in.h. We wrap gbswap_32 and gbswap_16 in functions rather -// than just #defining them because in debug mode, gcc doesn't -// correctly handle the (rather involved) definitions of bswap_32. -// gcc guarantees that inline functions are as fast as macros, so -// this isn't a performance hit. -inline uint16 ghtons(uint16 x) { - return gbswap_16(x); -} -inline uint32_t ghtonl(uint32_t x) { - return gbswap_32(x); -} -inline uint64_t ghtonll(uint64_t x) { - return gbswap_64(x); -} - -#elif defined ABSL_IS_BIG_ENDIAN - -// These definitions are simpler on big-endian machines -// These are functions instead of macros to avoid self-assignment warnings -// on calls such as "i = ghtnol(i);". This also provides type checking. -inline uint16 ghtons(uint16 x) { - return x; -} -inline uint32_t ghtonl(uint32_t x) { - return x; -} -inline uint64_t ghtonll(uint64_t x) { - return x; -} - -#else -#error \ - "Unsupported byte order: Either ABSL_IS_BIG_ENDIAN or " \ - "ABSL_IS_LITTLE_ENDIAN must be defined" -#endif // byte order - -inline uint16 gntohs(uint16 x) { - return ghtons(x); -} -inline uint32_t gntohl(uint32_t x) { - return ghtonl(x); -} -inline uint64_t gntohll(uint64_t x) { - return ghtonll(x); -} - -// Utilities to convert numbers between the current hosts's native byte -// order and little-endian byte order -// -// Load/Store methods are alignment safe -namespace little_endian { -// Conversion functions. -#ifdef ABSL_IS_LITTLE_ENDIAN - -inline uint16 FromHost16(uint16 x) { - return x; -} -inline uint16 ToHost16(uint16 x) { - return x; -} - -inline uint32_t FromHost32(uint32_t x) { - return x; -} -inline uint32_t ToHost32(uint32_t x) { - return x; -} - -inline uint64_t FromHost64(uint64_t x) { - return x; -} -inline uint64_t ToHost64(uint64_t x) { - return x; -} - -inline constexpr bool IsLittleEndian() { - return true; -} - -#elif defined ABSL_IS_BIG_ENDIAN - -inline uint16 FromHost16(uint16 x) { - return gbswap_16(x); -} -inline uint16 ToHost16(uint16 x) { - return gbswap_16(x); -} - -inline uint32_t FromHost32(uint32_t x) { - return gbswap_32(x); -} -inline uint32_t ToHost32(uint32_t x) { - return gbswap_32(x); -} - -inline uint64_t FromHost64(uint64_t x) { - return gbswap_64(x); -} -inline uint64_t ToHost64(uint64_t x) { - return gbswap_64(x); -} - -inline constexpr bool IsLittleEndian() { - return false; -} - -#endif /* ENDIAN */ - -// Functions to do unaligned loads and stores in little-endian order. -inline uint16 Load16(const void *p) { - return ToHost16(UNALIGNED_LOAD16(p)); -} - -inline void Store16(void *p, uint16 v) { - UNALIGNED_STORE16(p, FromHost16(v)); -} - -inline uint32_t Load32(const void *p) { - return ToHost32(UNALIGNED_LOAD32(p)); -} - -inline void Store32(void *p, uint32_t v) { - UNALIGNED_STORE32(p, FromHost32(v)); -} - -inline uint64_t Load64(const void *p) { - return ToHost64(UNALIGNED_LOAD64(p)); -} - -inline void Store64(void *p, uint64_t v) { - UNALIGNED_STORE64(p, FromHost64(v)); -} - -} // namespace little_endian - -// Utilities to convert numbers between the current hosts's native byte -// order and big-endian byte order (same as network byte order) -// -// Load/Store methods are alignment safe -namespace big_endian { -#ifdef ABSL_IS_LITTLE_ENDIAN - -inline uint16 FromHost16(uint16 x) { - return gbswap_16(x); -} -inline uint16 ToHost16(uint16 x) { - return gbswap_16(x); -} - -inline uint32_t FromHost32(uint32_t x) { - return gbswap_32(x); -} -inline uint32_t ToHost32(uint32_t x) { - return gbswap_32(x); -} - -inline uint64_t FromHost64(uint64_t x) { - return gbswap_64(x); -} -inline uint64_t ToHost64(uint64_t x) { - return gbswap_64(x); -} - -inline constexpr bool IsLittleEndian() { - return true; -} - -#elif defined ABSL_IS_BIG_ENDIAN - -inline uint16 FromHost16(uint16 x) { - return x; -} -inline uint16 ToHost16(uint16 x) { - return x; -} - -inline uint32_t FromHost32(uint32_t x) { - return x; -} -inline uint32_t ToHost32(uint32_t x) { - return x; -} - -inline uint64_t FromHost64(uint64_t x) { - return x; -} -inline uint64_t ToHost64(uint64_t x) { - return x; -} - -inline constexpr bool IsLittleEndian() { - return false; -} - -#endif /* ENDIAN */ - -// Functions to do unaligned loads and stores in big-endian order. -inline uint16 Load16(const void *p) { - return ToHost16(UNALIGNED_LOAD16(p)); -} - -inline void Store16(void *p, uint16 v) { - UNALIGNED_STORE16(p, FromHost16(v)); -} - -inline uint32_t Load32(const void *p) { - return ToHost32(UNALIGNED_LOAD32(p)); -} - -inline void Store32(void *p, uint32_t v) { - UNALIGNED_STORE32(p, FromHost32(v)); -} - -inline uint64_t Load64(const void *p) { - return ToHost64(UNALIGNED_LOAD64(p)); -} - -inline void Store64(void *p, uint64_t v) { - UNALIGNED_STORE64(p, FromHost64(v)); -} - -} // namespace big_endian - -} // namespace absl - -#endif // ABSL_BASE_INTERNAL_ENDIAN_H_ diff --git a/Firestore/Port/absl/absl_integral_types.h b/Firestore/Port/absl/absl_integral_types.h deleted file mode 100644 index 47da9c1..0000000 --- a/Firestore/Port/absl/absl_integral_types.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Basic integer type definitions for various platforms -// -// This code is compiled directly on many platforms, including client -// platforms like Windows, Mac, and embedded systems. Before making -// any changes here, make sure that you're not breaking any platforms. -// - -#ifndef THIRD_PARTY_ABSL_BASE_INTEGRAL_TYPES_H_ -#define THIRD_PARTY_ABSL_BASE_INTEGRAL_TYPES_H_ - -// These typedefs are also defined in base/swig/google.swig. In the -// SWIG environment, we use those definitions and avoid duplicate -// definitions here with an ifdef. The definitions should be the -// same in both files, and ideally be only defined in this file. -#ifndef SWIG -// Standard typedefs -// Signed integer types with width of exactly 8, 16, 32, or 64 bits -// respectively, for use when exact sizes are required. -typedef signed char schar; -typedef signed char int8; -typedef short int16; -typedef int int32; -#ifdef COMPILER_MSVC -typedef __int64 int64; -#else -typedef long long int64; -#endif /* COMPILER_MSVC */ - -// NOTE: unsigned types are DANGEROUS in loops and other arithmetical -// places. Use the signed types unless your variable represents a bit -// pattern (eg a hash value) or you really need the extra bit. Do NOT -// use 'unsigned' to express "this value should always be positive"; -// use assertions for this. - -// Unsigned integer types with width of exactly 8, 16, 32, or 64 bits -// respectively, for use when exact sizes are required. -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned int uint32; -#ifdef COMPILER_MSVC -typedef unsigned __int64 uint64; -#else -typedef unsigned long long uint64; -#endif /* COMPILER_MSVC */ - -// A type to represent a Unicode code-point value. As of Unicode 4.0, -// such values require up to 21 bits. -// (For type-checking on pointers, make this explicitly signed, -// and it should always be the signed version of whatever int32 is.) -typedef signed int char32; - -// A type to represent a natural machine word (for e.g. efficiently -// scanning through memory for checksums or index searching). Don't use -// this for storing normal integers. Ideally this would be just -// unsigned int, but our 64-bit architectures use the LP64 model -// (http://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models), hence -// their ints are only 32 bits. We want to use the same fundamental -// type on all archs if possible to preserve *printf() compatability. -typedef unsigned long uword_t; - -#endif /* SWIG */ - -// long long macros to be used because gcc and vc++ use different suffixes, -// and different size specifiers in format strings -#undef GG_LONGLONG -#undef GG_ULONGLONG -#undef GG_LL_FORMAT - -#ifdef COMPILER_MSVC /* if Visual C++ */ - -// VC++ long long suffixes -#define GG_LONGLONG(x) x##I64 -#define GG_ULONGLONG(x) x##UI64 - -// Length modifier in printf format std::string for int64's (e.g. within %d) -#define GG_LL_FORMAT "I64" // As in printf("%I64d", ...) -#define GG_LL_FORMAT_W L"I64" - -#else /* not Visual C++ */ - -#define GG_LONGLONG(x) x##LL -#define GG_ULONGLONG(x) x##ULL -#define GG_LL_FORMAT "ll" // As in "%lld". Note that "q" is poor form also. -#define GG_LL_FORMAT_W L"ll" - -#endif // COMPILER_MSVC - -// There are still some requirements that we build these headers in -// C-compatibility mode. Unfortunately, -Wall doesn't like c-style -// casts, and C doesn't know how to read braced-initialization for -// integers. -#if defined(__cplusplus) -const uint8 kuint8max{0xFF}; -const uint16 kuint16max{0xFFFF}; -const uint32 kuint32max{0xFFFFFFFF}; -const uint64 kuint64max{GG_ULONGLONG(0xFFFFFFFFFFFFFFFF)}; -const int8 kint8min{~0x7F}; -const int8 kint8max{0x7F}; -const int16 kint16min{~0x7FFF}; -const int16 kint16max{0x7FFF}; -const int32 kint32min{~0x7FFFFFFF}; -const int32 kint32max{0x7FFFFFFF}; -const int64 kint64min{GG_LONGLONG(~0x7FFFFFFFFFFFFFFF)}; -const int64 kint64max{GG_LONGLONG(0x7FFFFFFFFFFFFFFF)}; -#else // not __cplusplus, this branch exists only for C-compat -static const uint8 kuint8max = ((uint8)0xFF); -static const uint16 kuint16max = ((uint16)0xFFFF); -static const uint32 kuint32max = ((uint32)0xFFFFFFFF); -static const uint64 kuint64max = ((uint64)GG_LONGLONG(0xFFFFFFFFFFFFFFFF)); -static const int8 kint8min = ((int8)~0x7F); -static const int8 kint8max = ((int8)0x7F); -static const int16 kint16min = ((int16)~0x7FFF); -static const int16 kint16max = ((int16)0x7FFF); -static const int32 kint32min = ((int32)~0x7FFFFFFF); -static const int32 kint32max = ((int32)0x7FFFFFFF); -static const int64 kint64min = ((int64)GG_LONGLONG(~0x7FFFFFFFFFFFFFFF)); -static const int64 kint64max = ((int64)GG_LONGLONG(0x7FFFFFFFFFFFFFFF)); -#endif // __cplusplus - -// The following are not real constants, but we list them so CodeSearch and -// other tools find them, in case people are looking for the above constants -// under different names: -// kMaxUint8, kMaxUint16, kMaxUint32, kMaxUint64 -// kMinInt8, kMaxInt8, kMinInt16, kMaxInt16, kMinInt32, kMaxInt32, -// kMinInt64, kMaxInt64 - -// No object has kIllegalFprint as its Fingerprint. -typedef uint64 Fprint; -static const Fprint kIllegalFprint = 0; -static const Fprint kMaxFprint = GG_ULONGLONG(0xFFFFFFFFFFFFFFFF); - -#endif // THIRD_PARTY_ABSL_BASE_INTEGRAL_TYPES_H_ diff --git a/Firestore/Port/absl/absl_port.h b/Firestore/Port/absl/absl_port.h deleted file mode 100644 index eee21fc..0000000 --- a/Firestore/Port/absl/absl_port.h +++ /dev/null @@ -1,535 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Various portability macros, type definitions, and inline functions -// This file is used for both C and C++! -// -// These are weird things we need to do to get this compiling on -// random systems (and on SWIG). -// -// This files is structured into the following high-level categories: -// - Platform checks (OS, Compiler, C++, Library) -// - Feature macros -// - Utility macros -// - Utility functions -// - Type alias -// - Predefined system/language macros -// - Predefined system/language functions -// - Compiler attributes (__attribute__) -// - Performance optimization (alignment, branch prediction) -// - Obsolete -// - -#ifndef THIRD_PARTY_ABSL_BASE_PORT_H_ -#define THIRD_PARTY_ABSL_BASE_PORT_H_ - -#include -#include // So we can set the bounds of our types -#include // for free() -#include // for memcpy() - -#include "Firestore/Port/absl/absl_attributes.h" -#include "Firestore/Port/absl/absl_config.h" -#include "Firestore/Port/absl/absl_integral_types.h" - -#ifdef SWIG -%include "attributes.h" -#endif - -// ----------------------------------------------------------------------------- -// Operating System Check -// ----------------------------------------------------------------------------- - -#if defined(__CYGWIN__) -#error "Cygwin is not supported." -#endif - -// ----------------------------------------------------------------------------- -// Compiler Check -// ----------------------------------------------------------------------------- - -// We support MSVC++ 14.0 update 2 and later. -#if defined(_MSC_FULL_VER) && _MSC_FULL_VER < 190023918 -#error "This package requires Visual Studio 2015 Update 2 or higher" -#endif - -// We support gcc 4.7 and later. -#if defined(__GNUC__) && !defined(__clang__) -#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7) -#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. -#if defined(__apple_build_version__) && __apple_build_version__ < 4211165 -#error "This package requires __apple_build_version__ of 4211165 or higher" -#endif - -// ----------------------------------------------------------------------------- -// C++ Version Check -// ----------------------------------------------------------------------------- - -// Enforce C++11 as the minimum. Note that Visual Studio has not -// advanced __cplusplus despite being good enough for our purposes, so -// so we exempt it from the check. -#if defined(__cplusplus) && !defined(_MSC_VER) && !defined(SWIG) -#if __cplusplus < 201103L -#error "C++ versions less than C++11 are not supported." -#endif -#endif - -// ----------------------------------------------------------------------------- -// C++ Standard Library Check -// ----------------------------------------------------------------------------- - -#if defined(__cplusplus) -#include -#if defined(_STLPORT_VERSION) -#error "STLPort is not supported." -#endif -#endif - -// ----------------------------------------------------------------------------- -// Feature Macros -// ----------------------------------------------------------------------------- - -// ABSL_HAVE_TLS is defined to 1 when __thread should be supported. -// We assume __thread is supported on Linux when compiled with Clang or compiled -// against libstdc++ with _GLIBCXX_HAVE_TLS defined. -#ifdef ABSL_HAVE_TLS -#error ABSL_HAVE_TLS cannot be directly set -#elif defined(__linux__) && (defined(__clang__) || defined(_GLIBCXX_HAVE_TLS)) -#define ABSL_HAVE_TLS 1 -#endif - -// ----------------------------------------------------------------------------- -// Utility Macros -// ----------------------------------------------------------------------------- - -// ABSL_FUNC_PTR_TO_CHAR_PTR -// On some platforms, a "function pointer" points to a function descriptor -// rather than directly to the function itself. -// Use ABSL_FUNC_PTR_TO_CHAR_PTR(func) to get a char-pointer to the first -// instruction of the function func. -#if defined(__cplusplus) -#if (defined(__powerpc__) && !(_CALL_ELF > 1)) || defined(__ia64) -// use opd section for function descriptors on these platforms, the function -// address is the first word of the descriptor -namespace absl { -enum { kPlatformUsesOPDSections = 1 }; -} // namespace absl -#define ABSL_FUNC_PTR_TO_CHAR_PTR(func) (reinterpret_cast(func)[0]) -#else // not PPC or IA64 -namespace absl { -enum { kPlatformUsesOPDSections = 0 }; -} // namespace absl -#define ABSL_FUNC_PTR_TO_CHAR_PTR(func) (reinterpret_cast(func)) -#endif // PPC or IA64 -#endif // __cplusplus - -// ----------------------------------------------------------------------------- -// Utility Functions -// ----------------------------------------------------------------------------- - -#if defined(__cplusplus) -namespace absl { -constexpr char PathSeparator() { -#ifdef _WIN32 - return '\\'; -#else - return '/'; -#endif -} -} // namespace absl -#endif // __cplusplus - -// ----------------------------------------------------------------------------- -// Type Alias -// ----------------------------------------------------------------------------- - -#ifdef _MSC_VER -// uid_t -// MSVC doesn't have uid_t -typedef int uid_t; - -// pid_t -// Defined all over the place. -typedef int pid_t; - -// ssize_t -// VC++ doesn't understand "ssize_t". SSIZE_T is defined in . -#include -typedef SSIZE_T ssize_t; -#endif // _MSC_VER - -// ----------------------------------------------------------------------------- -// Predefined System/Language Macros -// ----------------------------------------------------------------------------- - -// MAP_ANONYMOUS -#if defined(__APPLE__) && defined(__MACH__) -// For mmap, Linux defines both MAP_ANONYMOUS and MAP_ANON and says MAP_ANON is -// deprecated. In Darwin, MAP_ANON is all there is. -#if !defined MAP_ANONYMOUS -#define MAP_ANONYMOUS MAP_ANON -#endif // !MAP_ANONYMOUS -#endif // __APPLE__ && __MACH__ - -// PATH_MAX -// You say tomato, I say atotom -#ifdef _MSC_VER -#define PATH_MAX MAX_PATH -#endif - -// ----------------------------------------------------------------------------- -// Performance Optimization -// ----------------------------------------------------------------------------- - -// Alignment - -// CACHELINE_SIZE, CACHELINE_ALIGNED -// Deprecated: Use ABSL_CACHELINE_SIZE, ABSL_CACHELINE_ALIGNED. -// Note: When C++17 is available, consider using the following: -// - std::hardware_constructive_interference_size -// - std::hardware_destructive_interference_size -// See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0154r1.html -#if defined(__GNUC__) -#if defined(__i386__) || defined(__x86_64__) -#define CACHELINE_SIZE 64 -#define ABSL_CACHELINE_SIZE 64 -#elif defined(__powerpc64__) -#define CACHELINE_SIZE 128 -#define ABSL_CACHELINE_SIZE 128 -#elif defined(__aarch64__) -// We would need to read special register ctr_el0 to find out L1 dcache size. -// This value is a good estimate based on a real aarch64 machine. -#define CACHELINE_SIZE 64 -#define ABSL_CACHELINE_SIZE 64 -#elif defined(__arm__) -// Cache line sizes for ARM: These values are not strictly correct since -// cache line sizes depend on implementations, not architectures. There -// are even implementations with cache line sizes configurable at boot -// time. -#if defined(__ARM_ARCH_5T__) -#define CACHELINE_SIZE 32 -#define ABSL_CACHELINE_SIZE 32 -#elif defined(__ARM_ARCH_7A__) -#define CACHELINE_SIZE 64 -#define ABSL_CACHELINE_SIZE 64 -#endif -#endif - -#ifndef CACHELINE_SIZE -// A reasonable default guess. Note that overestimates tend to waste more -// space, while underestimates tend to waste more time. -#define CACHELINE_SIZE 64 -#define ABSL_CACHELINE_SIZE 64 -#endif - -// On some compilers, expands to __attribute__((aligned(CACHELINE_SIZE))). -// For compilers where this is not known to work, expands to nothing. -// -// No further guarantees are made here. The result of applying the macro -// to variables and types is always implementation defined. -// -// WARNING: It is easy to use this attribute incorrectly, even to the point -// of causing bugs that are difficult to diagnose, crash, etc. It does not -// guarantee that objects are aligned to a cache line. -// -// Recommendations: -// -// 1) Consult compiler documentation; this comment is not kept in sync as -// toolchains evolve. -// 2) Verify your use has the intended effect. This often requires inspecting -// the generated machine code. -// 3) Prefer applying this attribute to individual variables. Avoid -// applying it to types. This tends to localize the effect. -#define CACHELINE_ALIGNED __attribute__((aligned(CACHELINE_SIZE))) -#define ABSL_CACHELINE_ALIGNED __attribute__((aligned(ABSL_CACHELINE_SIZE))) - -#else // not GCC -#define CACHELINE_SIZE 64 -#define ABSL_CACHELINE_SIZE 64 -#define CACHELINE_ALIGNED -#define ABSL_CACHELINE_ALIGNED -#endif - -// unaligned APIs - -// Portable handling of unaligned loads, stores, and copies. -// On some platforms, like ARM, the copy functions can be more efficient -// then a load and a store. -// -// It is possible to implement all of these these using constant-length memcpy -// calls, which is portable and will usually be inlined into simple loads and -// stores if the architecture supports it. However, such inlining usually -// happens in a pass that's quite late in compilation, which means the resulting -// loads and stores cannot participate in many other optimizations, leading to -// overall worse code. - -// The unaligned API is C++ only. The declarations use C++ features -// (namespaces, inline) which are absent or incompatible in C. -#if defined(__cplusplus) - -#if defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER) || defined(MEMORY_SANITIZER) -// Consider we have an unaligned load/store of 4 bytes from address 0x...05. -// AddressSanitizer will treat it as a 3-byte access to the range 05:07 and -// will miss a bug if 08 is the first unaddressable byte. -// ThreadSanitizer will also treat this as a 3-byte access to 05:07 and will -// miss a race between this access and some other accesses to 08. -// MemorySanitizer will correctly propagate the shadow on unaligned stores -// and correctly report bugs on unaligned loads, but it may not properly -// update and report the origin of the uninitialized memory. -// For all three tools, replacing an unaligned access with a tool-specific -// callback solves the problem. - -// Make sure uint16_t/uint32_t/uint64_t are defined. -#include - -extern "C" { -uint16_t __sanitizer_unaligned_load16(const void *p); -uint32_t __sanitizer_unaligned_load32(const void *p); -uint64_t __sanitizer_unaligned_load64(const void *p); -void __sanitizer_unaligned_store16(void *p, uint16_t v); -void __sanitizer_unaligned_store32(void *p, uint32_t v); -void __sanitizer_unaligned_store64(void *p, uint64_t v); -} // extern "C" - -inline uint16 UNALIGNED_LOAD16(const void *p) { - return __sanitizer_unaligned_load16(p); -} - -inline uint32 UNALIGNED_LOAD32(const void *p) { - return __sanitizer_unaligned_load32(p); -} - -inline uint64 UNALIGNED_LOAD64(const void *p) { - return __sanitizer_unaligned_load64(p); -} - -inline void UNALIGNED_STORE16(void *p, uint16 v) { - __sanitizer_unaligned_store16(p, v); -} - -inline void UNALIGNED_STORE32(void *p, uint32 v) { - __sanitizer_unaligned_store32(p, v); -} - -inline void UNALIGNED_STORE64(void *p, uint64 v) { - __sanitizer_unaligned_store64(p, v); -} - -#elif defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86) || \ - defined(__ppc__) || defined(__PPC__) || defined(__ppc64__) || defined(__PPC64__) - -// x86 and x86-64 can perform unaligned loads/stores directly; -// modern PowerPC hardware can also do unaligned integer loads and stores; -// but note: the FPU still sends unaligned loads and stores to a trap handler! - -#define UNALIGNED_LOAD16(_p) (*reinterpret_cast(_p)) -#define UNALIGNED_LOAD32(_p) (*reinterpret_cast(_p)) -#define UNALIGNED_LOAD64(_p) (*reinterpret_cast(_p)) - -#define UNALIGNED_STORE16(_p, _val) (*reinterpret_cast(_p) = (_val)) -#define UNALIGNED_STORE32(_p, _val) (*reinterpret_cast(_p) = (_val)) -#define UNALIGNED_STORE64(_p, _val) (*reinterpret_cast(_p) = (_val)) - -#elif defined(__arm__) && !defined(__ARM_ARCH_5__) && !defined(__ARM_ARCH_5T__) && \ - !defined(__ARM_ARCH_5TE__) && !defined(__ARM_ARCH_5TEJ__) && !defined(__ARM_ARCH_6__) && \ - !defined(__ARM_ARCH_6J__) && !defined(__ARM_ARCH_6K__) && !defined(__ARM_ARCH_6Z__) && \ - !defined(__ARM_ARCH_6ZK__) && !defined(__ARM_ARCH_6T2__) - -// ARMv7 and newer support native unaligned accesses, but only of 16-bit -// 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 -// sub-architectures. Newer gcc (>= 4.6) set an __ARM_FEATURE_ALIGNED #define, -// so in time, maybe we can move on to that. -// -// This is a mess, but there's not much we can do about it. -// -// To further complicate matters, only LDR instructions (single reads) are -// allowed to be unaligned, not LDRD (two reads) or LDM (many reads). Unless we -// explicitly tell the compiler that these accesses can be unaligned, it can and -// will combine accesses. On armcc, the way to signal this is done by accessing -// through the type (uint32 __packed *), but GCC has no such attribute -// (it ignores __attribute__((packed)) on individual variables). However, -// we can tell it that a _struct_ is unaligned, which has the same effect, -// so we do that. - -namespace base { -namespace internal { - -struct Unaligned16Struct { - uint16 value; - uint8 dummy; // To make the size non-power-of-two. -} ATTRIBUTE_PACKED; - -struct Unaligned32Struct { - uint32 value; - uint8 dummy; // To make the size non-power-of-two. -} ATTRIBUTE_PACKED; - -} // namespace internal -} // namespace base - -#define UNALIGNED_LOAD16(_p) \ - ((reinterpret_cast(_p))->value) -#define UNALIGNED_LOAD32(_p) \ - ((reinterpret_cast(_p))->value) - -#define UNALIGNED_STORE16(_p, _val) \ - ((reinterpret_cast< ::base::internal::Unaligned16Struct *>(_p))->value = (_val)) -#define UNALIGNED_STORE32(_p, _val) \ - ((reinterpret_cast< ::base::internal::Unaligned32Struct *>(_p))->value = (_val)) - -inline uint64 UNALIGNED_LOAD64(const void *p) { - uint64 t; - memcpy(&t, p, sizeof t); - return t; -} - -inline void UNALIGNED_STORE64(void *p, uint64 v) { - memcpy(p, &v, sizeof v); -} - -#else - -#define NEED_ALIGNED_LOADS - -// These functions are provided for architectures that don't support -// unaligned loads and stores. - -inline uint16 UNALIGNED_LOAD16(const void *p) { - uint16 t; - memcpy(&t, p, sizeof t); - return t; -} - -inline uint32 UNALIGNED_LOAD32(const void *p) { - uint32 t; - memcpy(&t, p, sizeof t); - return t; -} - -inline uint64 UNALIGNED_LOAD64(const void *p) { - uint64 t; - memcpy(&t, p, sizeof t); - return t; -} - -inline void UNALIGNED_STORE16(void *p, uint16 v) { - memcpy(p, &v, sizeof v); -} - -inline void UNALIGNED_STORE32(void *p, uint32 v) { - memcpy(p, &v, sizeof v); -} - -inline void UNALIGNED_STORE64(void *p, uint64 v) { - memcpy(p, &v, sizeof v); -} - -#endif - -// The UNALIGNED_LOADW and UNALIGNED_STOREW macros load and store values -// of type uword_t. -#ifdef _LP64 -#define UNALIGNED_LOADW(_p) UNALIGNED_LOAD64(_p) -#define UNALIGNED_STOREW(_p, _val) UNALIGNED_STORE64(_p, _val) -#else -#define UNALIGNED_LOADW(_p) UNALIGNED_LOAD32(_p) -#define UNALIGNED_STOREW(_p, _val) UNALIGNED_STORE32(_p, _val) -#endif - -inline void UnalignedCopy16(const void *src, void *dst) { - UNALIGNED_STORE16(dst, UNALIGNED_LOAD16(src)); -} - -inline void UnalignedCopy32(const void *src, void *dst) { - UNALIGNED_STORE32(dst, UNALIGNED_LOAD32(src)); -} - -inline void UnalignedCopy64(const void *src, void *dst) { - if (sizeof(void *) == 8) { - UNALIGNED_STORE64(dst, UNALIGNED_LOAD64(src)); - } else { - const char *src_char = reinterpret_cast(src); - char *dst_char = reinterpret_cast(dst); - - UNALIGNED_STORE32(dst_char, UNALIGNED_LOAD32(src_char)); - UNALIGNED_STORE32(dst_char + 4, UNALIGNED_LOAD32(src_char + 4)); - } -} - -#endif // defined(__cplusplus), end of unaligned API - -// PREDICT_TRUE, PREDICT_FALSE -// -// GCC can be told that a certain branch is not likely to be taken (for -// instance, a CHECK failure), and use that information in static analysis. -// Giving it this information can help it optimize for the common case in -// the absence of better information (ie. -fprofile-arcs). -#if ABSL_HAVE_BUILTIN(__builtin_expect) || (defined(__GNUC__) && !defined(__clang__)) -#define PREDICT_FALSE(x) (__builtin_expect(x, 0)) -#define PREDICT_TRUE(x) (__builtin_expect(!!(x), 1)) -#define ABSL_PREDICT_FALSE(x) (__builtin_expect(x, 0)) -#define ABSL_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1)) -#else -#define PREDICT_FALSE(x) x -#define PREDICT_TRUE(x) x -#define ABSL_PREDICT_FALSE(x) x -#define ABSL_PREDICT_TRUE(x) x -#endif - -// ABSL_ASSERT -// -// In C++11, `assert` can't be used portably within constexpr functions. -// ABSL_ASSERT functions as a runtime assert but works in C++11 constexpr -// functions. Example: -// -// constexpr double Divide(double a, double b) { -// return ABSL_ASSERT(b != 0), a / b; -// } -// -// This macro is inspired by -// https://akrzemi1.wordpress.com/2017/05/18/asserts-in-constexpr-functions/ -#if defined(NDEBUG) -#define ABSL_ASSERT(expr) (false ? (void)(expr) : (void)0) -#else -#define ABSL_ASSERT(expr) \ - (PREDICT_TRUE((expr)) ? (void)0 : [] { assert(false && #expr); }()) // NOLINT -#endif - -// ----------------------------------------------------------------------------- -// Obsolete (to be removed) -// ----------------------------------------------------------------------------- - -// HAS_GLOBAL_STRING -// Some platforms have a std::string class that is different from ::std::string -// (although the interface is the same, of course). On other platforms, -// std::string is the same as ::std::string. -#if defined(__cplusplus) && !defined(SWIG) -#include -#ifndef HAS_GLOBAL_STRING -using std::basic_string; -using std::string; -#endif // HAS_GLOBAL_STRING -#endif // SWIG, __cplusplus - -#endif // THIRD_PARTY_ABSL_BASE_PORT_H_ diff --git a/Firestore/Port/ordered_code.cc b/Firestore/Port/ordered_code.cc index 038d445..05a1569 100644 --- a/Firestore/Port/ordered_code.cc +++ b/Firestore/Port/ordered_code.cc @@ -18,11 +18,17 @@ #include +#include +#include +#include +#include // For Slice + #include "Firestore/Port/bits.h" -#include "Firestore/Port/absl/absl_endian.h" -#include "Firestore/Port/absl/absl_port.h" -#include // For Slice +#define UNALIGNED_LOAD32 ABSL_INTERNAL_UNALIGNED_LOAD32 +#define UNALIGNED_LOAD64 ABSL_INTERNAL_UNALIGNED_LOAD64 +#define UNALIGNED_STORE32 ABSL_INTERNAL_UNALIGNED_STORE32 +#define UNALIGNED_STORE64 ABSL_INTERNAL_UNALIGNED_STORE64 // We encode a string in different ways depending on whether the item // should be in lexicographically increasing or decreasing order. -- cgit v1.2.3