aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore
diff options
context:
space:
mode:
authorGravatar Michael Lehenbauer <mikelehen@google.com>2018-01-09 12:57:21 -0800
committerGravatar Michael Lehenbauer <mikelehen@google.com>2018-01-09 12:57:21 -0800
commitaa00c7444982de08b21604965a708d1cad5188f7 (patch)
tree166325a14805321cbf5045fdd4a52dd634747218 /Firestore
parent2c6682c66ea7b86b3b7cb52e623086b4184d500a (diff)
parentc18af34fca72b5721cab4e3b26da7469df8fcc6b (diff)
Merge branch 'master' into mikelehen/merge-master-to-firestore-api-changes
Diffstat (limited to 'Firestore')
-rw-r--r--Firestore/CMakeLists.txt31
-rw-r--r--Firestore/Example/Firestore.xcodeproj/project.pbxproj12
-rw-r--r--Firestore/Example/Podfile2
-rw-r--r--Firestore/Example/Tests/GoogleTest/FSTGoogleTestTests.mm3
-rw-r--r--Firestore/Port/absl/absl_attributes.h644
-rw-r--r--Firestore/Port/absl/absl_config.h306
-rw-r--r--Firestore/Port/absl/absl_endian.h342
-rw-r--r--Firestore/Port/absl/absl_integral_types.h148
-rw-r--r--Firestore/Port/absl/absl_port.h535
-rw-r--r--Firestore/Port/ordered_code.cc12
-rw-r--r--Firestore/Port/string_util_test.cc5
-rw-r--r--Firestore/Protos/FrameworkMaker.xcodeproj/project.pbxproj2
-rwxr-xr-xFirestore/Protos/build-protos.sh47
-rw-r--r--Firestore/Protos/objc/firestore/local/MaybeDocument.pbobjc.m8
-rw-r--r--Firestore/Protos/objc/firestore/local/Mutation.pbobjc.m8
-rw-r--r--Firestore/Protos/objc/firestore/local/Target.pbobjc.m8
-rw-r--r--Firestore/Protos/objc/google/api/HTTP.pbobjc.m2
-rw-r--r--Firestore/Protos/objc/google/firestore/v1beta1/Common.pbobjc.m6
-rw-r--r--Firestore/Protos/objc/google/firestore/v1beta1/Document.pbobjc.m10
-rw-r--r--Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbobjc.m18
-rw-r--r--Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbrpc.h56
-rw-r--r--Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbrpc.m17
-rw-r--r--Firestore/Protos/objc/google/firestore/v1beta1/Query.pbobjc.m8
-rw-r--r--Firestore/Protos/objc/google/firestore/v1beta1/Write.pbobjc.m10
-rw-r--r--Firestore/Protos/objc/google/rpc/Status.pbobjc.m4
-rw-r--r--Firestore/Protos/objc/google/type/Latlng.pbobjc.m2
-rw-r--r--Firestore/core/src/firebase/firestore/base/port.h2
-rw-r--r--Firestore/core/src/firebase/firestore/util/CMakeLists.txt67
-rw-r--r--Firestore/core/src/firebase/firestore/util/assert_apple.mm44
-rw-r--r--Firestore/core/src/firebase/firestore/util/assert_stdio.cc53
-rw-r--r--Firestore/core/src/firebase/firestore/util/firebase_assert.h102
-rw-r--r--Firestore/core/src/firebase/firestore/util/log.h63
-rw-r--r--Firestore/core/src/firebase/firestore/util/log_apple.mm123
-rw-r--r--Firestore/core/src/firebase/firestore/util/log_stdio.cc97
-rw-r--r--Firestore/core/src/firebase/firestore/util/string_apple.h39
-rw-r--r--Firestore/core/src/firebase/firestore/util/string_printf.cc101
-rw-r--r--Firestore/core/src/firebase/firestore/util/string_printf.h48
-rw-r--r--Firestore/core/test/firebase/firestore/util/CMakeLists.txt23
-rw-r--r--Firestore/core/test/firebase/firestore/util/assert_test.cc64
-rw-r--r--Firestore/core/test/firebase/firestore/util/autoid_test.cc2
-rw-r--r--Firestore/core/test/firebase/firestore/util/log_test.cc61
-rw-r--r--Firestore/core/test/firebase/firestore/util/secure_random_test.cc2
-rw-r--r--Firestore/core/test/firebase/firestore/util/string_printf_test.cc78
-rw-r--r--Firestore/third_party/abseil-cpp/CMakeLists.txt8
44 files changed, 1173 insertions, 2050 deletions
diff --git a/Firestore/CMakeLists.txt b/Firestore/CMakeLists.txt
index 6c2a32e..9b90815 100644
--- a/Firestore/CMakeLists.txt
+++ b/Firestore/CMakeLists.txt
@@ -16,9 +16,24 @@ cmake_minimum_required(VERSION 2.8.11)
project(firestore)
set(FIREBASE_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/..")
-include("${FIREBASE_SOURCE_DIR}/cmake/utils.cmake")
+
+# CMAKE_INSTALL_PREFIX should be passed in to this build so that it can find
+# outputs of the superbuild. This is handled automatically if run via the
+# superbuild (i.e. by invoking cmake on the directory above this).
+#
+# If you want to use this project directly in e.g. CLion, make sure you
+# configure this.
+set(FIREBASE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}")
+
+list(INSERT CMAKE_MODULE_PATH 0 ${FIREBASE_SOURCE_DIR}/cmake)
+include(utils)
find_package(GTest REQUIRED)
+find_package(LevelDB REQUIRED)
+
+if(APPLE)
+ find_package(FirebaseCore REQUIRED)
+endif()
# We use C++11
set(CMAKE_CXX_STANDARD 11)
@@ -28,5 +43,19 @@ set(CMAKE_CXX_EXTENSIONS OFF)
# Fully qualified imports, project wide
include_directories("${FIREBASE_SOURCE_DIR}")
+if(APPLE)
+ # CMake has no special support for Objective-C as a distinct language but enabling modules and
+ # other clang extensions would apply even to regular C++ sources which is nonportable. Keep these
+ # flags separate to avoid misuse.
+ set(
+ OBJC_FLAGS
+ -fobjc-arc
+ -fmodules
+ -fno-autolink
+ -F${FIREBASE_INSTALL_DIR}/Frameworks
+ )
+endif(APPLE)
+
enable_testing()
+add_subdirectory(third_party/abseil-cpp EXCLUDE_FROM_ALL)
add_subdirectory(core)
diff --git a/Firestore/Example/Firestore.xcodeproj/project.pbxproj b/Firestore/Example/Firestore.xcodeproj/project.pbxproj
index 2e1b5f5..06f790c 100644
--- a/Firestore/Example/Firestore.xcodeproj/project.pbxproj
+++ b/Firestore/Example/Firestore.xcodeproj/project.pbxproj
@@ -24,12 +24,14 @@
/* Begin PBXBuildFile section */
3B843E4C1F3A182900548890 /* remote_store_spec_test.json in Resources */ = {isa = PBXBuildFile; fileRef = 3B843E4A1F3930A400548890 /* remote_store_spec_test.json */; };
+ 5436F32420008FAD006E51E3 /* string_printf_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 5436F32320008FAD006E51E3 /* string_printf_test.cc */; };
54740A571FC914BA00713A1A /* secure_random_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 54740A531FC913E500713A1A /* secure_random_test.cc */; };
54740A581FC914F000713A1A /* autoid_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 54740A521FC913E500713A1A /* autoid_test.cc */; };
54764FAB1FAA0C320085E60A /* string_util_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 54764FAA1FAA0C320085E60A /* string_util_test.cc */; };
54764FAF1FAA21B90085E60A /* FSTGoogleTestTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 54764FAE1FAA21B90085E60A /* FSTGoogleTestTests.mm */; };
5491BC721FB44593008B3588 /* FSTIntegrationTestCase.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5491BC711FB44593008B3588 /* FSTIntegrationTestCase.mm */; };
5491BC731FB44593008B3588 /* FSTIntegrationTestCase.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5491BC711FB44593008B3588 /* FSTIntegrationTestCase.mm */; };
+ 54C2294F1FECABAE007D065B /* log_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 54C2294E1FECABAE007D065B /* log_test.cc */; };
54DA12A61F315EE100DD57A1 /* collection_spec_test.json in Resources */ = {isa = PBXBuildFile; fileRef = 54DA129C1F315EE100DD57A1 /* collection_spec_test.json */; };
54DA12A71F315EE100DD57A1 /* existence_filter_spec_test.json in Resources */ = {isa = PBXBuildFile; fileRef = 54DA129D1F315EE100DD57A1 /* existence_filter_spec_test.json */; };
54DA12A81F315EE100DD57A1 /* limbo_spec_test.json in Resources */ = {isa = PBXBuildFile; fileRef = 54DA129E1F315EE100DD57A1 /* limbo_spec_test.json */; };
@@ -194,11 +196,13 @@
3B843E4A1F3930A400548890 /* remote_store_spec_test.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = remote_store_spec_test.json; sourceTree = "<group>"; };
42491D7DC8C8CD245CC22B93 /* Pods-SwiftBuildTest.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftBuildTest.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftBuildTest/Pods-SwiftBuildTest.debug.xcconfig"; sourceTree = "<group>"; };
4EBC5F5ABE1FD097EFE5E224 /* Pods-Firestore_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Firestore_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Firestore_Example/Pods-Firestore_Example.release.xcconfig"; sourceTree = "<group>"; };
+ 5436F32320008FAD006E51E3 /* string_printf_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = string_printf_test.cc; path = ../../core/test/firebase/firestore/util/string_printf_test.cc; sourceTree = "<group>"; };
54740A521FC913E500713A1A /* autoid_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = autoid_test.cc; path = ../../core/test/firebase/firestore/util/autoid_test.cc; sourceTree = "<group>"; };
54740A531FC913E500713A1A /* secure_random_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = secure_random_test.cc; path = ../../core/test/firebase/firestore/util/secure_random_test.cc; sourceTree = "<group>"; };
54764FAA1FAA0C320085E60A /* string_util_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = string_util_test.cc; path = ../../Port/string_util_test.cc; sourceTree = "<group>"; };
54764FAE1FAA21B90085E60A /* FSTGoogleTestTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = FSTGoogleTestTests.mm; path = GoogleTest/FSTGoogleTestTests.mm; sourceTree = "<group>"; };
5491BC711FB44593008B3588 /* FSTIntegrationTestCase.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FSTIntegrationTestCase.mm; sourceTree = "<group>"; };
+ 54C2294E1FECABAE007D065B /* log_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = log_test.cc; path = ../../core/test/firebase/firestore/util/log_test.cc; sourceTree = "<group>"; };
54DA129C1F315EE100DD57A1 /* collection_spec_test.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = collection_spec_test.json; sourceTree = "<group>"; };
54DA129D1F315EE100DD57A1 /* existence_filter_spec_test.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = existence_filter_spec_test.json; sourceTree = "<group>"; };
54DA129E1F315EE100DD57A1 /* limbo_spec_test.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = limbo_spec_test.json; sourceTree = "<group>"; };
@@ -391,7 +395,9 @@
isa = PBXGroup;
children = (
54740A521FC913E500713A1A /* autoid_test.cc */,
+ 54C2294E1FECABAE007D065B /* log_test.cc */,
54740A531FC913E500713A1A /* secure_random_test.cc */,
+ 5436F32320008FAD006E51E3 /* string_printf_test.cc */,
);
name = util;
sourceTree = "<group>";
@@ -1198,6 +1204,7 @@
DE51B1F91F0D491F0013853F /* FSTWatchChangeTests.m in Sources */,
DE51B1F81F0D491F0013853F /* FSTWatchChange+Testing.m in Sources */,
DE51B1EB1F0D490D0013853F /* FSTWriteGroupTests.mm in Sources */,
+ 54C2294F1FECABAE007D065B /* log_test.cc in Sources */,
DE51B2011F0D493E0013853F /* FSTHelpers.m in Sources */,
DE51B1F61F0D491B0013853F /* FSTSerializerBetaTests.m in Sources */,
DE51B1F01F0D49140013853F /* FSTFieldValueTests.m in Sources */,
@@ -1212,6 +1219,7 @@
DE51B1F41F0D491B0013853F /* FSTRemoteEventTests.m in Sources */,
54E928241F33953300C1953E /* FSTEventAccumulator.m in Sources */,
DE51B1D11F0D48CD0013853F /* FSTTargetIDGeneratorTests.m in Sources */,
+ 5436F32420008FAD006E51E3 /* string_printf_test.cc in Sources */,
DE51B1EF1F0D49140013853F /* FSTDocumentTests.m in Sources */,
DE51B1DC1F0D490D0013853F /* FSTLocalSerializerTests.m in Sources */,
AB99452A1FE2F9EB00DFC1E6 /* FIRDocumentSnapshotTests.m in Sources */,
@@ -1486,7 +1494,9 @@
HEADER_SEARCH_PATHS = (
"$(inherited)",
"\"${PODS_ROOT}/../../..\"",
+ "\"${PODS_ROOT}/../../../Firestore/third_party/abseil-cpp\"",
"\"${PODS_ROOT}/leveldb-library/include\"",
+ "\"${PODS_ROOT}/GoogleTest/googletest/include\"",
);
INFOPLIST_FILE = "Tests/Tests-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
@@ -1517,7 +1527,9 @@
HEADER_SEARCH_PATHS = (
"$(inherited)",
"\"${PODS_ROOT}/../../..\"",
+ "\"${PODS_ROOT}/../../../Firestore/third_party/abseil-cpp\"",
"\"${PODS_ROOT}/leveldb-library/include\"",
+ "\"${PODS_ROOT}/GoogleTest/googletest/include\"",
);
INFOPLIST_FILE = "Tests/Tests-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
diff --git a/Firestore/Example/Podfile b/Firestore/Example/Podfile
index 89af74f..a15446e 100644
--- a/Firestore/Example/Podfile
+++ b/Firestore/Example/Podfile
@@ -1,7 +1,7 @@
# The next line is the forcing function for the Firebase pod. The Firebase
# version's subspecs should depend on the component versions in their
# corresponding podspec's.
-pod 'Firebase/Core', '4.7.0'
+pod 'Firebase/Core', '4.8.0'
use_frameworks!
platform :ios, '8.0'
diff --git a/Firestore/Example/Tests/GoogleTest/FSTGoogleTestTests.mm b/Firestore/Example/Tests/GoogleTest/FSTGoogleTestTests.mm
index 4fc77ed..18dfaf3 100644
--- a/Firestore/Example/Tests/GoogleTest/FSTGoogleTestTests.mm
+++ b/Firestore/Example/Tests/GoogleTest/FSTGoogleTestTests.mm
@@ -17,8 +17,9 @@
#import <XCTest/XCTest.h>
#import <objc/runtime.h>
+#include <gtest/gtest.h>
+
#include "Firestore/Source/Util/FSTAssert.h"
-#include "gtest/gtest.h"
/**
* An XCTest test case that finds C++ test cases written in the GoogleTest framework, runs them, and
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
-// <http://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Function-Attributes.html>.
-//
-// 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<void *>(__start_##name))
-#define ABSL_ATTRIBUTE_SECTION_STOP(name) (reinterpret_cast<void *>(__stop_##name))
-
-// To be deleted macros. All macros are going te be renamed with ABSL_ prefix.
-#define ATTRIBUTE_SECTION_START(name) (reinterpret_cast<void *>(__start_##name))
-#define ATTRIBUTE_SECTION_STOP(name) (reinterpret_cast<void *>(__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<void *>(0))
-#define ABSL_ATTRIBUTE_SECTION_STOP(name) (reinterpret_cast<void *>(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<void *>(0))
-#define ATTRIBUTE_SECTION_STOP(name) (reinterpret_cast<void *>(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 <limits.h>
-
-#ifdef __cplusplus
-// Included for __GLIBCXX__, _LIBCPP_VERSION
-#include <cstddef>
-#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<T> 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<T> and
-// std::is_trivially_copy_constructible<T> are supported.
-//
-// ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE is defined when
-// std::is_trivially_copy_assignable<T> 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 <semaphore.h>
-// header and sem_open(3) family of functions as standardized in POSIX.1-2001.
-//
-// Note: While Apple does have <semaphore.h> 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 <endian.h>
-// containing __BYTE_ORDER, __LITTLE_ENDIAN, __BIG_ENDIAN.
-#include <endian.h>
-
-#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 <machine/endian.h> containing BYTE_ORDER, BIG_ENDIAN,
-// LITTLE_ENDIAN.
-#include <machine/endian.h> // 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 <stdlib.h> // NOLINT(build/include)
-#elif defined(__APPLE__) && defined(__MACH__)
-// Mac OS X / Darwin features
-#include <libkern/OSByteOrder.h>
-#elif defined(__GLIBC__)
-#include <byteswap.h> // IWYU pragma: export
-#endif
-
-#include <cstdint>
-#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 <assert.h>
-#include <limits.h> // So we can set the bounds of our types
-#include <stdlib.h> // for free()
-#include <string.h> // 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 <cstddef>
-#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<char **>(func)[0])
-#else // not PPC or IA64
-namespace absl {
-enum { kPlatformUsesOPDSections = 0 };
-} // namespace absl
-#define ABSL_FUNC_PTR_TO_CHAR_PTR(func) (reinterpret_cast<char *>(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 <basetsd.h>.
-#include <basetsd.h>
-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 <stdint.h>
-
-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<const uint16 *>(_p))
-#define UNALIGNED_LOAD32(_p) (*reinterpret_cast<const uint32 *>(_p))
-#define UNALIGNED_LOAD64(_p) (*reinterpret_cast<const uint64 *>(_p))
-
-#define UNALIGNED_STORE16(_p, _val) (*reinterpret_cast<uint16 *>(_p) = (_val))
-#define UNALIGNED_STORE32(_p, _val) (*reinterpret_cast<uint32 *>(_p) = (_val))
-#define UNALIGNED_STORE64(_p, _val) (*reinterpret_cast<uint64 *>(_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<const ::base::internal::Unaligned16Struct *>(_p))->value)
-#define UNALIGNED_LOAD32(_p) \
- ((reinterpret_cast<const ::base::internal::Unaligned32Struct *>(_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<const char *>(src);
- char *dst_char = reinterpret_cast<char *>(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 <string>
-#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 <assert.h>
+#include <absl/base/internal/endian.h>
+#include <absl/base/internal/unaligned_access.h>
+#include <absl/base/port.h>
+#include <leveldb/db.h> // For Slice
+
#include "Firestore/Port/bits.h"
-#include "Firestore/Port/absl/absl_endian.h"
-#include "Firestore/Port/absl/absl_port.h"
-#include <leveldb/db.h> // 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.
diff --git a/Firestore/Port/string_util_test.cc b/Firestore/Port/string_util_test.cc
index ac8ce56..331f96e 100644
--- a/Firestore/Port/string_util_test.cc
+++ b/Firestore/Port/string_util_test.cc
@@ -16,9 +16,8 @@
#include "Firestore/Port/string_util.h"
-#include "leveldb/db.h"
-
-#include "gtest/gtest.h"
+#include <gtest/gtest.h>
+#include <leveldb/db.h>
using Firestore::PrefixSuccessor;
using Firestore::ImmediateSuccessor;
diff --git a/Firestore/Protos/FrameworkMaker.xcodeproj/project.pbxproj b/Firestore/Protos/FrameworkMaker.xcodeproj/project.pbxproj
index 51a61b8..2efcb21 100644
--- a/Firestore/Protos/FrameworkMaker.xcodeproj/project.pbxproj
+++ b/Firestore/Protos/FrameworkMaker.xcodeproj/project.pbxproj
@@ -201,7 +201,7 @@
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-FrameworkMaker_iOS/Pods-FrameworkMaker_iOS-resources.sh",
- "$PODS_CONFIGURATION_BUILD_DIR/gRPC/gRPCCertificates.bundle",
+ "${PODS_CONFIGURATION_BUILD_DIR}/gRPC/gRPCCertificates.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
diff --git a/Firestore/Protos/build-protos.sh b/Firestore/Protos/build-protos.sh
index 4cfb12e..f5570cb 100755
--- a/Firestore/Protos/build-protos.sh
+++ b/Firestore/Protos/build-protos.sh
@@ -1,10 +1,13 @@
#!/bin/bash
# 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.
@@ -14,6 +17,31 @@
# Run this script from firebase-ios-sdk/Firestore/Protos to regnenerate the
# Objective C files from the protos.
+set -euo pipefail
+
+function StartCopyright() {
+ local filename="$1"
+
+ cat > $filename <<EOF
+/*
+ * 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.
+ */
+
+EOF
+}
+
# pod update to install protoc and the gRPC plugin compiler.
rm -rf Pods
rm Podfile.lock
@@ -22,10 +50,18 @@ pod update
# Generate the objective C files from the protos.
./Pods/!ProtoCompiler/protoc --plugin=protoc-gen-grpc=Pods/\!ProtoCompiler-gRPCPlugin/grpc_objective_c_plugin -I protos --objc_out=objc --grpc_out=objc `find protos -name *.proto -print | xargs`
-# CocoaPods does not like paths in library imports, flatten them.
+# Adjust imports in the protos to make them compile
for i in `find objc -name "*.[mh]"` ; do
- perl -i -pe 's#import ".*/#import "#' $i;
+ StartCopyright $i.tmp
+
+ sed '
+ s,#import "\(.*\.pbobjc.h\),#import "Firestore/Protos/objc/\1,;
+ s,#import "\(.*\.pbrpc.h\),#import "Firestore/Protos/objc/\1,;
+ s, *$,,
+ ' $i >> $i.tmp
+
+ mv $i.tmp $i
done
# Remove the unnecessary extensionRegistry functions.
@@ -36,5 +72,8 @@ done
# Remove non-buildable code from Annotations.pbobjc.*.
-echo "static int annotations_stub __attribute__((unused,used)) = 0;" > objc/google/api/Annotations.pbobjc.m
-echo "// Empty stub file" > objc/google/api/Annotations.pbobjc.h
+StartCopyright objc/google/api/Annotations.pbobjc.m
+echo "static int annotations_stub __attribute__((unused,used)) = 0;" >> objc/google/api/Annotations.pbobjc.m
+
+StartCopyright objc/google/api/Annotations.pbobjc.h
+echo "// Empty stub file" >> objc/google/api/Annotations.pbobjc.h
diff --git a/Firestore/Protos/objc/firestore/local/MaybeDocument.pbobjc.m b/Firestore/Protos/objc/firestore/local/MaybeDocument.pbobjc.m
index 1d4404d..a0db337 100644
--- a/Firestore/Protos/objc/firestore/local/MaybeDocument.pbobjc.m
+++ b/Firestore/Protos/objc/firestore/local/MaybeDocument.pbobjc.m
@@ -32,12 +32,12 @@
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
#import <Protobuf/Timestamp.pbobjc.h>
#else
- #import "Timestamp.pbobjc.h"
+ #import "Firestore/Protos/objc/google/protobuf/Timestamp.pbobjc.h"
#endif
- #import "MaybeDocument.pbobjc.h"
- #import "Document.pbobjc.h"
- #import "Annotations.pbobjc.h"
+ #import "Firestore/Protos/objc/firestore/local/MaybeDocument.pbobjc.h"
+ #import "Firestore/Protos/objc/google/firestore/v1beta1/Document.pbobjc.h"
+ #import "Firestore/Protos/objc/google/api/Annotations.pbobjc.h"
// @@protoc_insertion_point(imports)
#pragma clang diagnostic push
diff --git a/Firestore/Protos/objc/firestore/local/Mutation.pbobjc.m b/Firestore/Protos/objc/firestore/local/Mutation.pbobjc.m
index 8034143..aaefa00 100644
--- a/Firestore/Protos/objc/firestore/local/Mutation.pbobjc.m
+++ b/Firestore/Protos/objc/firestore/local/Mutation.pbobjc.m
@@ -32,12 +32,12 @@
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
#import <Protobuf/Timestamp.pbobjc.h>
#else
- #import "Timestamp.pbobjc.h"
+ #import "Firestore/Protos/objc/google/protobuf/Timestamp.pbobjc.h"
#endif
- #import "Mutation.pbobjc.h"
- #import "Write.pbobjc.h"
- #import "Annotations.pbobjc.h"
+ #import "Firestore/Protos/objc/firestore/local/Mutation.pbobjc.h"
+ #import "Firestore/Protos/objc/google/firestore/v1beta1/Write.pbobjc.h"
+ #import "Firestore/Protos/objc/google/api/Annotations.pbobjc.h"
// @@protoc_insertion_point(imports)
#pragma clang diagnostic push
diff --git a/Firestore/Protos/objc/firestore/local/Target.pbobjc.m b/Firestore/Protos/objc/firestore/local/Target.pbobjc.m
index 6f6ccf2..ad03465 100644
--- a/Firestore/Protos/objc/firestore/local/Target.pbobjc.m
+++ b/Firestore/Protos/objc/firestore/local/Target.pbobjc.m
@@ -32,12 +32,12 @@
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
#import <Protobuf/Timestamp.pbobjc.h>
#else
- #import "Timestamp.pbobjc.h"
+ #import "Firestore/Protos/objc/google/protobuf/Timestamp.pbobjc.h"
#endif
- #import "Target.pbobjc.h"
- #import "Firestore.pbobjc.h"
- #import "Annotations.pbobjc.h"
+ #import "Firestore/Protos/objc/firestore/local/Target.pbobjc.h"
+ #import "Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbobjc.h"
+ #import "Firestore/Protos/objc/google/api/Annotations.pbobjc.h"
// @@protoc_insertion_point(imports)
#pragma clang diagnostic push
diff --git a/Firestore/Protos/objc/google/api/HTTP.pbobjc.m b/Firestore/Protos/objc/google/api/HTTP.pbobjc.m
index 5adf41c..007d039 100644
--- a/Firestore/Protos/objc/google/api/HTTP.pbobjc.m
+++ b/Firestore/Protos/objc/google/api/HTTP.pbobjc.m
@@ -29,7 +29,7 @@
#import "GPBProtocolBuffers_RuntimeSupport.h"
#endif
- #import "HTTP.pbobjc.h"
+ #import "Firestore/Protos/objc/google/api/HTTP.pbobjc.h"
// @@protoc_insertion_point(imports)
#pragma clang diagnostic push
diff --git a/Firestore/Protos/objc/google/firestore/v1beta1/Common.pbobjc.m b/Firestore/Protos/objc/google/firestore/v1beta1/Common.pbobjc.m
index 118f56e..3775d73 100644
--- a/Firestore/Protos/objc/google/firestore/v1beta1/Common.pbobjc.m
+++ b/Firestore/Protos/objc/google/firestore/v1beta1/Common.pbobjc.m
@@ -32,11 +32,11 @@
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
#import <Protobuf/Timestamp.pbobjc.h>
#else
- #import "Timestamp.pbobjc.h"
+ #import "Firestore/Protos/objc/google/protobuf/Timestamp.pbobjc.h"
#endif
- #import "Common.pbobjc.h"
- #import "Annotations.pbobjc.h"
+ #import "Firestore/Protos/objc/google/firestore/v1beta1/Common.pbobjc.h"
+ #import "Firestore/Protos/objc/google/api/Annotations.pbobjc.h"
// @@protoc_insertion_point(imports)
#pragma clang diagnostic push
diff --git a/Firestore/Protos/objc/google/firestore/v1beta1/Document.pbobjc.m b/Firestore/Protos/objc/google/firestore/v1beta1/Document.pbobjc.m
index 2c805c3..86007f0 100644
--- a/Firestore/Protos/objc/google/firestore/v1beta1/Document.pbobjc.m
+++ b/Firestore/Protos/objc/google/firestore/v1beta1/Document.pbobjc.m
@@ -33,13 +33,13 @@
#import <Protobuf/Struct.pbobjc.h>
#import <Protobuf/Timestamp.pbobjc.h>
#else
- #import "Struct.pbobjc.h"
- #import "Timestamp.pbobjc.h"
+ #import "Firestore/Protos/objc/google/protobuf/Struct.pbobjc.h"
+ #import "Firestore/Protos/objc/google/protobuf/Timestamp.pbobjc.h"
#endif
- #import "Document.pbobjc.h"
- #import "Annotations.pbobjc.h"
- #import "Latlng.pbobjc.h"
+ #import "Firestore/Protos/objc/google/firestore/v1beta1/Document.pbobjc.h"
+ #import "Firestore/Protos/objc/google/api/Annotations.pbobjc.h"
+ #import "Firestore/Protos/objc/google/type/Latlng.pbobjc.h"
// @@protoc_insertion_point(imports)
#pragma clang diagnostic push
diff --git a/Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbobjc.m b/Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbobjc.m
index 4bdee01..4ed59a0 100644
--- a/Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbobjc.m
+++ b/Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbobjc.m
@@ -33,17 +33,17 @@
#import <Protobuf/Empty.pbobjc.h>
#import <Protobuf/Timestamp.pbobjc.h>
#else
- #import "Empty.pbobjc.h"
- #import "Timestamp.pbobjc.h"
+ #import "Firestore/Protos/objc/google/protobuf/Empty.pbobjc.h"
+ #import "Firestore/Protos/objc/google/protobuf/Timestamp.pbobjc.h"
#endif
- #import "Firestore.pbobjc.h"
- #import "Annotations.pbobjc.h"
- #import "Common.pbobjc.h"
- #import "Document.pbobjc.h"
- #import "Query.pbobjc.h"
- #import "Write.pbobjc.h"
- #import "Status.pbobjc.h"
+ #import "Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbobjc.h"
+ #import "Firestore/Protos/objc/google/api/Annotations.pbobjc.h"
+ #import "Firestore/Protos/objc/google/firestore/v1beta1/Common.pbobjc.h"
+ #import "Firestore/Protos/objc/google/firestore/v1beta1/Document.pbobjc.h"
+ #import "Firestore/Protos/objc/google/firestore/v1beta1/Query.pbobjc.h"
+ #import "Firestore/Protos/objc/google/firestore/v1beta1/Write.pbobjc.h"
+ #import "Firestore/Protos/objc/google/rpc/Status.pbobjc.h"
// @@protoc_insertion_point(imports)
#pragma clang diagnostic push
diff --git a/Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbrpc.h b/Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbrpc.h
index d7f127b..c8bc39d 100644
--- a/Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbrpc.h
+++ b/Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbrpc.h
@@ -14,29 +14,57 @@
* limitations under the License.
*/
+#if !GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO
#import "Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbobjc.h"
+#endif
#import <ProtoRPC/ProtoService.h>
#import <ProtoRPC/ProtoRPC.h>
#import <RxLibrary/GRXWriteable.h>
#import <RxLibrary/GRXWriter.h>
-#import "Firestore/Protos/objc/google/api/Annotations.pbobjc.h"
-#import "Firestore/Protos/objc/google/firestore/v1beta1/Common.pbobjc.h"
-#import "Firestore/Protos/objc/google/firestore/v1beta1/Document.pbobjc.h"
-#import "Firestore/Protos/objc/google/firestore/v1beta1/Query.pbobjc.h"
-#import "Firestore/Protos/objc/google/firestore/v1beta1/Write.pbobjc.h"
-#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
- #import <Protobuf/Empty.pbobjc.h>
-#else
- #import "Empty.pbobjc.h"
-#endif
-#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
- #import <Protobuf/Timestamp.pbobjc.h>
+#if GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO
+ @class GCFSBatchGetDocumentsRequest;
+ @class GCFSBatchGetDocumentsResponse;
+ @class GCFSBeginTransactionRequest;
+ @class GCFSBeginTransactionResponse;
+ @class GCFSCommitRequest;
+ @class GCFSCommitResponse;
+ @class GCFSCreateDocumentRequest;
+ @class GCFSDeleteDocumentRequest;
+ @class GCFSDocument;
+ @class GCFSGetDocumentRequest;
+ @class GCFSListCollectionIdsRequest;
+ @class GCFSListCollectionIdsResponse;
+ @class GCFSListDocumentsRequest;
+ @class GCFSListDocumentsResponse;
+ @class GCFSListenRequest;
+ @class GCFSListenResponse;
+ @class GCFSRollbackRequest;
+ @class GCFSRunQueryRequest;
+ @class GCFSRunQueryResponse;
+ @class GCFSUpdateDocumentRequest;
+ @class GCFSWriteRequest;
+ @class GCFSWriteResponse;
+ @class GPBEmpty;
#else
- #import "Timestamp.pbobjc.h"
+ #import "Firestore/Protos/objc/google/api/Annotations.pbobjc.h"
+ #import "Firestore/Protos/objc/google/firestore/v1beta1/Common.pbobjc.h"
+ #import "Firestore/Protos/objc/google/firestore/v1beta1/Document.pbobjc.h"
+ #import "Firestore/Protos/objc/google/firestore/v1beta1/Query.pbobjc.h"
+ #import "Firestore/Protos/objc/google/firestore/v1beta1/Write.pbobjc.h"
+ #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
+ #import <Protobuf/Empty.pbobjc.h>
+ #else
+ #import "Firestore/Protos/objc/google/protobuf/Empty.pbobjc.h"
+ #endif
+ #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
+ #import <Protobuf/Timestamp.pbobjc.h>
+ #else
+ #import "Firestore/Protos/objc/google/protobuf/Timestamp.pbobjc.h"
+ #endif
+ #import "Firestore/Protos/objc/google/rpc/Status.pbobjc.h"
#endif
-#import "Firestore/Protos/objc/google/rpc/Status.pbobjc.h"
NS_ASSUME_NONNULL_BEGIN
diff --git a/Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbrpc.m b/Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbrpc.m
index eec4c9a..d2e2be1 100644
--- a/Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbrpc.m
+++ b/Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbrpc.m
@@ -15,9 +15,26 @@
*/
#import "Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbrpc.h"
+#import "Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbobjc.h"
#import <ProtoRPC/ProtoRPC.h>
#import <RxLibrary/GRXWriter+Immediate.h>
+#import "Firestore/Protos/objc/google/api/Annotations.pbobjc.h"
+#import "Firestore/Protos/objc/google/firestore/v1beta1/Common.pbobjc.h"
+#import "Firestore/Protos/objc/google/firestore/v1beta1/Document.pbobjc.h"
+#import "Firestore/Protos/objc/google/firestore/v1beta1/Query.pbobjc.h"
+#import "Firestore/Protos/objc/google/firestore/v1beta1/Write.pbobjc.h"
+#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
+ #import <Protobuf/Empty.pbobjc.h>
+#else
+ #import "Firestore/Protos/objc/google/protobuf/Empty.pbobjc.h"
+#endif
+#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
+ #import <Protobuf/Timestamp.pbobjc.h>
+#else
+ #import "Firestore/Protos/objc/google/protobuf/Timestamp.pbobjc.h"
+#endif
+#import "Firestore/Protos/objc/google/rpc/Status.pbobjc.h"
@implementation GCFSFirestore
diff --git a/Firestore/Protos/objc/google/firestore/v1beta1/Query.pbobjc.m b/Firestore/Protos/objc/google/firestore/v1beta1/Query.pbobjc.m
index 804a5d0..b29dcfe 100644
--- a/Firestore/Protos/objc/google/firestore/v1beta1/Query.pbobjc.m
+++ b/Firestore/Protos/objc/google/firestore/v1beta1/Query.pbobjc.m
@@ -32,12 +32,12 @@
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
#import <Protobuf/Wrappers.pbobjc.h>
#else
- #import "Wrappers.pbobjc.h"
+ #import "Firestore/Protos/objc/google/protobuf/Wrappers.pbobjc.h"
#endif
- #import "Query.pbobjc.h"
- #import "Annotations.pbobjc.h"
- #import "Document.pbobjc.h"
+ #import "Firestore/Protos/objc/google/firestore/v1beta1/Query.pbobjc.h"
+ #import "Firestore/Protos/objc/google/api/Annotations.pbobjc.h"
+ #import "Firestore/Protos/objc/google/firestore/v1beta1/Document.pbobjc.h"
// @@protoc_insertion_point(imports)
#pragma clang diagnostic push
diff --git a/Firestore/Protos/objc/google/firestore/v1beta1/Write.pbobjc.m b/Firestore/Protos/objc/google/firestore/v1beta1/Write.pbobjc.m
index e6fd0f4..fc5db9a 100644
--- a/Firestore/Protos/objc/google/firestore/v1beta1/Write.pbobjc.m
+++ b/Firestore/Protos/objc/google/firestore/v1beta1/Write.pbobjc.m
@@ -32,13 +32,13 @@
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
#import <Protobuf/Timestamp.pbobjc.h>
#else
- #import "Timestamp.pbobjc.h"
+ #import "Firestore/Protos/objc/google/protobuf/Timestamp.pbobjc.h"
#endif
- #import "Write.pbobjc.h"
- #import "Annotations.pbobjc.h"
- #import "Common.pbobjc.h"
- #import "Document.pbobjc.h"
+ #import "Firestore/Protos/objc/google/firestore/v1beta1/Write.pbobjc.h"
+ #import "Firestore/Protos/objc/google/api/Annotations.pbobjc.h"
+ #import "Firestore/Protos/objc/google/firestore/v1beta1/Common.pbobjc.h"
+ #import "Firestore/Protos/objc/google/firestore/v1beta1/Document.pbobjc.h"
// @@protoc_insertion_point(imports)
#pragma clang diagnostic push
diff --git a/Firestore/Protos/objc/google/rpc/Status.pbobjc.m b/Firestore/Protos/objc/google/rpc/Status.pbobjc.m
index 831073c..416095b 100644
--- a/Firestore/Protos/objc/google/rpc/Status.pbobjc.m
+++ b/Firestore/Protos/objc/google/rpc/Status.pbobjc.m
@@ -32,10 +32,10 @@
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
#import <Protobuf/Any.pbobjc.h>
#else
- #import "Any.pbobjc.h"
+ #import "Firestore/Protos/objc/google/protobuf/Any.pbobjc.h"
#endif
- #import "Status.pbobjc.h"
+ #import "Firestore/Protos/objc/google/rpc/Status.pbobjc.h"
// @@protoc_insertion_point(imports)
#pragma clang diagnostic push
diff --git a/Firestore/Protos/objc/google/type/Latlng.pbobjc.m b/Firestore/Protos/objc/google/type/Latlng.pbobjc.m
index 9bb37ab..b9272da 100644
--- a/Firestore/Protos/objc/google/type/Latlng.pbobjc.m
+++ b/Firestore/Protos/objc/google/type/Latlng.pbobjc.m
@@ -29,7 +29,7 @@
#import "GPBProtocolBuffers_RuntimeSupport.h"
#endif
- #import "Latlng.pbobjc.h"
+ #import "Firestore/Protos/objc/google/type/Latlng.pbobjc.h"
// @@protoc_insertion_point(imports)
#pragma clang diagnostic push
diff --git a/Firestore/core/src/firebase/firestore/base/port.h b/Firestore/core/src/firebase/firestore/base/port.h
index 37d1041..5e3959d 100644
--- a/Firestore/core/src/firebase/firestore/base/port.h
+++ b/Firestore/core/src/firebase/firestore/base/port.h
@@ -18,7 +18,7 @@
#define FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_BASE_PORT_H_
#if defined(__APPLE__)
-// On Apple platforms we support building via Cocoapods without CMake. When
+// On Apple platforms we support building via CocoaPods without CMake. When
// building this way we can't test the presence of features so predefine all
// the platform-support feature macros to their expected values.
diff --git a/Firestore/core/src/firebase/firestore/util/CMakeLists.txt b/Firestore/core/src/firebase/firestore/util/CMakeLists.txt
index ce81363..3028a95 100644
--- a/Firestore/core/src/firebase/firestore/util/CMakeLists.txt
+++ b/Firestore/core/src/firebase/firestore/util/CMakeLists.txt
@@ -12,8 +12,73 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+# firebase_firestore_util is the interface of this module. The rest of the
+# libraries in here are an implementation detail of making this a
+# mutli-platform build.
+
+add_library(
+ firebase_firestore_util_base
+ secure_random_arc4random.cc
+ string_printf.cc
+)
+target_link_libraries(
+ firebase_firestore_util_base
+ PUBLIC
+ absl_base
+)
+
+# stdio-dependent bits can be built and tested everywhere
+add_library(
+ firebase_firestore_util_stdio
+ assert_stdio.cc
+ log_stdio.cc
+)
+target_link_libraries(
+ firebase_firestore_util_stdio
+ PUBLIC
+ firebase_firestore_util_base
+)
+
+# apple-dependent bits can only built and tested on apple plaforms
+if(APPLE)
+ add_library(
+ firebase_firestore_util_apple
+ assert_apple.mm
+ log_apple.mm
+ )
+ target_compile_options(
+ firebase_firestore_util_apple
+ PRIVATE
+ ${OBJC_FLAGS}
+ )
+ target_link_libraries(
+ firebase_firestore_util_apple
+ PUBLIC
+ FirebaseCore
+ )
+endif(APPLE)
+
add_library(
firebase_firestore_util
autoid.cc
- secure_random_arc4random.cc
)
+
+# Export a dependency on the correct logging library for this platform. All
+# buildable libraries are built and tested but only the best fit is exported.
+if(APPLE)
+ target_link_libraries(
+ firebase_firestore_util
+ PUBLIC
+ firebase_firestore_util_apple
+ firebase_firestore_util_base
+ )
+
+else(NOT APPLE)
+ target_link_libraries(
+ firebase_firestore_util
+ PUBLIC
+ firebase_firestore_util_stdio
+ firebase_firestore_util_base
+ )
+
+endif(APPLE)
diff --git a/Firestore/core/src/firebase/firestore/util/assert_apple.mm b/Firestore/core/src/firebase/firestore/util/assert_apple.mm
new file mode 100644
index 0000000..0447d6c
--- /dev/null
+++ b/Firestore/core/src/firebase/firestore/util/assert_apple.mm
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2018 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.
+ */
+
+#include "Firestore/core/src/firebase/firestore/util/firebase_assert.h"
+
+#import <Foundation/Foundation.h>
+
+#include <string.h>
+
+#include "Firestore/core/src/firebase/firestore/util/string_apple.h"
+
+namespace firebase {
+namespace firestore {
+namespace util {
+
+void FailAssert(const char* file, const char* func, const int line, const char* format, ...) {
+ va_list args;
+ va_start(args, format);
+ NSString *description = [[NSString alloc] initWithFormat:WrapNSStringNoCopy(format) arguments:args];
+ va_end(args);
+ [[NSAssertionHandler currentHandler]
+ handleFailureInFunction:WrapNSStringNoCopy(func)
+ file:WrapNSStringNoCopy(file)
+ lineNumber:line
+ description:@"FIRESTORE INTERNAL ASSERTION FAILED: %@", description];
+ abort();
+}
+
+} // namespace util
+} // namespace firestore
+} // namespace firebase
diff --git a/Firestore/core/src/firebase/firestore/util/assert_stdio.cc b/Firestore/core/src/firebase/firestore/util/assert_stdio.cc
new file mode 100644
index 0000000..b5d0b7c
--- /dev/null
+++ b/Firestore/core/src/firebase/firestore/util/assert_stdio.cc
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2018 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.
+ */
+
+#include "Firestore/core/src/firebase/firestore/util/firebase_assert.h"
+
+#include <stdarg.h>
+
+#include <exception>
+#include <string>
+
+#include <absl/base/config.h>
+
+#include "Firestore/core/src/firebase/firestore/util/string_printf.h"
+
+namespace firebase {
+namespace firestore {
+namespace util {
+
+void FailAssert(const char* file, const char* func, const int line,
+ const char* format, ...) {
+ std::string message;
+ StringAppendF(&message, "ASSERT: %s(%d) %s: ", file, line, func);
+
+ va_list args;
+ va_start(args, format);
+ StringAppendV(&message, format, args);
+ va_end(args);
+
+#if ABSL_HAVE_EXCEPTIONS
+ throw std::logic_error(message);
+
+#else
+ fprintf(stderr, "%s\n", message.c_str());
+ std::terminate();
+#endif
+}
+
+} // namespace util
+} // namespace firestore
+} // namespace firebase
diff --git a/Firestore/core/src/firebase/firestore/util/firebase_assert.h b/Firestore/core/src/firebase/firestore/util/firebase_assert.h
new file mode 100644
index 0000000..9f1bce8
--- /dev/null
+++ b/Firestore/core/src/firebase/firestore/util/firebase_assert.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2018 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.
+ */
+
+// To avoid naming-collision, this header is called firebase_assert.h instead
+// of assert.h.
+
+#ifndef FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_UTIL_FIREBASE_ASSERT_H_
+#define FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_UTIL_FIREBASE_ASSERT_H_
+
+#include <stdlib.h>
+
+#include "Firestore/core/src/firebase/firestore/util/log.h"
+
+#define FIREBASE_EXPAND_STRINGIFY_(X) #X
+#define FIREBASE_EXPAND_STRINGIFY(X) FIREBASE_EXPAND_STRINGIFY_(X)
+
+// FIREBASE_ASSERT_* macros are not compiled out of release builds. They should
+// be used for assertions that need to be propagated to end-users of SDKs.
+// FIREBASE_DEV_ASSERT_* macros are compiled out of release builds, similar to
+// the C assert() macro. They should be used for internal assertions that are
+// only shown to SDK developers.
+
+// Assert condition is true, if it's false log an assert with the specified
+// expression as a string.
+#define FIREBASE_ASSERT_WITH_EXPRESSION(condition, expression) \
+ do { \
+ if (!(condition)) { \
+ firebase::firestore::util::FailAssert( \
+ __FILE__, __PRETTY_FUNCTION__, __LINE__, \
+ FIREBASE_EXPAND_STRINGIFY(expression)); \
+ } \
+ } while(0)
+
+// Assert condition is true, if it's false log an assert with the specified
+// expression as a string. Compiled out of release builds.
+#if defined(NDEBUG)
+#define FIREBASE_DEV_ASSERT_WITH_EXPRESSION(condition, expression) \
+ { (void)(condition); }
+#else
+#define FIREBASE_DEV_ASSERT_WITH_EXPRESSION(condition, expression) \
+ FIREBASE_ASSERT_WITH_EXPRESSION(condition, expression)
+#endif // !defined(NDEBUG)
+
+// Custom assert() implementation that is not compiled out in release builds.
+#define FIREBASE_ASSERT(expression) \
+ FIREBASE_ASSERT_WITH_EXPRESSION(expression, expression)
+
+// Custom assert() implementation that is compiled out in release builds.
+// Compiled out of release builds.
+#define FIREBASE_DEV_ASSERT(expression) \
+ FIREBASE_DEV_ASSERT_WITH_EXPRESSION(expression, expression)
+
+// Assert condition is true otherwise display the specified expression,
+// message and abort.
+#define FIREBASE_ASSERT_MESSAGE_WITH_EXPRESSION(condition, expression, ...) \
+ do { \
+ if (!(condition)) { \
+ firebase::firestore::util::LogError( \
+ FIREBASE_EXPAND_STRINGIFY(expression)); \
+ firebase::firestore::util::FailAssert( \
+ __FILE__, __PRETTY_FUNCTION__, __LINE__, __VA_ARGS__); \
+ } \
+ } while(0)
+
+// Assert condition is true otherwise display the specified expression,
+// message and abort. Compiled out of release builds.
+#if defined(NDEBUG)
+#define FIREBASE_DEV_ASSERT_MESSAGE_WITH_EXPRESSION(condition, expression, \
+ ...) \
+ { (void)(condition); }
+#else
+#define FIREBASE_DEV_ASSERT_MESSAGE_WITH_EXPRESSION(condition, expression, \
+ ...) \
+ FIREBASE_ASSERT_MESSAGE_WITH_EXPRESSION(condition, expression, __VA_ARGS__)
+#endif // !defined(NDEBUG)
+
+namespace firebase {
+namespace firestore {
+namespace util {
+
+// A no-return helper function. To raise an assertion, use Macro instead.
+void FailAssert(const char* file, const char* func, const int line,
+ const char* format, ...);
+
+} // namespace util
+} // namespace firestore
+} // namespace firebase
+
+#endif // FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_UTIL_FIREBASE_ASSERT_H_
diff --git a/Firestore/core/src/firebase/firestore/util/log.h b/Firestore/core/src/firebase/firestore/util/log.h
new file mode 100644
index 0000000..d0cff4d
--- /dev/null
+++ b/Firestore/core/src/firebase/firestore/util/log.h
@@ -0,0 +1,63 @@
+/*
+ * 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 FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_UTIL_LOG_H_
+#define FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_UTIL_LOG_H_
+
+#include <stdarg.h>
+
+namespace firebase {
+namespace firestore {
+namespace util {
+
+/// @brief Levels used when logging messages.
+enum LogLevel {
+ /// Verbose Log Level
+ kLogLevelVerbose = 0,
+ /// Debug Log Level
+ kLogLevelDebug,
+ /// Info Log Level
+ kLogLevelInfo,
+ /// Warning Log Level
+ kLogLevelWarning,
+ /// Error Log Level
+ kLogLevelError,
+};
+
+// Common log methods.
+
+// All messages at or above the specified log level value are displayed.
+void LogSetLevel(LogLevel level);
+// Get the currently set log level.
+LogLevel LogGetLevel();
+// Log a debug message to the system log.
+void LogDebug(const char* format, ...);
+// Log an info message to the system log.
+void LogInfo(const char* format, ...);
+// Log a warning to the system log.
+void LogWarning(const char* format, ...);
+// Log an error to the system log.
+void LogError(const char* format, ...);
+// Log a firebase message (implemented by the platform specific logger).
+void LogMessageV(LogLevel log_level, const char* format, va_list args);
+// Log a firebase message via LogMessageV().
+void LogMessage(LogLevel log_level, const char* format, ...);
+
+} // namespace util
+} // namespace firestore
+} // namespace firebase
+
+#endif // FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_UTIL_LOG_H_
diff --git a/Firestore/core/src/firebase/firestore/util/log_apple.mm b/Firestore/core/src/firebase/firestore/util/log_apple.mm
new file mode 100644
index 0000000..cb2c58e
--- /dev/null
+++ b/Firestore/core/src/firebase/firestore/util/log_apple.mm
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ */
+
+#include "Firestore/core/src/firebase/firestore/util/log.h"
+
+#import <FirebaseCore/FIRLogger.h>
+#import <Foundation/Foundation.h>
+
+#include <string>
+
+#include "Firestore/core/src/firebase/firestore/util/string_apple.h"
+
+namespace firebase {
+namespace firestore {
+namespace util {
+
+namespace {
+
+// Translates a C++ LogLevel to the equivalent Objective-C FIRLoggerLevel
+FIRLoggerLevel ToFIRLoggerLevel(LogLevel level) {
+ switch (level) {
+ case kLogLevelVerbose: // fall through
+ case kLogLevelDebug:
+ return FIRLoggerLevelDebug;
+ case kLogLevelInfo:
+ return FIRLoggerLevelInfo;
+ case kLogLevelWarning:
+ return FIRLoggerLevelWarning;
+ case kLogLevelError:
+ return FIRLoggerLevelError;
+ default:
+ // Unsupported log level. FIRSetLoggerLevel will deal with it.
+ return static_cast<FIRLoggerLevel>(-1);
+ }
+}
+
+} // namespace
+
+void LogSetLevel(LogLevel level) {
+ FIRSetLoggerLevel(ToFIRLoggerLevel(level));
+}
+
+LogLevel LogGetLevel() {
+ // We return the true log level. True log level is what the SDK used to
+ // determine whether to log instead of what parameter is used in the last call
+ // of LogSetLevel().
+ if (FIRIsLoggableLevel(FIRLoggerLevelInfo, NO)) {
+ if (FIRIsLoggableLevel(FIRLoggerLevelDebug, NO)) {
+ // FIRLoggerLevelMax is actually kLogLevelDebug right now. We do not check
+ // further.
+ return kLogLevelDebug;
+ } else {
+ return kLogLevelInfo;
+ }
+ } else {
+ if (FIRIsLoggableLevel(FIRLoggerLevelWarning, NO)) {
+ return kLogLevelWarning;
+ } else {
+ return kLogLevelError;
+ }
+ }
+}
+
+void LogDebug(const char* format, ...) {
+ va_list list;
+ va_start(list, format);
+ FIRLogBasic(FIRLoggerLevelDebug, kFIRLoggerFirestore, @"I-FST000001",
+ WrapNSStringNoCopy(format), list);
+ va_end(list);
+}
+
+void LogInfo(const char* format, ...) {
+ va_list list;
+ va_start(list, format);
+ FIRLogBasic(FIRLoggerLevelInfo, kFIRLoggerFirestore, @"I-FST000001",
+ WrapNSStringNoCopy(format), list);
+ va_end(list);
+}
+
+void LogWarning(const char* format, ...) {
+ va_list list;
+ va_start(list, format);
+ FIRLogBasic(FIRLoggerLevelWarning, kFIRLoggerFirestore, @"I-FST000001",
+ WrapNSStringNoCopy(format), list);
+ va_end(list);
+}
+
+void LogError(const char* format, ...) {
+ va_list list;
+ va_start(list, format);
+ FIRLogBasic(FIRLoggerLevelError, kFIRLoggerFirestore, @"I-FST000001",
+ WrapNSStringNoCopy(format), list);
+ va_end(list);
+}
+
+void LogMessageV(LogLevel log_level, const char* format, va_list args) {
+ FIRLogBasic(ToFIRLoggerLevel(log_level), kFIRLoggerFirestore, @"I-FST000001",
+ WrapNSStringNoCopy(format), args);
+}
+
+void LogMessage(LogLevel log_level, const char* format, ...) {
+ va_list list;
+ va_start(list, format);
+ LogMessageV(log_level, format, list);
+ va_end(list);
+}
+
+} // namespace util
+} // namespace firestore
+} // namespace firebase
diff --git a/Firestore/core/src/firebase/firestore/util/log_stdio.cc b/Firestore/core/src/firebase/firestore/util/log_stdio.cc
new file mode 100644
index 0000000..bca2dc9
--- /dev/null
+++ b/Firestore/core/src/firebase/firestore/util/log_stdio.cc
@@ -0,0 +1,97 @@
+/*
+ * 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.
+ */
+
+#include "Firestore/core/src/firebase/firestore/util/log.h"
+
+#include <stdio.h>
+#include <string>
+
+namespace firebase {
+namespace firestore {
+namespace util {
+
+LogLevel g_log_level = kLogLevelInfo;
+
+void LogSetLevel(LogLevel level) {
+ g_log_level = level;
+}
+
+LogLevel LogGetLevel() {
+ return g_log_level;
+}
+
+void LogDebug(const char* format, ...) {
+ va_list list;
+ va_start(list, format);
+ LogMessageV(kLogLevelDebug, format, list);
+ va_end(list);
+}
+
+void LogInfo(const char* format, ...) {
+ va_list list;
+ va_start(list, format);
+ LogMessageV(kLogLevelInfo, format, list);
+ va_end(list);
+}
+
+void LogWarning(const char* format, ...) {
+ va_list list;
+ va_start(list, format);
+ LogMessageV(kLogLevelWarning, format, list);
+ va_end(list);
+}
+
+void LogError(const char* format, ...) {
+ va_list list;
+ va_start(list, format);
+ LogMessageV(kLogLevelError, format, list);
+ va_end(list);
+}
+
+void LogMessageV(LogLevel log_level, const char* format, va_list args) {
+ if (log_level < g_log_level) {
+ return;
+ }
+ switch (log_level) {
+ case kLogLevelVerbose:
+ printf("VERBOSE: ");
+ break;
+ case kLogLevelDebug:
+ printf("DEBUG: ");
+ break;
+ case kLogLevelInfo:
+ break;
+ case kLogLevelWarning:
+ printf("WARNING: ");
+ break;
+ case kLogLevelError:
+ printf("ERROR: ");
+ break;
+ }
+ vprintf(format, args);
+ printf("\n");
+}
+
+void LogMessage(LogLevel log_level, const char* format, ...) {
+ va_list list;
+ va_start(list, format);
+ LogMessageV(log_level, format, list);
+ va_end(list);
+}
+
+} // namespace util
+} // namespace firestore
+} // namespace firebase
diff --git a/Firestore/core/src/firebase/firestore/util/string_apple.h b/Firestore/core/src/firebase/firestore/util/string_apple.h
new file mode 100644
index 0000000..42b51dd
--- /dev/null
+++ b/Firestore/core/src/firebase/firestore/util/string_apple.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2018 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 FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_UTIL_STRING_APPLE_H_
+#define FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_UTIL_STRING_APPLE_H_
+
+#import <Foundation/Foundation.h>
+
+namespace firebase {
+namespace firestore {
+namespace util {
+
+// Translates a C string to the equivalent NSString without making a copy.
+inline NSString* WrapNSStringNoCopy(const char* c_str) {
+ return [[NSString alloc] initWithBytesNoCopy:const_cast<void*>(static_cast<const void*>(c_str))
+ length:strlen(c_str)
+ encoding:NSUTF8StringEncoding
+ freeWhenDone:NO];
+}
+
+
+} // namespace util
+} // namespace firestore
+} // namespace firebase
+
+#endif // FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_UTIL_STRING_APPLE_H_
diff --git a/Firestore/core/src/firebase/firestore/util/string_printf.cc b/Firestore/core/src/firebase/firestore/util/string_printf.cc
new file mode 100644
index 0000000..60cc564
--- /dev/null
+++ b/Firestore/core/src/firebase/firestore/util/string_printf.cc
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2018 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.
+ */
+
+#include "Firestore/core/src/firebase/firestore/util/string_printf.h"
+
+#include <stdio.h>
+
+namespace firebase {
+namespace firestore {
+namespace util {
+
+void StringAppendV(std::string* dst, const char* format, va_list ap) {
+ // First try with a small fixed size buffer
+ static const int kSpaceLength = 1024;
+ char space[kSpaceLength];
+
+ // It's possible for methods that use a va_list to invalidate
+ // the data in it upon use. The fix is to make a copy
+ // of the structure before using it and use that copy instead.
+ va_list backup_ap;
+ va_copy(backup_ap, ap);
+ int result = vsnprintf(space, kSpaceLength, format, backup_ap);
+ va_end(backup_ap);
+
+ if (result < kSpaceLength) {
+ if (result >= 0) {
+ // Normal case -- everything fit.
+ dst->append(space, result);
+ return;
+ }
+
+#ifdef _MSC_VER
+ // Error or MSVC running out of space. MSVC 8.0 and higher
+ // can be asked about space needed with the special idiom below:
+ va_copy(backup_ap, ap);
+ result = vsnprintf(nullptr, 0, format, backup_ap);
+ va_end(backup_ap);
+#endif
+
+ if (result < 0) {
+ // Just an error.
+ return;
+ }
+ }
+
+ // Increase the buffer size to the size requested by vsnprintf,
+ // plus one for the closing \0.
+ size_t initial_size = dst->size();
+ size_t target_size = initial_size + result;
+
+ dst->resize(target_size + 1);
+ char* buf = &(*dst)[initial_size];
+ int buf_remain = result + 1;
+
+ // Restore the va_list before we use it again
+ va_copy(backup_ap, ap);
+ result = vsnprintf(buf, buf_remain, format, backup_ap);
+ va_end(backup_ap);
+
+ if (result >= 0 && result < buf_remain) {
+ // It fit and vsnprintf copied in directly. Resize down one to
+ // remove the trailing \0.
+ dst->resize(target_size);
+ } else {
+ // Didn't fit. Leave the original string unchanged.
+ dst->resize(initial_size);
+ }
+}
+
+std::string StringPrintf(const char* format, ...) {
+ va_list ap;
+ va_start(ap, format);
+ std::string result;
+ StringAppendV(&result, format, ap);
+ va_end(ap);
+ return result;
+}
+
+void StringAppendF(std::string* dst, const char* format, ...) {
+ va_list ap;
+ va_start(ap, format);
+ StringAppendV(dst, format, ap);
+ va_end(ap);
+}
+
+} // namespace util
+} // namespace firestore
+} // namespace firebase
diff --git a/Firestore/core/src/firebase/firestore/util/string_printf.h b/Firestore/core/src/firebase/firestore/util/string_printf.h
new file mode 100644
index 0000000..9e2b9c0
--- /dev/null
+++ b/Firestore/core/src/firebase/firestore/util/string_printf.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2018 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 FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_UTIL_STRING_PRINTF_H_
+#define FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_UTIL_STRING_PRINTF_H_
+
+#include <stdarg.h>
+
+#include <string>
+
+#include <absl/base/attributes.h>
+
+namespace firebase {
+namespace firestore {
+namespace util {
+
+/** Return a C++ string. */
+std::string StringPrintf(const char* format, ...)
+ ABSL_PRINTF_ATTRIBUTE(1, 2);
+
+/** Append result to a supplied string. */
+void StringAppendF(std::string* dst, const char* format, ...)
+ ABSL_PRINTF_ATTRIBUTE(2, 3);
+
+/**
+ * Lower-level routine that takes a va_list and appends to a specified
+ * string. All other routines are just convenience wrappers around it.
+ */
+void StringAppendV(std::string* dst, const char* format, va_list ap);
+
+} // namespace util
+} // namespace firestore
+} // namespace firebase
+
+#endif // FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_UTIL_STRING_FORMAT_H_
diff --git a/Firestore/core/test/firebase/firestore/util/CMakeLists.txt b/Firestore/core/test/firebase/firestore/util/CMakeLists.txt
index 223fa41..e51bb51 100644
--- a/Firestore/core/test/firebase/firestore/util/CMakeLists.txt
+++ b/Firestore/core/test/firebase/firestore/util/CMakeLists.txt
@@ -16,8 +16,31 @@ cc_test(
firebase_firestore_util_test
autoid_test.cc
secure_random_test.cc
+ string_printf_test.cc
)
target_link_libraries(
firebase_firestore_util_test
firebase_firestore_util
)
+
+if(APPLE)
+ cc_test(
+ firebase_firestore_util_apple_test
+ assert_test.cc
+ log_test.cc
+ )
+ target_link_libraries(
+ firebase_firestore_util_apple_test
+ firebase_firestore_util_apple
+ )
+endif(APPLE)
+
+cc_test(
+ firebase_firestore_util_stdio_test
+ assert_test.cc
+ log_test.cc
+)
+target_link_libraries(
+ firebase_firestore_util_stdio_test
+ firebase_firestore_util_stdio
+)
diff --git a/Firestore/core/test/firebase/firestore/util/assert_test.cc b/Firestore/core/test/firebase/firestore/util/assert_test.cc
new file mode 100644
index 0000000..7c49462
--- /dev/null
+++ b/Firestore/core/test/firebase/firestore/util/assert_test.cc
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2018 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.
+ */
+
+#include "Firestore/core/src/firebase/firestore/util/firebase_assert.h"
+
+#include <exception>
+
+#include "gtest/gtest.h"
+
+namespace firebase {
+namespace firestore {
+namespace util {
+
+namespace {
+
+void AssertWithExpression(bool condition) {
+ FIREBASE_ASSERT_WITH_EXPRESSION(condition, 1 + 2 + 3);
+}
+
+void Assert(bool condition) {
+ FIREBASE_ASSERT(condition == true);
+}
+
+void AssertMessageWithExpression(bool condition) {
+ FIREBASE_ASSERT_MESSAGE_WITH_EXPRESSION(condition, 1 + 2 + 3, "connection %s",
+ condition ? "succeeded" : "failed");
+}
+
+} // namespace
+
+TEST(Assert, WithExpression) {
+ AssertWithExpression(true);
+
+ EXPECT_ANY_THROW(AssertWithExpression(false));
+}
+
+TEST(Assert, Vanilla) {
+ Assert(true);
+
+ EXPECT_ANY_THROW(Assert(false));
+}
+
+TEST(Assert, WithMessageAndExpression) {
+ AssertMessageWithExpression(true);
+
+ EXPECT_ANY_THROW(AssertMessageWithExpression(false));
+}
+
+} // namespace util
+} // namespace firestore
+} // namespace firebase
diff --git a/Firestore/core/test/firebase/firestore/util/autoid_test.cc b/Firestore/core/test/firebase/firestore/util/autoid_test.cc
index 730c683..e55a8e9 100644
--- a/Firestore/core/test/firebase/firestore/util/autoid_test.cc
+++ b/Firestore/core/test/firebase/firestore/util/autoid_test.cc
@@ -18,7 +18,7 @@
#include <ctype.h>
-#include "gtest/gtest.h"
+#include <gtest/gtest.h>
using firebase::firestore::util::CreateAutoId;
diff --git a/Firestore/core/test/firebase/firestore/util/log_test.cc b/Firestore/core/test/firebase/firestore/util/log_test.cc
new file mode 100644
index 0000000..46cbc4e
--- /dev/null
+++ b/Firestore/core/test/firebase/firestore/util/log_test.cc
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+#include "Firestore/core/src/firebase/firestore/util/log.h"
+
+#include "gtest/gtest.h"
+
+namespace firebase {
+namespace firestore {
+namespace util {
+
+// When running against the log_apple.mm implementation (backed by FIRLogger)
+// this test can fail if debug_mode gets persisted in the user defaults. Check
+// for defaults getting in your way with
+//
+// defaults read firebase_firestore_util_log_apple_test
+//
+// You can fix it with:
+//
+// defaults write firebase_firestore_util_log_apple_test \
+// /google/firebase/debug_mode NO
+TEST(Log, SetAndGet) {
+ LogSetLevel(kLogLevelVerbose);
+
+ LogSetLevel(kLogLevelDebug);
+ EXPECT_EQ(kLogLevelDebug, LogGetLevel());
+
+ LogSetLevel(kLogLevelInfo);
+ EXPECT_EQ(kLogLevelInfo, LogGetLevel());
+
+ LogSetLevel(kLogLevelWarning);
+ EXPECT_EQ(kLogLevelWarning, LogGetLevel());
+
+ LogSetLevel(kLogLevelError);
+ EXPECT_EQ(kLogLevelError, LogGetLevel());
+}
+
+TEST(Log, LogAllKinds) {
+ LogDebug("test debug logging %d", 1);
+ LogInfo("test info logging %d", 2);
+ LogWarning("test warning logging %d", 3);
+ LogError("test error logging %d", 4);
+ LogMessage(kLogLevelError, "test va-args %s %c %d", "abc", ':', 123);
+}
+
+} // namespace util
+} // namespace firestore
+} // namespace firebase
diff --git a/Firestore/core/test/firebase/firestore/util/secure_random_test.cc b/Firestore/core/test/firebase/firestore/util/secure_random_test.cc
index f96f3de..ee2ae00 100644
--- a/Firestore/core/test/firebase/firestore/util/secure_random_test.cc
+++ b/Firestore/core/test/firebase/firestore/util/secure_random_test.cc
@@ -16,7 +16,7 @@
#include "Firestore/core/src/firebase/firestore/util/secure_random.h"
-#include "gtest/gtest.h"
+#include <gtest/gtest.h>
using firebase::firestore::util::SecureRandom;
diff --git a/Firestore/core/test/firebase/firestore/util/string_printf_test.cc b/Firestore/core/test/firebase/firestore/util/string_printf_test.cc
new file mode 100644
index 0000000..76f7cde
--- /dev/null
+++ b/Firestore/core/test/firebase/firestore/util/string_printf_test.cc
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+#include "Firestore/core/src/firebase/firestore/util/string_printf.h"
+
+#include <gtest/gtest.h>
+
+namespace firebase {
+namespace firestore {
+namespace util {
+
+TEST(StringPrintf, Empty) {
+ EXPECT_EQ("", StringPrintf(""));
+ EXPECT_EQ("", StringPrintf("%s", std::string().c_str()));
+ EXPECT_EQ("", StringPrintf("%s", ""));
+}
+
+TEST(StringAppendFTest, Empty) {
+ std::string value("Hello");
+ const char* empty = "";
+ StringAppendF(&value, "%s", empty);
+ EXPECT_EQ("Hello", value);
+}
+
+TEST(StringAppendFTest, EmptyString) {
+ std::string value("Hello");
+ StringAppendF(&value, "%s", "");
+ EXPECT_EQ("Hello", value);
+}
+
+TEST(StringAppendFTest, String) {
+ std::string value("Hello");
+ StringAppendF(&value, " %s", "World");
+ EXPECT_EQ("Hello World", value);
+}
+
+TEST(StringAppendFTest, Int) {
+ std::string value("Hello");
+ StringAppendF(&value, " %d", 123);
+ EXPECT_EQ("Hello 123", value);
+}
+
+TEST(StringPrintf, DontOverwriteErrno) {
+ // Check that errno isn't overwritten unless we're printing
+ // something significantly larger than what people are normally
+ // printing in their badly written PLOG() statements.
+ errno = ECHILD;
+ std::string value = StringPrintf("Hello, %s!", "World");
+ EXPECT_EQ(ECHILD, errno);
+}
+
+TEST(StringPrintf, LargeBuf) {
+ // Check that the large buffer is handled correctly.
+ int n = 2048;
+ char* buf = new char[n + 1];
+ memset(buf, ' ', n);
+ buf[n] = 0;
+ std::string value = StringPrintf("%s", buf);
+ EXPECT_EQ(buf, value);
+ delete[] buf;
+}
+
+} // namespace util
+} // namespace firestore
+} // namespace firebase
diff --git a/Firestore/third_party/abseil-cpp/CMakeLists.txt b/Firestore/third_party/abseil-cpp/CMakeLists.txt
index 1c53a72..b25a006 100644
--- a/Firestore/third_party/abseil-cpp/CMakeLists.txt
+++ b/Firestore/third_party/abseil-cpp/CMakeLists.txt
@@ -53,7 +53,13 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_WARNING_VLA} ${CMAKE_CXX_FLAGS} ")
## pthread
find_package(Threads REQUIRED)
-find_package(GTest REQUIRED)
+# commented: used only for standalone test
+#add_subdirectory(cctz)
+#add_subdirectory(googletest)
+
+## check targets
+check_target(GTest::GTest)
+check_target(GTest::Main)
# -fexceptions
set(ABSL_EXCEPTIONS_FLAG "${CMAKE_CXX_EXCEPTIONS}")