From a4d2614d73ccea3bac9dbade6b13326cbfc8cabc Mon Sep 17 00:00:00 2001 From: Gil Date: Mon, 11 Dec 2017 19:50:14 -0800 Subject: Remove prerelease abseil code (#558) * Add abseil bits to the iOS build * Migrate from prerelease to published abseil bits in ordered_code * Remove prerelease abseil code --- FirebaseFirestore.podspec | 12 +- Firestore/Port/absl/absl_attributes.h | 644 ------------------------------ Firestore/Port/absl/absl_config.h | 306 -------------- Firestore/Port/absl/absl_endian.h | 342 ---------------- Firestore/Port/absl/absl_integral_types.h | 148 ------- Firestore/Port/absl/absl_port.h | 535 ------------------------- Firestore/Port/ordered_code.cc | 12 +- 7 files changed, 16 insertions(+), 1983 deletions(-) delete mode 100644 Firestore/Port/absl/absl_attributes.h delete mode 100644 Firestore/Port/absl/absl_config.h delete mode 100644 Firestore/Port/absl/absl_endian.h delete mode 100644 Firestore/Port/absl/absl_integral_types.h delete mode 100644 Firestore/Port/absl/absl_port.h diff --git a/FirebaseFirestore.podspec b/FirebaseFirestore.podspec index ed7346c..eabac1e 100644 --- a/FirebaseFirestore.podspec +++ b/FirebaseFirestore.podspec @@ -33,7 +33,8 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling, 'Firestore/Port/**/*', 'Firestore/Protos/objc/**/*.[hm]', 'Firestore/core/src/**/*.{h,cc}', - 'Firestore/third_party/Immutable/*.[mh]' + 'Firestore/third_party/Immutable/*.[mh]', + 'Firestore/third_party/abseil-cpp/absl/*.{h,cc}' ] s.requires_arc = [ 'Firestore/Source/**/*', @@ -54,9 +55,10 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling, s.frameworks = 'MobileCoreServices' s.library = 'c++' s.pod_target_xcconfig = { - 'GCC_PREPROCESSOR_DEFINITIONS' => - 'GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1 ', - 'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"', - 'OTHER_CFLAGS' => '-DFIRFirestore_VERSION=' + s.version.to_s + 'GCC_PREPROCESSOR_DEFINITIONS' => 'GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1 ', + 'HEADER_SEARCH_PATHS' => + '"${PODS_TARGET_SRCROOT}" ' + + '"${PODS_TARGET_SRCROOT}/Firestore/third_party/abseil-cpp"', + 'OTHER_CFLAGS' => '-DFIRFirestore_VERSION=' + s.version.to_s } end diff --git a/Firestore/Port/absl/absl_attributes.h b/Firestore/Port/absl/absl_attributes.h deleted file mode 100644 index d43930c..0000000 --- a/Firestore/Port/absl/absl_attributes.h +++ /dev/null @@ -1,644 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Various macros for C++ attributes -// Most macros here are exposing GCC or Clang features, and are stubbed out for -// other compilers. -// GCC attributes documentation: -// https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Function-Attributes.html -// https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Variable-Attributes.html -// https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Type-Attributes.html -// -// Most attributes in this file are already supported by GCC 4.7. -// However, some of them are not supported in older version of Clang. -// Thus, we check __has_attribute() first. If the check fails, we check if we -// are on GCC and assume the attribute exists on GCC (which is verified on GCC -// 4.7). -// -// For sanitizer-related attributes, define the following macros -// using -D along with the given value for -fsanitize: -// - ADDRESS_SANITIZER with -fsanitize=address (GCC 4.8+, Clang) -// - MEMORY_SANITIZER with -fsanitize=memory (Clang) -// - THREAD_SANITIZER with -fsanitize=thread (GCC 4.8+, Clang) -// - UNDEFINED_BEHAVIOR_SANITIZER with -fsanitize=undefined (GCC 4.9+, Clang) -// - CONTROL_FLOW_INTEGRITY with -fsanitize=cfi (Clang) -// Since these are only supported by GCC and Clang now, we only check for -// __GNUC__ (GCC or Clang) and the above macros. -#ifndef THIRD_PARTY_ABSL_BASE_ATTRIBUTES_H_ -#define THIRD_PARTY_ABSL_BASE_ATTRIBUTES_H_ - -// ABSL_HAVE_ATTRIBUTE is a function-like feature checking macro. -// It's a wrapper around __has_attribute, which is defined by GCC 5+ and Clang. -// It evaluates to a nonzero constant integer if the attribute is supported -// or 0 if not. -// It evaluates to zero if __has_attribute is not defined by the compiler. -// GCC: https://gcc.gnu.org/gcc-5/changes.html -// Clang: https://clang.llvm.org/docs/LanguageExtensions.html -#ifdef __has_attribute -#define ABSL_HAVE_ATTRIBUTE(x) __has_attribute(x) -#else -#define ABSL_HAVE_ATTRIBUTE(x) 0 -#endif - -// ABSL_HAVE_CPP_ATTRIBUTE is a function-like feature checking macro that -// accepts C++11 style attributes. It's a wrapper around __has_cpp_attribute, -// defined by ISO C++ SD-6 -// (http://en.cppreference.com/w/cpp/experimental/feature_test). If we don't -// find __has_cpp_attribute, will evaluate to 0. -#if defined(__cplusplus) && defined(__has_cpp_attribute) -// NOTE: requiring __cplusplus above should not be necessary, but -// works around https://bugs.llvm.org/show_bug.cgi?id=23435. -#define ABSL_HAVE_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) -#else -#define ABSL_HAVE_CPP_ATTRIBUTE(x) 0 -#endif - -// ----------------------------------------------------------------------------- -// Function Attributes -// ----------------------------------------------------------------------------- -// GCC: https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html -// Clang: https://clang.llvm.org/docs/AttributeReference.html - -// PRINTF_ATTRIBUTE, SCANF_ATTRIBUTE -// Tell the compiler to do printf format std::string checking if the -// compiler supports it; see the 'format' attribute in -// . -// -// N.B.: As the GCC manual states, "[s]ince non-static C++ methods -// have an implicit 'this' argument, the arguments of such methods -// should be counted from two, not one." -#if ABSL_HAVE_ATTRIBUTE(format) || (defined(__GNUC__) && !defined(__clang__)) -#define ABSL_PRINTF_ATTRIBUTE(string_index, first_to_check) \ - __attribute__((__format__(__printf__, string_index, first_to_check))) -#define ABSL_SCANF_ATTRIBUTE(string_index, first_to_check) \ - __attribute__((__format__(__scanf__, string_index, first_to_check))) -#else -#define ABSL_PRINTF_ATTRIBUTE(string_index, first_to_check) -#define ABSL_SCANF_ATTRIBUTE(string_index, first_to_check) -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(format) || (defined(__GNUC__) && !defined(__clang__)) -#define PRINTF_ATTRIBUTE(string_index, first_to_check) \ - __attribute__((__format__(__printf__, string_index, first_to_check))) -#define SCANF_ATTRIBUTE(string_index, first_to_check) \ - __attribute__((__format__(__scanf__, string_index, first_to_check))) -#else -#define PRINTF_ATTRIBUTE(string_index, first_to_check) -#define SCANF_ATTRIBUTE(string_index, first_to_check) -#endif - -// ATTRIBUTE_ALWAYS_INLINE, ATTRIBUTE_NOINLINE -// For functions we want to force inline or not inline. -// Introduced in gcc 3.1. -#if ABSL_HAVE_ATTRIBUTE(always_inline) || (defined(__GNUC__) && !defined(__clang__)) -#define ABSL_ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline)) -#define ABSL_HAVE_ATTRIBUTE_ALWAYS_INLINE 1 -#else -#define ABSL_ATTRIBUTE_ALWAYS_INLINE -#endif - -#if ABSL_HAVE_ATTRIBUTE(noinline) || (defined(__GNUC__) && !defined(__clang__)) -#define ABSL_ATTRIBUTE_NOINLINE __attribute__((noinline)) -#define ABSL_HAVE_ATTRIBUTE_NOINLINE 1 -#else -#define ABSL_ATTRIBUTE_NOINLINE -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(always_inline) || (defined(__GNUC__) && !defined(__clang__)) -#define ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline)) -#define HAVE_ATTRIBUTE_ALWAYS_INLINE 1 -#else -#define ATTRIBUTE_ALWAYS_INLINE -#endif - -#if ABSL_HAVE_ATTRIBUTE(noinline) || (defined(__GNUC__) && !defined(__clang__)) -#define ATTRIBUTE_NOINLINE __attribute__((noinline)) -#define HAVE_ATTRIBUTE_NOINLINE 1 -#else -#define ATTRIBUTE_NOINLINE -#endif - -// ATTRIBUTE_NO_TAIL_CALL -// Prevent the compiler from optimizing away stack frames for functions which -// end in a call to another function. -#if ABSL_HAVE_ATTRIBUTE(disable_tail_calls) -#define ABSL_HAVE_ATTRIBUTE_NO_TAIL_CALL 1 -#define ABSL_ATTRIBUTE_NO_TAIL_CALL __attribute__((disable_tail_calls)) -#elif defined(__GNUC__) && !defined(__clang__) -#define ABSL_HAVE_ATTRIBUTE_NO_TAIL_CALL 1 -#define ABSL_ATTRIBUTE_NO_TAIL_CALL __attribute__((optimize("no-optimize-sibling-calls"))) -#else -#define ABSL_ATTRIBUTE_NO_TAIL_CALL -#define ABSL_HAVE_ATTRIBUTE_NO_TAIL_CALL 0 -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(disable_tail_calls) -#define HAVE_ATTRIBUTE_NO_TAIL_CALL 1 -#define ATTRIBUTE_NO_TAIL_CALL __attribute__((disable_tail_calls)) -#elif defined(__GNUC__) && !defined(__clang__) -#define HAVE_ATTRIBUTE_NO_TAIL_CALL 1 -#define ATTRIBUTE_NO_TAIL_CALL __attribute__((optimize("no-optimize-sibling-calls"))) -#else -#define ATTRIBUTE_NO_TAIL_CALL -#define HAVE_ATTRIBUTE_NO_TAIL_CALL 0 -#endif - -// ATTRIBUTE_WEAK -// For weak functions -#if ABSL_HAVE_ATTRIBUTE(weak) || (defined(__GNUC__) && !defined(__clang__)) -#undef ABSL_ATTRIBUTE_WEAK -#define ABSL_ATTRIBUTE_WEAK __attribute__((weak)) -#define ABSL_HAVE_ATTRIBUTE_WEAK 1 -#else -#define ABSL_ATTRIBUTE_WEAK -#define ABSL_HAVE_ATTRIBUTE_WEAK 0 -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(weak) || (defined(__GNUC__) && !defined(__clang__)) -#undef ATTRIBUTE_WEAK -#define ATTRIBUTE_WEAK __attribute__((weak)) -#define HAVE_ATTRIBUTE_WEAK 1 -#else -#define ATTRIBUTE_WEAK -#define HAVE_ATTRIBUTE_WEAK 0 -#endif - -// ATTRIBUTE_NONNULL -// Tell the compiler either that a particular function parameter -// should be a non-null pointer, or that all pointer arguments should -// be non-null. -// -// Note: As the GCC manual states, "[s]ince non-static C++ methods -// have an implicit 'this' argument, the arguments of such methods -// should be counted from two, not one." -// -// Args are indexed starting at 1. -// For non-static class member functions, the implicit "this" argument -// is arg 1, and the first explicit argument is arg 2. -// For static class member functions, there is no implicit "this", and -// the first explicit argument is arg 1. -// -// /* arg_a cannot be null, but arg_b can */ -// void Function(void* arg_a, void* arg_b) ATTRIBUTE_NONNULL(1); -// -// class C { -// /* arg_a cannot be null, but arg_b can */ -// void Method(void* arg_a, void* arg_b) ATTRIBUTE_NONNULL(2); -// -// /* arg_a cannot be null, but arg_b can */ -// static void StaticMethod(void* arg_a, void* arg_b) ATTRIBUTE_NONNULL(1); -// }; -// -// If no arguments are provided, then all pointer arguments should be non-null. -// -// /* No pointer arguments may be null. */ -// void Function(void* arg_a, void* arg_b, int arg_c) ATTRIBUTE_NONNULL(); -// -// NOTE: The GCC nonnull attribute actually accepts a list of arguments, but -// ATTRIBUTE_NONNULL does not. -#if ABSL_HAVE_ATTRIBUTE(nonnull) || (defined(__GNUC__) && !defined(__clang__)) -#define ABSL_ATTRIBUTE_NONNULL(arg_index) __attribute__((nonnull(arg_index))) -#else -#define ABSL_ATTRIBUTE_NONNULL(...) -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(nonnull) || (defined(__GNUC__) && !defined(__clang__)) -#define ATTRIBUTE_NONNULL(arg_index) __attribute__((nonnull(arg_index))) -#else -#define ATTRIBUTE_NONNULL(...) -#endif - -// ATTRIBUTE_NORETURN -// Tell the compiler that a given function never returns -#if ABSL_HAVE_ATTRIBUTE(noreturn) || (defined(__GNUC__) && !defined(__clang__)) -#define ABSL_ATTRIBUTE_NORETURN __attribute__((noreturn)) -#elif defined(_MSC_VER) -#define ABSL_ATTRIBUTE_NORETURN __declspec(noreturn) -#else -#define ABSL_ATTRIBUTE_NORETURN -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(noreturn) || (defined(__GNUC__) && !defined(__clang__)) -#define ATTRIBUTE_NORETURN __attribute__((noreturn)) -#elif defined(_MSC_VER) -#define ATTRIBUTE_NORETURN __declspec(noreturn) -#else -#define ATTRIBUTE_NORETURN -#endif - -// ATTRIBUTE_NO_SANITIZE_ADDRESS -// Tell AddressSanitizer (or other memory testing tools) to ignore a given -// function. Useful for cases when a function reads random locations on stack, -// calls _exit from a cloned subprocess, deliberately accesses buffer -// out of bounds or does other scary things with memory. -// NOTE: GCC supports AddressSanitizer(asan) since 4.8. -// https://gcc.gnu.org/gcc-4.8/changes.html -#if defined(__GNUC__) && defined(ADDRESS_SANITIZER) -#define ABSL_ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address)) -#else -#define ABSL_ATTRIBUTE_NO_SANITIZE_ADDRESS -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if defined(__GNUC__) && defined(ADDRESS_SANITIZER) -#define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address)) -#else -#define ATTRIBUTE_NO_SANITIZE_ADDRESS -#endif - -// ATTRIBUTE_NO_SANITIZE_MEMORY -// Tell MemorySanitizer to relax the handling of a given function. All "Use of -// uninitialized value" warnings from such functions will be suppressed, and all -// values loaded from memory will be considered fully initialized. -// This is similar to the ADDRESS_SANITIZER attribute above, but deals with -// initializedness rather than addressability issues. -// NOTE: MemorySanitizer(msan) is supported by Clang but not GCC. -#if defined(__GNUC__) && defined(MEMORY_SANITIZER) -#define ABSL_ATTRIBUTE_NO_SANITIZE_MEMORY __attribute__((no_sanitize_memory)) -#else -#define ABSL_ATTRIBUTE_NO_SANITIZE_MEMORY -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if defined(__GNUC__) && defined(MEMORY_SANITIZER) -#define ATTRIBUTE_NO_SANITIZE_MEMORY __attribute__((no_sanitize_memory)) -#else -#define ATTRIBUTE_NO_SANITIZE_MEMORY -#endif - -// ATTRIBUTE_NO_SANITIZE_THREAD -// Tell ThreadSanitizer to not instrument a given function. -// If you are adding this attribute, please cc dynamic-tools@ on the cl. -// NOTE: GCC supports ThreadSanitizer(tsan) since 4.8. -// https://gcc.gnu.org/gcc-4.8/changes.html -#if defined(__GNUC__) && defined(THREAD_SANITIZER) -#define ABSL_ATTRIBUTE_NO_SANITIZE_THREAD __attribute__((no_sanitize_thread)) -#else -#define ABSL_ATTRIBUTE_NO_SANITIZE_THREAD -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if defined(__GNUC__) && defined(THREAD_SANITIZER) -#define ATTRIBUTE_NO_SANITIZE_THREAD __attribute__((no_sanitize_thread)) -#else -#define ATTRIBUTE_NO_SANITIZE_THREAD -#endif - -// ATTRIBUTE_NO_SANITIZE_UNDEFINED -// Tell UndefinedSanitizer to ignore a given function. Useful for cases -// where certain behavior (eg. devision by zero) is being used intentionally. -// NOTE: GCC supports UndefinedBehaviorSanitizer(ubsan) since 4.9. -// https://gcc.gnu.org/gcc-4.9/changes.html -#if defined(__GNUC__) && defined(UNDEFINED_BEHAVIOR_SANITIZER) -#define ABSL_ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize("undefined"))) -#else -#define ABSL_ATTRIBUTE_NO_SANITIZE_UNDEFINED -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if defined(__GNUC__) && defined(UNDEFINED_BEHAVIOR_SANITIZER) -#define ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize("undefined"))) -#else -#define ATTRIBUTE_NO_SANITIZE_UNDEFINED -#endif - -// ATTRIBUTE_NO_SANITIZE_CFI -// Tell ControlFlowIntegrity sanitizer to not instrument a given function. -#if defined(__GNUC__) && defined(CONTROL_FLOW_INTEGRITY) -#define ABSL_ATTRIBUTE_NO_SANITIZE_CFI __attribute__((no_sanitize("cfi"))) -#else -#define ABSL_ATTRIBUTE_NO_SANITIZE_CFI -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if defined(__GNUC__) && defined(CONTROL_FLOW_INTEGRITY) -#define ATTRIBUTE_NO_SANITIZE_CFI __attribute__((no_sanitize("cfi"))) -#else -#define ATTRIBUTE_NO_SANITIZE_CFI -#endif - -// ATTRIBUTE_SECTION -// Labeled sections are not supported on Darwin/iOS. -#ifdef ABSL_HAVE_ATTRIBUTE_SECTION -#error ABSL_HAVE_ATTRIBUTE_SECTION cannot be directly set -#elif (ABSL_HAVE_ATTRIBUTE(section) || (defined(__GNUC__) && !defined(__clang__))) && \ - !(defined(__APPLE__) && defined(__MACH__)) -#define ABSL_HAVE_ATTRIBUTE_SECTION 1 -// -// Tell the compiler/linker to put a given function into a section and define -// "__start_ ## name" and "__stop_ ## name" symbols to bracket the section. -// This functionality is supported by GNU linker. -// Any function with ATTRIBUTE_SECTION must not be inlined, or it will -// be placed into whatever section its caller is placed into. -// -#ifndef ABSL_ATTRIBUTE_SECTION -#define ABSL_ATTRIBUTE_SECTION(name) __attribute__((section(#name))) __attribute__((noinline)) -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#ifndef ATTRIBUTE_SECTION -#define ATTRIBUTE_SECTION(name) __attribute__((section(#name))) __attribute__((noinline)) -#endif - -// Tell the compiler/linker to put a given variable into a section and define -// "__start_ ## name" and "__stop_ ## name" symbols to bracket the section. -// This functionality is supported by GNU linker. -#ifndef ABSL_ATTRIBUTE_SECTION_VARIABLE -#define ABSL_ATTRIBUTE_SECTION_VARIABLE(name) __attribute__((section(#name))) -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#ifndef ATTRIBUTE_SECTION_VARIABLE -#define ATTRIBUTE_SECTION_VARIABLE(name) __attribute__((section(#name))) -#endif - -// -// Weak section declaration to be used as a global declaration -// for ATTRIBUTE_SECTION_START|STOP(name) to compile and link -// even without functions with ATTRIBUTE_SECTION(name). -// DEFINE_ATTRIBUTE_SECTION should be in the exactly one file; it's -// a no-op on ELF but not on Mach-O. -// -#ifndef ABSL_DECLARE_ATTRIBUTE_SECTION_VARS -#define ABSL_DECLARE_ATTRIBUTE_SECTION_VARS(name) \ - extern char __start_##name[] ATTRIBUTE_WEAK; \ - extern char __stop_##name[] ATTRIBUTE_WEAK -#endif -#ifndef ABSL_DEFINE_ATTRIBUTE_SECTION_VARS -#define ABSL_INIT_ATTRIBUTE_SECTION_VARS(name) -#define ABSL_DEFINE_ATTRIBUTE_SECTION_VARS(name) -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#ifndef DECLARE_ATTRIBUTE_SECTION_VARS -#define DECLARE_ATTRIBUTE_SECTION_VARS(name) \ - extern char __start_##name[] ATTRIBUTE_WEAK; \ - extern char __stop_##name[] ATTRIBUTE_WEAK -#endif -#ifndef DEFINE_ATTRIBUTE_SECTION_VARS -#define INIT_ATTRIBUTE_SECTION_VARS(name) -#define DEFINE_ATTRIBUTE_SECTION_VARS(name) -#endif - -// -// Return void* pointers to start/end of a section of code with -// functions having ATTRIBUTE_SECTION(name). -// Returns 0 if no such functions exits. -// One must DECLARE_ATTRIBUTE_SECTION_VARS(name) for this to compile and link. -// -#define ABSL_ATTRIBUTE_SECTION_START(name) (reinterpret_cast(__start_##name)) -#define ABSL_ATTRIBUTE_SECTION_STOP(name) (reinterpret_cast(__stop_##name)) - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#define ATTRIBUTE_SECTION_START(name) (reinterpret_cast(__start_##name)) -#define ATTRIBUTE_SECTION_STOP(name) (reinterpret_cast(__stop_##name)) - -#else // !ABSL_HAVE_ATTRIBUTE_SECTION - -#define ABSL_HAVE_ATTRIBUTE_SECTION 0 - -// provide dummy definitions -#define ABSL_ATTRIBUTE_SECTION(name) -#define ABSL_ATTRIBUTE_SECTION_VARIABLE(name) -#define ABSL_INIT_ATTRIBUTE_SECTION_VARS(name) -#define ABSL_DEFINE_ATTRIBUTE_SECTION_VARS(name) -#define ABSL_DECLARE_ATTRIBUTE_SECTION_VARS(name) -#define ABSL_ATTRIBUTE_SECTION_START(name) (reinterpret_cast(0)) -#define ABSL_ATTRIBUTE_SECTION_STOP(name) (reinterpret_cast(0)) - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#define ATTRIBUTE_SECTION(name) -#define ATTRIBUTE_SECTION_VARIABLE(name) -#define INIT_ATTRIBUTE_SECTION_VARS(name) -#define DEFINE_ATTRIBUTE_SECTION_VARS(name) -#define DECLARE_ATTRIBUTE_SECTION_VARS(name) -#define ATTRIBUTE_SECTION_START(name) (reinterpret_cast(0)) -#define ATTRIBUTE_SECTION_STOP(name) (reinterpret_cast(0)) - -#endif // ATTRIBUTE_SECTION - -// ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC -// Support for aligning the stack on 32-bit x86. -#if ABSL_HAVE_ATTRIBUTE(force_align_arg_pointer) || (defined(__GNUC__) && !defined(__clang__)) -#if defined(__i386__) -#define ABSL_ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC __attribute__((force_align_arg_pointer)) -#define ABSL_REQUIRE_STACK_ALIGN_TRAMPOLINE (0) -#elif defined(__x86_64__) -#define ABSL_REQUIRE_STACK_ALIGN_TRAMPOLINE (1) -#define ABSL_ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC -#else // !__i386__ && !__x86_64 -#define ABSL_REQUIRE_STACK_ALIGN_TRAMPOLINE (0) -#define ABSL_ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC -#endif // __i386__ -#else -#define ABSL_ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC -#define ABSL_REQUIRE_STACK_ALIGN_TRAMPOLINE (0) -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(force_align_arg_pointer) || (defined(__GNUC__) && !defined(__clang__)) -#if defined(__i386__) -#define ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC __attribute__((force_align_arg_pointer)) -#define REQUIRE_STACK_ALIGN_TRAMPOLINE (0) -#elif defined(__x86_64__) -#define REQUIRE_STACK_ALIGN_TRAMPOLINE (1) -#define ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC -#else // !__i386__ && !__x86_64 -#define REQUIRE_STACK_ALIGN_TRAMPOLINE (0) -#define ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC -#endif // __i386__ -#else -#define ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC -#define REQUIRE_STACK_ALIGN_TRAMPOLINE (0) -#endif - -// MUST_USE_RESULT -// Tell the compiler to warn about unused return values for functions declared -// with this macro. The macro must appear as the very first part of a function -// declaration or definition: -// -// MUST_USE_RESULT Sprocket* AllocateSprocket(); -// -// This placement has the broadest compatibility with GCC, Clang, and MSVC, with -// both defs and decls, and with GCC-style attributes, MSVC declspec, and C++11 -// attributes. Note: past advice was to place the macro after the argument list. -#if ABSL_HAVE_ATTRIBUTE(warn_unused_result) || (defined(__GNUC__) && !defined(__clang__)) -#define ABSL_MUST_USE_RESULT __attribute__((warn_unused_result)) -#else -#define ABSL_MUST_USE_RESULT -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(warn_unused_result) || (defined(__GNUC__) && !defined(__clang__)) -#define MUST_USE_RESULT __attribute__((warn_unused_result)) -#else -#define MUST_USE_RESULT -#endif - -// ATTRIBUTE_HOT, ATTRIBUTE_COLD -// Tell GCC that a function is hot or cold. GCC can use this information to -// improve static analysis, i.e. a conditional branch to a cold function -// is likely to be not-taken. -// This annotation is used for function declarations, e.g.: -// int foo() ATTRIBUTE_HOT; -#if ABSL_HAVE_ATTRIBUTE(hot) || (defined(__GNUC__) && !defined(__clang__)) -#define ABSL_ATTRIBUTE_HOT __attribute__((hot)) -#else -#define ABSL_ATTRIBUTE_HOT -#endif - -#if ABSL_HAVE_ATTRIBUTE(cold) || (defined(__GNUC__) && !defined(__clang__)) -#define ABSL_ATTRIBUTE_COLD __attribute__((cold)) -#else -#define ABSL_ATTRIBUTE_COLD -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(hot) || (defined(__GNUC__) && !defined(__clang__)) -#define ATTRIBUTE_HOT __attribute__((hot)) -#else -#define ATTRIBUTE_HOT -#endif - -#if ABSL_HAVE_ATTRIBUTE(cold) || (defined(__GNUC__) && !defined(__clang__)) -#define ATTRIBUTE_COLD __attribute__((cold)) -#else -#define ATTRIBUTE_COLD -#endif - -// ABSL_XRAY_ALWAYS_INSTRUMENT, ABSL_XRAY_NEVER_INSTRUMENT, ABSL_XRAY_LOG_ARGS -// -// We define the ABSL_XRAY_ALWAYS_INSTRUMENT and ABSL_XRAY_NEVER_INSTRUMENT -// macro used as an attribute to mark functions that must always or never be -// instrumented by XRay. Currently, this is only supported in Clang/LLVM. -// -// For reference on the LLVM XRay instrumentation, see -// http://llvm.org/docs/XRay.html. -// -// A function with the XRAY_ALWAYS_INSTRUMENT macro attribute in its declaration -// will always get the XRay instrumentation sleds. These sleds may introduce -// some binary size and runtime overhead and must be used sparingly. -// -// These attributes only take effect when the following conditions are met: -// -// - The file/target is built in at least C++11 mode, with a Clang compiler -// that supports XRay attributes. -// - The file/target is built with the -fxray-instrument flag set for the -// Clang/LLVM compiler. -// - The function is defined in the translation unit (the compiler honors the -// attribute in either the definition or the declaration, and must match). -// -// There are cases when, even when building with XRay instrumentation, users -// might want to control specifically which functions are instrumented for a -// particular build using special-case lists provided to the compiler. These -// special case lists are provided to Clang via the -// -fxray-always-instrument=... and -fxray-never-instrument=... flags. The -// attributes in source take precedence over these special-case lists. -// -// To disable the XRay attributes at build-time, users may define -// ABSL_NO_XRAY_ATTRIBUTES. Do NOT define ABSL_NO_XRAY_ATTRIBUTES on specific -// packages/targets, as this may lead to conflicting definitions of functions at -// link-time. -// -#if ABSL_HAVE_CPP_ATTRIBUTE(clang::xray_always_instrument) && !defined(ABSL_NO_XRAY_ATTRIBUTES) -#define ABSL_XRAY_ALWAYS_INSTRUMENT [[clang::xray_always_instrument]] -#define ABSL_XRAY_NEVER_INSTRUMENT [[clang::xray_never_instrument]] -#define ABSL_XRAY_LOG_ARGS(N) [[ clang::xray_always_instrument, clang::xray_log_args(N) ]] -#else -#define ABSL_XRAY_ALWAYS_INSTRUMENT -#define ABSL_XRAY_NEVER_INSTRUMENT -#define ABSL_XRAY_LOG_ARGS(N) -#endif - -// ----------------------------------------------------------------------------- -// Variable Attributes -// ----------------------------------------------------------------------------- - -// ATTRIBUTE_UNUSED -// Prevent the compiler from complaining about or optimizing away variables -// that appear unused. -#if ABSL_HAVE_ATTRIBUTE(unused) || (defined(__GNUC__) && !defined(__clang__)) -#undef ABSL_ATTRIBUTE_UNUSED -#define ABSL_ATTRIBUTE_UNUSED __attribute__((__unused__)) -#else -#define ABSL_ATTRIBUTE_UNUSED -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(unused) || (defined(__GNUC__) && !defined(__clang__)) -#undef ATTRIBUTE_UNUSED -#define ATTRIBUTE_UNUSED __attribute__((__unused__)) -#else -#define ATTRIBUTE_UNUSED -#endif - -// ATTRIBUTE_INITIAL_EXEC -// Tell the compiler to use "initial-exec" mode for a thread-local variable. -// See http://people.redhat.com/drepper/tls.pdf for the gory details. -#if ABSL_HAVE_ATTRIBUTE(tls_model) || (defined(__GNUC__) && !defined(__clang__)) -#define ABSL_ATTRIBUTE_INITIAL_EXEC __attribute__((tls_model("initial-exec"))) -#else -#define ABSL_ATTRIBUTE_INITIAL_EXEC -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(tls_model) || (defined(__GNUC__) && !defined(__clang__)) -#define ATTRIBUTE_INITIAL_EXEC __attribute__((tls_model("initial-exec"))) -#else -#define ATTRIBUTE_INITIAL_EXEC -#endif - -// ATTRIBUTE_PACKED -// Prevent the compiler from padding a structure to natural alignment -#if ABSL_HAVE_ATTRIBUTE(packed) || (defined(__GNUC__) && !defined(__clang__)) -#define ABSL_ATTRIBUTE_PACKED __attribute__((__packed__)) -#else -#define ABSL_ATTRIBUTE_PACKED -#endif - -// To be deleted macros. All macros are going te be renamed with ABSL_ prefix. -#if ABSL_HAVE_ATTRIBUTE(packed) || (defined(__GNUC__) && !defined(__clang__)) -#define ATTRIBUTE_PACKED __attribute__((__packed__)) -#else -#define ATTRIBUTE_PACKED -#endif - -// ABSL_CONST_INIT -// A variable declaration annotated with the ABSL_CONST_INIT attribute will -// not compile (on supported platforms) unless the variable has a constant -// initializer. This is useful for variables with static and thread storage -// duration, because it guarantees that they will not suffer from the so-called -// "static init order fiasco". -// -// Sample usage: -// -// ABSL_CONST_INIT static MyType my_var = MakeMyType(...); -// -// Note that this attribute is redundant if the variable is declared constexpr. -#if ABSL_HAVE_CPP_ATTRIBUTE(clang::require_constant_initialization) -// NOLINTNEXTLINE(whitespace/braces) (b/36288871) -#define ABSL_CONST_INIT [[clang::require_constant_initialization]] -#else -#define ABSL_CONST_INIT -#endif // ABSL_HAVE_CPP_ATTRIBUTE(clang::require_constant_initialization) - -#endif // THIRD_PARTY_ABSL_BASE_ATTRIBUTES_H_ diff --git a/Firestore/Port/absl/absl_config.h b/Firestore/Port/absl/absl_config.h deleted file mode 100644 index 70f4d86..0000000 --- a/Firestore/Port/absl/absl_config.h +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Defines preprocessor macros describing the presence of "features" available. -// This facilitates writing portable code by parameterizing the compilation -// based on the presence or lack of a feature. -// -// We define a feature as some interface we wish to program to: for example, -// some library function or system call. -// -// For example, suppose a programmer wants to write a program that uses the -// 'mmap' system call. Then one might write: -// -// #include "absl/base/config.h" -// -// #ifdef ABSL_HAVE_MMAP -// #include "sys/mman.h" -// #endif //ABSL_HAVE_MMAP -// -// ... -// #ifdef ABSL_HAVE_MMAP -// void *ptr = mmap(...); -// ... -// #endif // ABSL_HAVE_MMAP -// -// As a special note, using feature macros from config.h to determine whether -// to include a particular header requires violating the style guide's required -// ordering for headers: this is permitted. - -#ifndef THIRD_PARTY_ABSL_BASE_CONFIG_H_ -#define THIRD_PARTY_ABSL_BASE_CONFIG_H_ - -// Included for the __GLIBC__ macro (or similar macros on other systems). -#include - -#ifdef __cplusplus -// Included for __GLIBCXX__, _LIBCPP_VERSION -#include -#endif // __cplusplus - -// If we're using glibc, make sure we meet a minimum version requirement -// before we proceed much further. -// -// We have chosen glibc 2.12 as the minimum as it was tagged for release -// in May, 2010 and includes some functionality used in Google software -// (for instance pthread_setname_np): -// https://sourceware.org/ml/libc-alpha/2010-05/msg00000.html -#ifdef __GLIBC_PREREQ -#if !__GLIBC_PREREQ(2, 12) -#error "Minimum required version of glibc is 2.12." -#endif -#endif - -// ABSL_HAVE_BUILTIN is a function-like feature checking macro. -// It's a wrapper around __has_builtin, which is defined by only clang now. -// It evaluates to 1 if the builtin is supported or 0 if not. -// Define it to avoid an extra level of #ifdef __has_builtin check. -// http://releases.llvm.org/3.3/tools/clang/docs/LanguageExtensions.html -#ifdef __has_builtin -#define ABSL_HAVE_BUILTIN(x) __has_builtin(x) -#else -#define ABSL_HAVE_BUILTIN(x) 0 -#endif - -// ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE is defined when -// std::is_trivially_destructible is supported. -// -// All supported compilers using libc++ have it, as does gcc >= 4.8 -// using libstdc++, as does Visual Studio. -// https://gcc.gnu.org/onlinedocs/gcc-4.8.1/libstdc++/manual/manual/status.html#status.iso.2011 -// is the first version where std::is_trivially_destructible no longer -// appeared as missing in the Type properties row. -#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE -#error ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE cannot be directly set -#elif defined(_LIBCPP_VERSION) || \ - (!defined(__clang__) && defined(__GNUC__) && defined(__GLIBCXX__) && \ - (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) || \ - defined(_MSC_VER) -#define ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE 1 -#endif - -// ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE is defined when -// std::is_trivially_default_constructible and -// std::is_trivially_copy_constructible are supported. -// -// ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE is defined when -// std::is_trivially_copy_assignable is supported. -// -// Clang with libc++ supports it, as does gcc >= 5.1 with either -// libc++ or libstdc++, as does Visual Studio. -// https://gcc.gnu.org/gcc-5/changes.html lists as new -// "std::is_trivially_constructible, std::is_trivially_assignable -// etc." -#if defined(ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE) -#error ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE cannot be directly set -#elif defined(ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE) -#error ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE cannot directly set -#elif (defined(__clang__) && defined(_LIBCPP_VERSION)) || \ - (!defined(__clang__) && defined(__GNUC__) && \ - (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)) && \ - (defined(_LIBCPP_VERSION) || defined(__GLIBCXX__))) || \ - defined(_MSC_VER) -#define ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE 1 -#define ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE 1 -#endif - -// ABSL_HAVE_THREAD_LOCAL is defined when C++11's thread_local is available. -// Clang implements thread_local keyword but Xcode did not support the -// implementation until Xcode 8. -#ifdef ABSL_HAVE_THREAD_LOCAL -#error ABSL_HAVE_THREAD_LOCAL cannot be directly set -#elif !defined(__apple_build_version__) || __apple_build_version__ >= 8000042 -#define ABSL_HAVE_THREAD_LOCAL 1 -#endif - -// ABSL_HAVE_INTRINSIC_INT128 is defined when the implementation provides the -// 128 bit integral type: __int128. -// -// __SIZEOF_INT128__ is defined by Clang and GCC when __int128 is supported. -// Clang on ppc64 and aarch64 are exceptions where __int128 exists but has a -// sporadic compiler crashing bug. Nvidia's nvcc also defines __GNUC__ and -// __SIZEOF_INT128__ but not all versions that do this support __int128. Support -// has been tested for versions >= 7. -#ifdef ABSL_HAVE_INTRINSIC_INT128 -#error ABSL_HAVE_INTRINSIC_INT128 cannot be directly set -#elif (defined(__clang__) && defined(__SIZEOF_INT128__) && !defined(__ppc64__) && \ - !defined(__aarch64__)) || \ - (defined(__CUDACC__) && defined(__SIZEOF_INT128__) && __CUDACC_VER__ >= 70000) || \ - (!defined(__clang__) && !defined(__CUDACC__) && defined(__GNUC__) && \ - defined(__SIZEOF_INT128__)) -#define ABSL_HAVE_INTRINSIC_INT128 1 -#endif - -// Operating system-specific features. -// -// Currently supported operating systems and associated preprocessor -// symbols: -// -// Linux and Linux-derived __linux__ -// Android __ANDROID__ (implies __linux__) -// Linux (non-Android) __linux__ && !__ANDROID__ -// Darwin (Mac OS X and iOS) __APPLE__ && __MACH__ -// Akaros (http://akaros.org) __ros__ -// Windows _WIN32 -// NaCL __native_client__ -// AsmJS __asmjs__ -// Fuschia __Fuchsia__ -// -// Note that since Android defines both __ANDROID__ and __linux__, one -// may probe for either Linux or Android by simply testing for __linux__. -// - -// ABSL_HAVE_MMAP is defined when the system has an mmap(2) implementation -// as defined in POSIX.1-2001. -#ifdef ABSL_HAVE_MMAP -#error ABSL_HAVE_MMAP cannot be directly set -#elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__ros__) || \ - defined(__native_client__) || defined(__asmjs__) || defined(__Fuchsia__) -#define ABSL_HAVE_MMAP 1 -#endif - -// ABSL_HAS_PTHREAD_GETSCHEDPARAM is defined when the system implements the -// pthread_(get|set)schedparam(3) functions as defined in POSIX.1-2001. -#ifdef ABSL_HAVE_PTHREAD_GETSCHEDPARAM -#error ABSL_HAVE_PTHREAD_GETSCHEDPARAM cannot be directly set -#elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__ros__) -#define ABSL_HAVE_PTHREAD_GETSCHEDPARAM 1 -#endif - -// ABSL_HAVE_SCHED_YIELD is defined when the system implements -// sched_yield(2) as defined in POSIX.1-2001. -#ifdef ABSL_HAVE_SCHED_YIELD -#error ABSL_HAVE_SCHED_YIELD cannot be directly set -#elif defined(__linux__) || defined(__ros__) || defined(__native_client__) -#define ABSL_HAVE_SCHED_YIELD 1 -#endif - -// ABSL_HAVE_SEMAPHORE_H is defined when the system supports the -// header and sem_open(3) family of functions as standardized in POSIX.1-2001. -// -// Note: While Apple does have for both iOS and macOS, it is -// explicity deprecated and will cause build failures if enabled for those -// systems. We side-step the issue by not defining it here for Apple platforms. -#ifdef ABSL_HAVE_SEMAPHORE_H -#error ABSL_HAVE_SEMAPHORE_H cannot be directly set -#elif defined(__linux__) || defined(__ros__) -#define ABSL_HAVE_SEMAPHORE_H 1 -#endif - -// Library-specific features. -#ifdef ABSL_HAVE_ALARM -#error ABSL_HAVE_ALARM cannot be directly set -#elif defined(__GOOGLE_GRTE_VERSION__) -// feature tests for Google's GRTE -#define ABSL_HAVE_ALARM 1 -#elif defined(__GLIBC__) -// feature test for glibc -#define ABSL_HAVE_ALARM 1 -#elif defined(_MSC_VER) -// feature tests for Microsoft's library -#elif defined(__native_client__) -#else -// other standard libraries -#define ABSL_HAVE_ALARM 1 -#endif - -#if defined(_STLPORT_VERSION) -#error "STLPort is not supported." -#endif - -// ----------------------------------------------------------------------------- -// Endianness -// ----------------------------------------------------------------------------- -// Define ABSL_IS_LITTLE_ENDIAN, ABSL_IS_BIG_ENDIAN. -// Some compilers or system headers provide macros to specify endianness. -// Unfortunately, there is no standard for the names of the macros or even of -// the header files. -// Reference: https://sourceforge.net/p/predef/wiki/Endianness/ -#if defined(ABSL_IS_BIG_ENDIAN) || defined(ABSL_IS_LITTLE_ENDIAN) -#error "ABSL_IS_(BIG|LITTLE)_ENDIAN cannot be directly set." - -#elif defined(__GLIBC__) || defined(__linux__) -// Operating systems that use the GNU C library generally provide -// containing __BYTE_ORDER, __LITTLE_ENDIAN, __BIG_ENDIAN. -#include - -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define ABSL_IS_LITTLE_ENDIAN 1 -#elif __BYTE_ORDER == __BIG_ENDIAN -#define ABSL_IS_BIG_ENDIAN 1 -#else // __BYTE_ORDER != __LITTLE_ENDIAN && __BYTE_ORDER != __BIG_ENDIAN -#error "Unknown endianness" -#endif // __BYTE_ORDER - -#elif defined(__APPLE__) && defined(__MACH__) -// Apple has containing BYTE_ORDER, BIG_ENDIAN, -// LITTLE_ENDIAN. -#include // NOLINT(build/include) - -#if BYTE_ORDER == LITTLE_ENDIAN -#define ABSL_IS_LITTLE_ENDIAN 1 -#elif BYTE_ORDER == BIG_ENDIAN -#define ABSL_IS_BIG_ENDIAN 1 -#else // BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN -#error "Unknown endianness" -#endif // BYTE_ORDER - -#elif defined(_WIN32) -// Assume Windows is little-endian. -#define ABSL_IS_LITTLE_ENDIAN 1 - -#elif defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || defined(__THUMBEL__) || \ - defined(__AARCH64EL__) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) -#define ABSL_IS_LITTLE_ENDIAN 1 - -#elif defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || \ - defined(__AARCH64EB__) || defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) -#define ABSL_IS_BIG_ENDIAN 1 - -#else -#error "absl endian detection needs to be set up on your platform." -#endif - -// ABSL_HAVE_EXCEPTIONS is defined when exceptions are enabled. Many -// compilers support a "no exceptions" mode that disables exceptions. -// -// Generally, when ABSL_HAVE_EXCEPTIONS is not defined: -// -// - Code using `throw` and `try` may not compile. -// - The `noexcept` specifier will still compile and behave as normal. -// - The `noexcept` operator may still return `false`. -// -// For further details, consult the compiler's documentation. -#ifdef ABSL_HAVE_EXCEPTIONS -#error ABSL_HAVE_EXCEPTIONS cannot be directly set. - -#elif defined(__clang__) -// TODO -// Switch to using __cpp_exceptions when we no longer support versions < 3.6. -// For details on this check, see: -// https://goo.gl/PilDrJ -#if defined(__EXCEPTIONS) && __has_feature(cxx_exceptions) -#define ABSL_HAVE_EXCEPTIONS 1 -#endif // defined(__EXCEPTIONS) && __has_feature(cxx_exceptions) - -// Handle remaining special cases and default to exceptions being supported. -#elif !(defined(__GNUC__) && (__GNUC__ < 5) && !defined(__EXCEPTIONS)) && \ - !(defined(__GNUC__) && (__GNUC__ >= 5) && !defined(__cpp_exceptions)) && \ - !(defined(_MSC_VER) && !defined(_CPPUNWIND)) -#define ABSL_HAVE_EXCEPTIONS 1 -#endif - -#endif // THIRD_PARTY_ABSL_BASE_CONFIG_H_ diff --git a/Firestore/Port/absl/absl_endian.h b/Firestore/Port/absl/absl_endian.h deleted file mode 100644 index 2c51a27..0000000 --- a/Firestore/Port/absl/absl_endian.h +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ABSL_BASE_INTERNAL_ENDIAN_H_ -#define ABSL_BASE_INTERNAL_ENDIAN_H_ - -// The following guarantees declaration of the byte swap functions -#ifdef _MSC_VER -#include // NOLINT(build/include) -#elif defined(__APPLE__) && defined(__MACH__) -// Mac OS X / Darwin features -#include -#elif defined(__GLIBC__) -#include // IWYU pragma: export -#endif - -#include -#include "Firestore/Port/absl/absl_port.h" - -namespace absl { - -// Use compiler byte-swapping intrinsics if they are available. 32-bit -// and 64-bit versions are available in Clang and GCC as of GCC 4.3.0. -// The 16-bit version is available in Clang and GCC only as of GCC 4.8.0. -// For simplicity, we enable them all only for GCC 4.8.0 or later. -#if defined(__clang__) || \ - (defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || __GNUC__ >= 5)) -inline uint64_t gbswap_64(uint64_t host_int) { - return __builtin_bswap64(host_int); -} -inline uint32_t gbswap_32(uint32_t host_int) { - return __builtin_bswap32(host_int); -} -inline uint16 gbswap_16(uint16 host_int) { - return __builtin_bswap16(host_int); -} - -#elif defined(_MSC_VER) -inline uint64_t gbswap_64(uint64_t host_int) { - return _byteswap_uint64(host_int); -} -inline uint32_t gbswap_32(uint32_t host_int) { - return _byteswap_ulong(host_int); -} -inline uint16 gbswap_16(uint16 host_int) { - return _byteswap_ushort(host_int); -} - -#elif defined(__APPLE__) && defined(__MACH__) -inline uint64_t gbswap_64(uint64_t host_int) { - return OSSwapInt16(host_int); -} -inline uint32_t gbswap_32(uint32_t host_int) { - return OSSwapInt32(host_int); -} -inline uint16 gbswap_16(uint16 host_int) { - return OSSwapInt64(host_int); -} - -#else -inline uint64_t gbswap_64(uint64_t host_int) { -#if defined(__GNUC__) && defined(__x86_64__) && !(defined(__APPLE__) && defined(__MACH__)) - // Adapted from /usr/include/byteswap.h. Not available on Mac. - if (__builtin_constant_p(host_int)) { - return __bswap_constant_64(host_int); - } else { - register uint64_t result; - __asm__("bswap %0" : "=r"(result) : "0"(host_int)); - return result; - } -#elif defined(__GLIBC__) - return bswap_64(host_int); -#else - return (((x & GG_ULONGLONG(0xFF)) << 56) | ((x & GG_ULONGLONG(0xFF00)) << 40) | - ((x & GG_ULONGLONG(0xFF0000)) << 24) | ((x & GG_ULONGLONG(0xFF000000)) << 8) | - ((x & GG_ULONGLONG(0xFF00000000)) >> 8) | ((x & GG_ULONGLONG(0xFF0000000000)) >> 24) | - ((x & GG_ULONGLONG(0xFF000000000000)) >> 40) | - ((x & GG_ULONGLONG(0xFF00000000000000)) >> 56)); -#endif // bswap_64 -} - -inline uint32_t gbswap_32(uint32_t host_int) { -#if defined(__GLIBC__) - return bswap_32(host_int); -#else - return (((x & 0xFF) << 24) | ((x & 0xFF00) << 8) | ((x & 0xFF0000) >> 8) | - ((x & 0xFF000000) >> 24)); -#endif -} - -inline uint16 gbswap_16(uint16 host_int) { -#if defined(__GLIBC__) - return bswap_16(host_int); -#else - return (uint16)(((x & 0xFF) << 8) | ((x & 0xFF00) >> 8)); // NOLINT -#endif -} - -#endif // intrinics available - -#ifdef ABSL_IS_LITTLE_ENDIAN - -// Definitions for ntohl etc. that don't require us to include -// netinet/in.h. We wrap gbswap_32 and gbswap_16 in functions rather -// than just #defining them because in debug mode, gcc doesn't -// correctly handle the (rather involved) definitions of bswap_32. -// gcc guarantees that inline functions are as fast as macros, so -// this isn't a performance hit. -inline uint16 ghtons(uint16 x) { - return gbswap_16(x); -} -inline uint32_t ghtonl(uint32_t x) { - return gbswap_32(x); -} -inline uint64_t ghtonll(uint64_t x) { - return gbswap_64(x); -} - -#elif defined ABSL_IS_BIG_ENDIAN - -// These definitions are simpler on big-endian machines -// These are functions instead of macros to avoid self-assignment warnings -// on calls such as "i = ghtnol(i);". This also provides type checking. -inline uint16 ghtons(uint16 x) { - return x; -} -inline uint32_t ghtonl(uint32_t x) { - return x; -} -inline uint64_t ghtonll(uint64_t x) { - return x; -} - -#else -#error \ - "Unsupported byte order: Either ABSL_IS_BIG_ENDIAN or " \ - "ABSL_IS_LITTLE_ENDIAN must be defined" -#endif // byte order - -inline uint16 gntohs(uint16 x) { - return ghtons(x); -} -inline uint32_t gntohl(uint32_t x) { - return ghtonl(x); -} -inline uint64_t gntohll(uint64_t x) { - return ghtonll(x); -} - -// Utilities to convert numbers between the current hosts's native byte -// order and little-endian byte order -// -// Load/Store methods are alignment safe -namespace little_endian { -// Conversion functions. -#ifdef ABSL_IS_LITTLE_ENDIAN - -inline uint16 FromHost16(uint16 x) { - return x; -} -inline uint16 ToHost16(uint16 x) { - return x; -} - -inline uint32_t FromHost32(uint32_t x) { - return x; -} -inline uint32_t ToHost32(uint32_t x) { - return x; -} - -inline uint64_t FromHost64(uint64_t x) { - return x; -} -inline uint64_t ToHost64(uint64_t x) { - return x; -} - -inline constexpr bool IsLittleEndian() { - return true; -} - -#elif defined ABSL_IS_BIG_ENDIAN - -inline uint16 FromHost16(uint16 x) { - return gbswap_16(x); -} -inline uint16 ToHost16(uint16 x) { - return gbswap_16(x); -} - -inline uint32_t FromHost32(uint32_t x) { - return gbswap_32(x); -} -inline uint32_t ToHost32(uint32_t x) { - return gbswap_32(x); -} - -inline uint64_t FromHost64(uint64_t x) { - return gbswap_64(x); -} -inline uint64_t ToHost64(uint64_t x) { - return gbswap_64(x); -} - -inline constexpr bool IsLittleEndian() { - return false; -} - -#endif /* ENDIAN */ - -// Functions to do unaligned loads and stores in little-endian order. -inline uint16 Load16(const void *p) { - return ToHost16(UNALIGNED_LOAD16(p)); -} - -inline void Store16(void *p, uint16 v) { - UNALIGNED_STORE16(p, FromHost16(v)); -} - -inline uint32_t Load32(const void *p) { - return ToHost32(UNALIGNED_LOAD32(p)); -} - -inline void Store32(void *p, uint32_t v) { - UNALIGNED_STORE32(p, FromHost32(v)); -} - -inline uint64_t Load64(const void *p) { - return ToHost64(UNALIGNED_LOAD64(p)); -} - -inline void Store64(void *p, uint64_t v) { - UNALIGNED_STORE64(p, FromHost64(v)); -} - -} // namespace little_endian - -// Utilities to convert numbers between the current hosts's native byte -// order and big-endian byte order (same as network byte order) -// -// Load/Store methods are alignment safe -namespace big_endian { -#ifdef ABSL_IS_LITTLE_ENDIAN - -inline uint16 FromHost16(uint16 x) { - return gbswap_16(x); -} -inline uint16 ToHost16(uint16 x) { - return gbswap_16(x); -} - -inline uint32_t FromHost32(uint32_t x) { - return gbswap_32(x); -} -inline uint32_t ToHost32(uint32_t x) { - return gbswap_32(x); -} - -inline uint64_t FromHost64(uint64_t x) { - return gbswap_64(x); -} -inline uint64_t ToHost64(uint64_t x) { - return gbswap_64(x); -} - -inline constexpr bool IsLittleEndian() { - return true; -} - -#elif defined ABSL_IS_BIG_ENDIAN - -inline uint16 FromHost16(uint16 x) { - return x; -} -inline uint16 ToHost16(uint16 x) { - return x; -} - -inline uint32_t FromHost32(uint32_t x) { - return x; -} -inline uint32_t ToHost32(uint32_t x) { - return x; -} - -inline uint64_t FromHost64(uint64_t x) { - return x; -} -inline uint64_t ToHost64(uint64_t x) { - return x; -} - -inline constexpr bool IsLittleEndian() { - return false; -} - -#endif /* ENDIAN */ - -// Functions to do unaligned loads and stores in big-endian order. -inline uint16 Load16(const void *p) { - return ToHost16(UNALIGNED_LOAD16(p)); -} - -inline void Store16(void *p, uint16 v) { - UNALIGNED_STORE16(p, FromHost16(v)); -} - -inline uint32_t Load32(const void *p) { - return ToHost32(UNALIGNED_LOAD32(p)); -} - -inline void Store32(void *p, uint32_t v) { - UNALIGNED_STORE32(p, FromHost32(v)); -} - -inline uint64_t Load64(const void *p) { - return ToHost64(UNALIGNED_LOAD64(p)); -} - -inline void Store64(void *p, uint64_t v) { - UNALIGNED_STORE64(p, FromHost64(v)); -} - -} // namespace big_endian - -} // namespace absl - -#endif // ABSL_BASE_INTERNAL_ENDIAN_H_ diff --git a/Firestore/Port/absl/absl_integral_types.h b/Firestore/Port/absl/absl_integral_types.h deleted file mode 100644 index 47da9c1..0000000 --- a/Firestore/Port/absl/absl_integral_types.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Basic integer type definitions for various platforms -// -// This code is compiled directly on many platforms, including client -// platforms like Windows, Mac, and embedded systems. Before making -// any changes here, make sure that you're not breaking any platforms. -// - -#ifndef THIRD_PARTY_ABSL_BASE_INTEGRAL_TYPES_H_ -#define THIRD_PARTY_ABSL_BASE_INTEGRAL_TYPES_H_ - -// These typedefs are also defined in base/swig/google.swig. In the -// SWIG environment, we use those definitions and avoid duplicate -// definitions here with an ifdef. The definitions should be the -// same in both files, and ideally be only defined in this file. -#ifndef SWIG -// Standard typedefs -// Signed integer types with width of exactly 8, 16, 32, or 64 bits -// respectively, for use when exact sizes are required. -typedef signed char schar; -typedef signed char int8; -typedef short int16; -typedef int int32; -#ifdef COMPILER_MSVC -typedef __int64 int64; -#else -typedef long long int64; -#endif /* COMPILER_MSVC */ - -// NOTE: unsigned types are DANGEROUS in loops and other arithmetical -// places. Use the signed types unless your variable represents a bit -// pattern (eg a hash value) or you really need the extra bit. Do NOT -// use 'unsigned' to express "this value should always be positive"; -// use assertions for this. - -// Unsigned integer types with width of exactly 8, 16, 32, or 64 bits -// respectively, for use when exact sizes are required. -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned int uint32; -#ifdef COMPILER_MSVC -typedef unsigned __int64 uint64; -#else -typedef unsigned long long uint64; -#endif /* COMPILER_MSVC */ - -// A type to represent a Unicode code-point value. As of Unicode 4.0, -// such values require up to 21 bits. -// (For type-checking on pointers, make this explicitly signed, -// and it should always be the signed version of whatever int32 is.) -typedef signed int char32; - -// A type to represent a natural machine word (for e.g. efficiently -// scanning through memory for checksums or index searching). Don't use -// this for storing normal integers. Ideally this would be just -// unsigned int, but our 64-bit architectures use the LP64 model -// (http://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models), hence -// their ints are only 32 bits. We want to use the same fundamental -// type on all archs if possible to preserve *printf() compatability. -typedef unsigned long uword_t; - -#endif /* SWIG */ - -// long long macros to be used because gcc and vc++ use different suffixes, -// and different size specifiers in format strings -#undef GG_LONGLONG -#undef GG_ULONGLONG -#undef GG_LL_FORMAT - -#ifdef COMPILER_MSVC /* if Visual C++ */ - -// VC++ long long suffixes -#define GG_LONGLONG(x) x##I64 -#define GG_ULONGLONG(x) x##UI64 - -// Length modifier in printf format std::string for int64's (e.g. within %d) -#define GG_LL_FORMAT "I64" // As in printf("%I64d", ...) -#define GG_LL_FORMAT_W L"I64" - -#else /* not Visual C++ */ - -#define GG_LONGLONG(x) x##LL -#define GG_ULONGLONG(x) x##ULL -#define GG_LL_FORMAT "ll" // As in "%lld". Note that "q" is poor form also. -#define GG_LL_FORMAT_W L"ll" - -#endif // COMPILER_MSVC - -// There are still some requirements that we build these headers in -// C-compatibility mode. Unfortunately, -Wall doesn't like c-style -// casts, and C doesn't know how to read braced-initialization for -// integers. -#if defined(__cplusplus) -const uint8 kuint8max{0xFF}; -const uint16 kuint16max{0xFFFF}; -const uint32 kuint32max{0xFFFFFFFF}; -const uint64 kuint64max{GG_ULONGLONG(0xFFFFFFFFFFFFFFFF)}; -const int8 kint8min{~0x7F}; -const int8 kint8max{0x7F}; -const int16 kint16min{~0x7FFF}; -const int16 kint16max{0x7FFF}; -const int32 kint32min{~0x7FFFFFFF}; -const int32 kint32max{0x7FFFFFFF}; -const int64 kint64min{GG_LONGLONG(~0x7FFFFFFFFFFFFFFF)}; -const int64 kint64max{GG_LONGLONG(0x7FFFFFFFFFFFFFFF)}; -#else // not __cplusplus, this branch exists only for C-compat -static const uint8 kuint8max = ((uint8)0xFF); -static const uint16 kuint16max = ((uint16)0xFFFF); -static const uint32 kuint32max = ((uint32)0xFFFFFFFF); -static const uint64 kuint64max = ((uint64)GG_LONGLONG(0xFFFFFFFFFFFFFFFF)); -static const int8 kint8min = ((int8)~0x7F); -static const int8 kint8max = ((int8)0x7F); -static const int16 kint16min = ((int16)~0x7FFF); -static const int16 kint16max = ((int16)0x7FFF); -static const int32 kint32min = ((int32)~0x7FFFFFFF); -static const int32 kint32max = ((int32)0x7FFFFFFF); -static const int64 kint64min = ((int64)GG_LONGLONG(~0x7FFFFFFFFFFFFFFF)); -static const int64 kint64max = ((int64)GG_LONGLONG(0x7FFFFFFFFFFFFFFF)); -#endif // __cplusplus - -// The following are not real constants, but we list them so CodeSearch and -// other tools find them, in case people are looking for the above constants -// under different names: -// kMaxUint8, kMaxUint16, kMaxUint32, kMaxUint64 -// kMinInt8, kMaxInt8, kMinInt16, kMaxInt16, kMinInt32, kMaxInt32, -// kMinInt64, kMaxInt64 - -// No object has kIllegalFprint as its Fingerprint. -typedef uint64 Fprint; -static const Fprint kIllegalFprint = 0; -static const Fprint kMaxFprint = GG_ULONGLONG(0xFFFFFFFFFFFFFFFF); - -#endif // THIRD_PARTY_ABSL_BASE_INTEGRAL_TYPES_H_ diff --git a/Firestore/Port/absl/absl_port.h b/Firestore/Port/absl/absl_port.h deleted file mode 100644 index eee21fc..0000000 --- a/Firestore/Port/absl/absl_port.h +++ /dev/null @@ -1,535 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Various portability macros, type definitions, and inline functions -// This file is used for both C and C++! -// -// These are weird things we need to do to get this compiling on -// random systems (and on SWIG). -// -// This files is structured into the following high-level categories: -// - Platform checks (OS, Compiler, C++, Library) -// - Feature macros -// - Utility macros -// - Utility functions -// - Type alias -// - Predefined system/language macros -// - Predefined system/language functions -// - Compiler attributes (__attribute__) -// - Performance optimization (alignment, branch prediction) -// - Obsolete -// - -#ifndef THIRD_PARTY_ABSL_BASE_PORT_H_ -#define THIRD_PARTY_ABSL_BASE_PORT_H_ - -#include -#include // So we can set the bounds of our types -#include // for free() -#include // for memcpy() - -#include "Firestore/Port/absl/absl_attributes.h" -#include "Firestore/Port/absl/absl_config.h" -#include "Firestore/Port/absl/absl_integral_types.h" - -#ifdef SWIG -%include "attributes.h" -#endif - -// ----------------------------------------------------------------------------- -// Operating System Check -// ----------------------------------------------------------------------------- - -#if defined(__CYGWIN__) -#error "Cygwin is not supported." -#endif - -// ----------------------------------------------------------------------------- -// Compiler Check -// ----------------------------------------------------------------------------- - -// We support MSVC++ 14.0 update 2 and later. -#if defined(_MSC_FULL_VER) && _MSC_FULL_VER < 190023918 -#error "This package requires Visual Studio 2015 Update 2 or higher" -#endif - -// We support gcc 4.7 and later. -#if defined(__GNUC__) && !defined(__clang__) -#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7) -#error "This package requires gcc 4.7 or higher" -#endif -#endif - -// We support Apple Xcode clang 4.2.1 (version 421.11.65) and later. -// This corresponds to Apple Xcode version 4.5. -#if defined(__apple_build_version__) && __apple_build_version__ < 4211165 -#error "This package requires __apple_build_version__ of 4211165 or higher" -#endif - -// ----------------------------------------------------------------------------- -// C++ Version Check -// ----------------------------------------------------------------------------- - -// Enforce C++11 as the minimum. Note that Visual Studio has not -// advanced __cplusplus despite being good enough for our purposes, so -// so we exempt it from the check. -#if defined(__cplusplus) && !defined(_MSC_VER) && !defined(SWIG) -#if __cplusplus < 201103L -#error "C++ versions less than C++11 are not supported." -#endif -#endif - -// ----------------------------------------------------------------------------- -// C++ Standard Library Check -// ----------------------------------------------------------------------------- - -#if defined(__cplusplus) -#include -#if defined(_STLPORT_VERSION) -#error "STLPort is not supported." -#endif -#endif - -// ----------------------------------------------------------------------------- -// Feature Macros -// ----------------------------------------------------------------------------- - -// ABSL_HAVE_TLS is defined to 1 when __thread should be supported. -// We assume __thread is supported on Linux when compiled with Clang or compiled -// against libstdc++ with _GLIBCXX_HAVE_TLS defined. -#ifdef ABSL_HAVE_TLS -#error ABSL_HAVE_TLS cannot be directly set -#elif defined(__linux__) && (defined(__clang__) || defined(_GLIBCXX_HAVE_TLS)) -#define ABSL_HAVE_TLS 1 -#endif - -// ----------------------------------------------------------------------------- -// Utility Macros -// ----------------------------------------------------------------------------- - -// ABSL_FUNC_PTR_TO_CHAR_PTR -// On some platforms, a "function pointer" points to a function descriptor -// rather than directly to the function itself. -// Use ABSL_FUNC_PTR_TO_CHAR_PTR(func) to get a char-pointer to the first -// instruction of the function func. -#if defined(__cplusplus) -#if (defined(__powerpc__) && !(_CALL_ELF > 1)) || defined(__ia64) -// use opd section for function descriptors on these platforms, the function -// address is the first word of the descriptor -namespace absl { -enum { kPlatformUsesOPDSections = 1 }; -} // namespace absl -#define ABSL_FUNC_PTR_TO_CHAR_PTR(func) (reinterpret_cast(func)[0]) -#else // not PPC or IA64 -namespace absl { -enum { kPlatformUsesOPDSections = 0 }; -} // namespace absl -#define ABSL_FUNC_PTR_TO_CHAR_PTR(func) (reinterpret_cast(func)) -#endif // PPC or IA64 -#endif // __cplusplus - -// ----------------------------------------------------------------------------- -// Utility Functions -// ----------------------------------------------------------------------------- - -#if defined(__cplusplus) -namespace absl { -constexpr char PathSeparator() { -#ifdef _WIN32 - return '\\'; -#else - return '/'; -#endif -} -} // namespace absl -#endif // __cplusplus - -// ----------------------------------------------------------------------------- -// Type Alias -// ----------------------------------------------------------------------------- - -#ifdef _MSC_VER -// uid_t -// MSVC doesn't have uid_t -typedef int uid_t; - -// pid_t -// Defined all over the place. -typedef int pid_t; - -// ssize_t -// VC++ doesn't understand "ssize_t". SSIZE_T is defined in . -#include -typedef SSIZE_T ssize_t; -#endif // _MSC_VER - -// ----------------------------------------------------------------------------- -// Predefined System/Language Macros -// ----------------------------------------------------------------------------- - -// MAP_ANONYMOUS -#if defined(__APPLE__) && defined(__MACH__) -// For mmap, Linux defines both MAP_ANONYMOUS and MAP_ANON and says MAP_ANON is -// deprecated. In Darwin, MAP_ANON is all there is. -#if !defined MAP_ANONYMOUS -#define MAP_ANONYMOUS MAP_ANON -#endif // !MAP_ANONYMOUS -#endif // __APPLE__ && __MACH__ - -// PATH_MAX -// You say tomato, I say atotom -#ifdef _MSC_VER -#define PATH_MAX MAX_PATH -#endif - -// ----------------------------------------------------------------------------- -// Performance Optimization -// ----------------------------------------------------------------------------- - -// Alignment - -// CACHELINE_SIZE, CACHELINE_ALIGNED -// Deprecated: Use ABSL_CACHELINE_SIZE, ABSL_CACHELINE_ALIGNED. -// Note: When C++17 is available, consider using the following: -// - std::hardware_constructive_interference_size -// - std::hardware_destructive_interference_size -// See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0154r1.html -#if defined(__GNUC__) -#if defined(__i386__) || defined(__x86_64__) -#define CACHELINE_SIZE 64 -#define ABSL_CACHELINE_SIZE 64 -#elif defined(__powerpc64__) -#define CACHELINE_SIZE 128 -#define ABSL_CACHELINE_SIZE 128 -#elif defined(__aarch64__) -// We would need to read special register ctr_el0 to find out L1 dcache size. -// This value is a good estimate based on a real aarch64 machine. -#define CACHELINE_SIZE 64 -#define ABSL_CACHELINE_SIZE 64 -#elif defined(__arm__) -// Cache line sizes for ARM: These values are not strictly correct since -// cache line sizes depend on implementations, not architectures. There -// are even implementations with cache line sizes configurable at boot -// time. -#if defined(__ARM_ARCH_5T__) -#define CACHELINE_SIZE 32 -#define ABSL_CACHELINE_SIZE 32 -#elif defined(__ARM_ARCH_7A__) -#define CACHELINE_SIZE 64 -#define ABSL_CACHELINE_SIZE 64 -#endif -#endif - -#ifndef CACHELINE_SIZE -// A reasonable default guess. Note that overestimates tend to waste more -// space, while underestimates tend to waste more time. -#define CACHELINE_SIZE 64 -#define ABSL_CACHELINE_SIZE 64 -#endif - -// On some compilers, expands to __attribute__((aligned(CACHELINE_SIZE))). -// For compilers where this is not known to work, expands to nothing. -// -// No further guarantees are made here. The result of applying the macro -// to variables and types is always implementation defined. -// -// WARNING: It is easy to use this attribute incorrectly, even to the point -// of causing bugs that are difficult to diagnose, crash, etc. It does not -// guarantee that objects are aligned to a cache line. -// -// Recommendations: -// -// 1) Consult compiler documentation; this comment is not kept in sync as -// toolchains evolve. -// 2) Verify your use has the intended effect. This often requires inspecting -// the generated machine code. -// 3) Prefer applying this attribute to individual variables. Avoid -// applying it to types. This tends to localize the effect. -#define CACHELINE_ALIGNED __attribute__((aligned(CACHELINE_SIZE))) -#define ABSL_CACHELINE_ALIGNED __attribute__((aligned(ABSL_CACHELINE_SIZE))) - -#else // not GCC -#define CACHELINE_SIZE 64 -#define ABSL_CACHELINE_SIZE 64 -#define CACHELINE_ALIGNED -#define ABSL_CACHELINE_ALIGNED -#endif - -// unaligned APIs - -// Portable handling of unaligned loads, stores, and copies. -// On some platforms, like ARM, the copy functions can be more efficient -// then a load and a store. -// -// It is possible to implement all of these these using constant-length memcpy -// calls, which is portable and will usually be inlined into simple loads and -// stores if the architecture supports it. However, such inlining usually -// happens in a pass that's quite late in compilation, which means the resulting -// loads and stores cannot participate in many other optimizations, leading to -// overall worse code. - -// The unaligned API is C++ only. The declarations use C++ features -// (namespaces, inline) which are absent or incompatible in C. -#if defined(__cplusplus) - -#if defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER) || defined(MEMORY_SANITIZER) -// Consider we have an unaligned load/store of 4 bytes from address 0x...05. -// AddressSanitizer will treat it as a 3-byte access to the range 05:07 and -// will miss a bug if 08 is the first unaddressable byte. -// ThreadSanitizer will also treat this as a 3-byte access to 05:07 and will -// miss a race between this access and some other accesses to 08. -// MemorySanitizer will correctly propagate the shadow on unaligned stores -// and correctly report bugs on unaligned loads, but it may not properly -// update and report the origin of the uninitialized memory. -// For all three tools, replacing an unaligned access with a tool-specific -// callback solves the problem. - -// Make sure uint16_t/uint32_t/uint64_t are defined. -#include - -extern "C" { -uint16_t __sanitizer_unaligned_load16(const void *p); -uint32_t __sanitizer_unaligned_load32(const void *p); -uint64_t __sanitizer_unaligned_load64(const void *p); -void __sanitizer_unaligned_store16(void *p, uint16_t v); -void __sanitizer_unaligned_store32(void *p, uint32_t v); -void __sanitizer_unaligned_store64(void *p, uint64_t v); -} // extern "C" - -inline uint16 UNALIGNED_LOAD16(const void *p) { - return __sanitizer_unaligned_load16(p); -} - -inline uint32 UNALIGNED_LOAD32(const void *p) { - return __sanitizer_unaligned_load32(p); -} - -inline uint64 UNALIGNED_LOAD64(const void *p) { - return __sanitizer_unaligned_load64(p); -} - -inline void UNALIGNED_STORE16(void *p, uint16 v) { - __sanitizer_unaligned_store16(p, v); -} - -inline void UNALIGNED_STORE32(void *p, uint32 v) { - __sanitizer_unaligned_store32(p, v); -} - -inline void UNALIGNED_STORE64(void *p, uint64 v) { - __sanitizer_unaligned_store64(p, v); -} - -#elif defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86) || \ - defined(__ppc__) || defined(__PPC__) || defined(__ppc64__) || defined(__PPC64__) - -// x86 and x86-64 can perform unaligned loads/stores directly; -// modern PowerPC hardware can also do unaligned integer loads and stores; -// but note: the FPU still sends unaligned loads and stores to a trap handler! - -#define UNALIGNED_LOAD16(_p) (*reinterpret_cast(_p)) -#define UNALIGNED_LOAD32(_p) (*reinterpret_cast(_p)) -#define UNALIGNED_LOAD64(_p) (*reinterpret_cast(_p)) - -#define UNALIGNED_STORE16(_p, _val) (*reinterpret_cast(_p) = (_val)) -#define UNALIGNED_STORE32(_p, _val) (*reinterpret_cast(_p) = (_val)) -#define UNALIGNED_STORE64(_p, _val) (*reinterpret_cast(_p) = (_val)) - -#elif defined(__arm__) && !defined(__ARM_ARCH_5__) && !defined(__ARM_ARCH_5T__) && \ - !defined(__ARM_ARCH_5TE__) && !defined(__ARM_ARCH_5TEJ__) && !defined(__ARM_ARCH_6__) && \ - !defined(__ARM_ARCH_6J__) && !defined(__ARM_ARCH_6K__) && !defined(__ARM_ARCH_6Z__) && \ - !defined(__ARM_ARCH_6ZK__) && !defined(__ARM_ARCH_6T2__) - -// ARMv7 and newer support native unaligned accesses, but only of 16-bit -// and 32-bit values (not 64-bit); older versions either raise a fatal signal, -// do an unaligned read and rotate the words around a bit, or do the reads very -// slowly (trip through kernel mode). There's no simple #define that says just -// “ARMv7 or higher”, so we have to filter away all ARMv5 and ARMv6 -// sub-architectures. Newer gcc (>= 4.6) set an __ARM_FEATURE_ALIGNED #define, -// so in time, maybe we can move on to that. -// -// This is a mess, but there's not much we can do about it. -// -// To further complicate matters, only LDR instructions (single reads) are -// allowed to be unaligned, not LDRD (two reads) or LDM (many reads). Unless we -// explicitly tell the compiler that these accesses can be unaligned, it can and -// will combine accesses. On armcc, the way to signal this is done by accessing -// through the type (uint32 __packed *), but GCC has no such attribute -// (it ignores __attribute__((packed)) on individual variables). However, -// we can tell it that a _struct_ is unaligned, which has the same effect, -// so we do that. - -namespace base { -namespace internal { - -struct Unaligned16Struct { - uint16 value; - uint8 dummy; // To make the size non-power-of-two. -} ATTRIBUTE_PACKED; - -struct Unaligned32Struct { - uint32 value; - uint8 dummy; // To make the size non-power-of-two. -} ATTRIBUTE_PACKED; - -} // namespace internal -} // namespace base - -#define UNALIGNED_LOAD16(_p) \ - ((reinterpret_cast(_p))->value) -#define UNALIGNED_LOAD32(_p) \ - ((reinterpret_cast(_p))->value) - -#define UNALIGNED_STORE16(_p, _val) \ - ((reinterpret_cast< ::base::internal::Unaligned16Struct *>(_p))->value = (_val)) -#define UNALIGNED_STORE32(_p, _val) \ - ((reinterpret_cast< ::base::internal::Unaligned32Struct *>(_p))->value = (_val)) - -inline uint64 UNALIGNED_LOAD64(const void *p) { - uint64 t; - memcpy(&t, p, sizeof t); - return t; -} - -inline void UNALIGNED_STORE64(void *p, uint64 v) { - memcpy(p, &v, sizeof v); -} - -#else - -#define NEED_ALIGNED_LOADS - -// These functions are provided for architectures that don't support -// unaligned loads and stores. - -inline uint16 UNALIGNED_LOAD16(const void *p) { - uint16 t; - memcpy(&t, p, sizeof t); - return t; -} - -inline uint32 UNALIGNED_LOAD32(const void *p) { - uint32 t; - memcpy(&t, p, sizeof t); - return t; -} - -inline uint64 UNALIGNED_LOAD64(const void *p) { - uint64 t; - memcpy(&t, p, sizeof t); - return t; -} - -inline void UNALIGNED_STORE16(void *p, uint16 v) { - memcpy(p, &v, sizeof v); -} - -inline void UNALIGNED_STORE32(void *p, uint32 v) { - memcpy(p, &v, sizeof v); -} - -inline void UNALIGNED_STORE64(void *p, uint64 v) { - memcpy(p, &v, sizeof v); -} - -#endif - -// The UNALIGNED_LOADW and UNALIGNED_STOREW macros load and store values -// of type uword_t. -#ifdef _LP64 -#define UNALIGNED_LOADW(_p) UNALIGNED_LOAD64(_p) -#define UNALIGNED_STOREW(_p, _val) UNALIGNED_STORE64(_p, _val) -#else -#define UNALIGNED_LOADW(_p) UNALIGNED_LOAD32(_p) -#define UNALIGNED_STOREW(_p, _val) UNALIGNED_STORE32(_p, _val) -#endif - -inline void UnalignedCopy16(const void *src, void *dst) { - UNALIGNED_STORE16(dst, UNALIGNED_LOAD16(src)); -} - -inline void UnalignedCopy32(const void *src, void *dst) { - UNALIGNED_STORE32(dst, UNALIGNED_LOAD32(src)); -} - -inline void UnalignedCopy64(const void *src, void *dst) { - if (sizeof(void *) == 8) { - UNALIGNED_STORE64(dst, UNALIGNED_LOAD64(src)); - } else { - const char *src_char = reinterpret_cast(src); - char *dst_char = reinterpret_cast(dst); - - UNALIGNED_STORE32(dst_char, UNALIGNED_LOAD32(src_char)); - UNALIGNED_STORE32(dst_char + 4, UNALIGNED_LOAD32(src_char + 4)); - } -} - -#endif // defined(__cplusplus), end of unaligned API - -// PREDICT_TRUE, PREDICT_FALSE -// -// GCC can be told that a certain branch is not likely to be taken (for -// instance, a CHECK failure), and use that information in static analysis. -// Giving it this information can help it optimize for the common case in -// the absence of better information (ie. -fprofile-arcs). -#if ABSL_HAVE_BUILTIN(__builtin_expect) || (defined(__GNUC__) && !defined(__clang__)) -#define PREDICT_FALSE(x) (__builtin_expect(x, 0)) -#define PREDICT_TRUE(x) (__builtin_expect(!!(x), 1)) -#define ABSL_PREDICT_FALSE(x) (__builtin_expect(x, 0)) -#define ABSL_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1)) -#else -#define PREDICT_FALSE(x) x -#define PREDICT_TRUE(x) x -#define ABSL_PREDICT_FALSE(x) x -#define ABSL_PREDICT_TRUE(x) x -#endif - -// ABSL_ASSERT -// -// In C++11, `assert` can't be used portably within constexpr functions. -// ABSL_ASSERT functions as a runtime assert but works in C++11 constexpr -// functions. Example: -// -// constexpr double Divide(double a, double b) { -// return ABSL_ASSERT(b != 0), a / b; -// } -// -// This macro is inspired by -// https://akrzemi1.wordpress.com/2017/05/18/asserts-in-constexpr-functions/ -#if defined(NDEBUG) -#define ABSL_ASSERT(expr) (false ? (void)(expr) : (void)0) -#else -#define ABSL_ASSERT(expr) \ - (PREDICT_TRUE((expr)) ? (void)0 : [] { assert(false && #expr); }()) // NOLINT -#endif - -// ----------------------------------------------------------------------------- -// Obsolete (to be removed) -// ----------------------------------------------------------------------------- - -// HAS_GLOBAL_STRING -// Some platforms have a std::string class that is different from ::std::string -// (although the interface is the same, of course). On other platforms, -// std::string is the same as ::std::string. -#if defined(__cplusplus) && !defined(SWIG) -#include -#ifndef HAS_GLOBAL_STRING -using std::basic_string; -using std::string; -#endif // HAS_GLOBAL_STRING -#endif // SWIG, __cplusplus - -#endif // THIRD_PARTY_ABSL_BASE_PORT_H_ diff --git a/Firestore/Port/ordered_code.cc b/Firestore/Port/ordered_code.cc index 038d445..05a1569 100644 --- a/Firestore/Port/ordered_code.cc +++ b/Firestore/Port/ordered_code.cc @@ -18,11 +18,17 @@ #include +#include +#include +#include +#include // For Slice + #include "Firestore/Port/bits.h" -#include "Firestore/Port/absl/absl_endian.h" -#include "Firestore/Port/absl/absl_port.h" -#include // For Slice +#define UNALIGNED_LOAD32 ABSL_INTERNAL_UNALIGNED_LOAD32 +#define UNALIGNED_LOAD64 ABSL_INTERNAL_UNALIGNED_LOAD64 +#define UNALIGNED_STORE32 ABSL_INTERNAL_UNALIGNED_STORE32 +#define UNALIGNED_STORE64 ABSL_INTERNAL_UNALIGNED_STORE64 // We encode a string in different ways depending on whether the item // should be in lexicographically increasing or decreasing order. -- cgit v1.2.3 From 87d88ebbe2b325f8b172af6f519a1070d94f39cb Mon Sep 17 00:00:00 2001 From: Gil Date: Tue, 12 Dec 2017 11:13:02 -0800 Subject: Add leveldb to the Firestore cmake build (#559) * Use Debug as the default build type if unspecified * Add a leveldb ExternalProject, FindLevelDB module, and use it in Firestore * Accept an externally built leveldb via LEVELDB_ROOT * Clone leveldb via https: instead of git: * Remove extra DOWNLOAD_DIR which doesn't work with GIT sources --- CMakeLists.txt | 6 ++++ Firestore/CMakeLists.txt | 6 +++- cmake/FindLevelDB.cmake | 55 +++++++++++++++++++++++++++++++++++ cmake/external/firestore.cmake | 2 +- cmake/external/leveldb.cmake | 65 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 cmake/FindLevelDB.cmake create mode 100644 cmake/external/leveldb.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index efea997..63e1a39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,11 @@ cmake_minimum_required(VERSION 2.8.11) project(firebase C CXX) +# If no build type is specified, make it a debug build +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Debug) +endif() + list(INSERT CMAKE_MODULE_PATH 0 ${PROJECT_SOURCE_DIR}/cmake) # External Projects install into this prefix and download into the source tree @@ -27,5 +32,6 @@ set(FIREBASE_DOWNLOAD_DIR "${PROJECT_SOURCE_DIR}/.downloads") enable_testing() include(external/googletest) +include(external/leveldb) include(external/abseil-cpp) include(external/firestore) diff --git a/Firestore/CMakeLists.txt b/Firestore/CMakeLists.txt index 6c2a32e..906b6e4 100644 --- a/Firestore/CMakeLists.txt +++ b/Firestore/CMakeLists.txt @@ -16,9 +16,13 @@ cmake_minimum_required(VERSION 2.8.11) project(firestore) set(FIREBASE_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/..") -include("${FIREBASE_SOURCE_DIR}/cmake/utils.cmake") +set(FIREBASE_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..") + +list(INSERT CMAKE_MODULE_PATH 0 ${FIREBASE_SOURCE_DIR}/cmake) +include(utils) find_package(GTest REQUIRED) +find_package(LevelDB REQUIRED) # We use C++11 set(CMAKE_CXX_STANDARD 11) diff --git a/cmake/FindLevelDB.cmake b/cmake/FindLevelDB.cmake new file mode 100644 index 0000000..ae32a17 --- /dev/null +++ b/cmake/FindLevelDB.cmake @@ -0,0 +1,55 @@ +# 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. + +set(binary_dir ${FIREBASE_BINARY_DIR}/third_party/leveldb/src/leveldb) + +find_path( + LEVELDB_INCLUDE_DIR leveldb/db.h + HINTS + $ENV{LEVELDB_ROOT}/include + ${LEVELDB_ROOT}/include + ${binary_dir}/include + PATH_SUFFIXES leveldb +) + +find_library( + LEVELDB_LIBRARY + NAMES leveldb + HINTS + $ENV{LEVELDB_ROOT}/lib + ${LEVELDB_ROOT}/lib + ${binary_dir}/out-static +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + LevelDB + DEFAULT_MSG + LEVELDB_INCLUDE_DIR + LEVELDB_LIBRARY +) + +if(LEVELDB_FOUND) + set(LEVELDB_INCLUDE_DIRS ${LEVELDB_INCLUDE_DIR}) + set(LEVELDB_LIBRARIES ${LEVELDB_LIBRARY}) + + if (NOT TARGET LevelDB::LevelDB) + add_library(LevelDB::LevelDB UNKNOWN IMPORTED) + set_target_properties( + LevelDB::LevelDB PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${LEVELDB_INCLUDE_DIR} + IMPORTED_LOCATION ${LEVELDB_LIBRARY} + ) + endif() +endif(LEVELDB_FOUND) diff --git a/cmake/external/firestore.cmake b/cmake/external/firestore.cmake index dd37b51..9fb673e 100644 --- a/cmake/external/firestore.cmake +++ b/cmake/external/firestore.cmake @@ -19,7 +19,7 @@ set(binary_dir ${PROJECT_BINARY_DIR}/Firestore) ExternalProject_Add( Firestore - DEPENDS googletest abseil-cpp + DEPENDS abseil-cpp googletest leveldb # Lay the binary directory out as if this were a subproject. This makes it # possible to build and test in it directly. diff --git a/cmake/external/leveldb.cmake b/cmake/external/leveldb.cmake new file mode 100644 index 0000000..9b4d390 --- /dev/null +++ b/cmake/external/leveldb.cmake @@ -0,0 +1,65 @@ +# 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(ExternalProject) + +if(LEVELDB_ROOT) + # If the user has supplied a LEVELDB_ROOT then just use it. Add an empty + # custom target so that the superbuild depdendencies don't all have to be + # conditional. + add_custom_target(leveldb) + +else() + # LevelDB does not build on Windows (yet) + # See: + # https://github.com/google/leveldb/issues/363 + # https://github.com/google/leveldb/issues/466 + if(NOT WIN32) + # Clean up warning output to reduce noise in the build + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") + set( + LEVELDB_CXX_FLAGS "\ + -Wno-deprecated-declarations" + ) + endif() + + # Map CMake compiler configuration down onto the leveldb Makefile + set( + LEVELDB_OPT "\ + $<$:${CMAKE_CXX_FLAGS_DEBUG}> \ + $<$:${CMAKE_CXX_FLAGS_RELEASE}>" + ) + + ExternalProject_Add( + leveldb + + GIT_REPOSITORY "https://github.com/google/leveldb.git" + GIT_TAG "v1.20" + + PREFIX ${PROJECT_BINARY_DIR}/third_party/leveldb + + CONFIGURE_COMMAND "" + BUILD_ALWAYS ON + BUILD_IN_SOURCE ON + BUILD_COMMAND + env CXXFLAGS=${LEVELDB_CXX_FLAGS} OPT=${LEVELDB_OPT} make -j all + + INSTALL_DIR ${FIREBASE_INSTALL_DIR} + + INSTALL_COMMAND "" + TEST_COMMAND "" + ) + + endif(NOT WIN32) +endif(LEVELDB_ROOT) -- cgit v1.2.3 From e16c38688b1665a1897aa714141c1d0b87576193 Mon Sep 17 00:00:00 2001 From: Kyle Ju Date: Tue, 12 Dec 2017 14:33:04 -0500 Subject: Update component versions for Firebase 4.8.0 (#561) --- Example/Podfile | 2 +- Firebase/Core/FIROptions.m | 2 +- FirebaseAuth.podspec | 2 +- FirebaseCore.podspec | 2 +- FirebaseDatabase.podspec | 2 +- FirebaseFirestore.podspec | 2 +- FirebaseMessaging.podspec | 2 +- FirebaseStorage.podspec | 2 +- Firestore/Example/Podfile | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Example/Podfile b/Example/Podfile index 164ca72..24a0de6 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -8,7 +8,7 @@ target 'Core_Example_iOS' do # 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' target 'Core_Tests_iOS' do inherit! :search_paths diff --git a/Firebase/Core/FIROptions.m b/Firebase/Core/FIROptions.m index 841c70b..b60ccdd 100644 --- a/Firebase/Core/FIROptions.m +++ b/Firebase/Core/FIROptions.m @@ -42,7 +42,7 @@ NSString *const kFIRIsSignInEnabled = @"IS_SIGNIN_ENABLED"; NSString *const kFIRLibraryVersionID = @"4" // Major version (one or more digits) @"00" // Minor version (exactly 2 digits) - @"12" // Build number (exactly 2 digits) + @"13" // Build number (exactly 2 digits) @"000"; // Fixed "000" // Plist file name. NSString *const kServiceInfoFileName = @"GoogleService-Info"; diff --git a/FirebaseAuth.podspec b/FirebaseAuth.podspec index 3ee4832..0addd75 100644 --- a/FirebaseAuth.podspec +++ b/FirebaseAuth.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'FirebaseAuth' - s.version = '4.4.0' + s.version = '4.4.1' s.summary = 'The official iOS client for Firebase Authentication' s.description = <<-DESC diff --git a/FirebaseCore.podspec b/FirebaseCore.podspec index 453518f..ac8d5b9 100644 --- a/FirebaseCore.podspec +++ b/FirebaseCore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'FirebaseCore' - s.version = '4.0.12' + s.version = '4.0.13' s.summary = 'Firebase Core for iOS' s.description = <<-DESC diff --git a/FirebaseDatabase.podspec b/FirebaseDatabase.podspec index 338a2f6..3f74718 100644 --- a/FirebaseDatabase.podspec +++ b/FirebaseDatabase.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'FirebaseDatabase' - s.version = '4.1.2' + s.version = '4.1.3' s.summary = 'Firebase Open Source Libraries for iOS.' s.description = <<-DESC diff --git a/FirebaseFirestore.podspec b/FirebaseFirestore.podspec index ed7346c..5b810d8 100644 --- a/FirebaseFirestore.podspec +++ b/FirebaseFirestore.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'FirebaseFirestore' - s.version = '0.9.3' + s.version = '0.9.4' s.summary = 'Google Cloud Firestore for iOS' s.description = <<-DESC diff --git a/FirebaseMessaging.podspec b/FirebaseMessaging.podspec index a26b0b9..b1fdb68 100644 --- a/FirebaseMessaging.podspec +++ b/FirebaseMessaging.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'FirebaseMessaging' - s.version = '2.0.7' + s.version = '2.0.8' s.summary = 'Firebase Messaging for iOS' s.description = <<-DESC diff --git a/FirebaseStorage.podspec b/FirebaseStorage.podspec index af81620..9b52e2f 100644 --- a/FirebaseStorage.podspec +++ b/FirebaseStorage.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'FirebaseStorage' - s.version = '2.1.0' + s.version = '2.1.1' s.summary = 'Firebase Storage for iOS' s.description = <<-DESC 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' -- cgit v1.2.3 From 163eeeecb75f24f155becaa76a95574c266d8a4f Mon Sep 17 00:00:00 2001 From: Ryan Wilson Date: Tue, 12 Dec 2017 19:18:24 -0500 Subject: Revert changes introduced in #546 to fix build breakage. (#562) --- Firebase/Messaging/FIRMessaging.m | 5 +++-- Firebase/Messaging/FIRMessagingContextManagerService.m | 2 +- Firebase/Messaging/FIRMessagingRmq2PersistentStore.m | 10 +++------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Firebase/Messaging/FIRMessaging.m b/Firebase/Messaging/FIRMessaging.m index 23feee9..782b779 100644 --- a/Firebase/Messaging/FIRMessaging.m +++ b/Firebase/Messaging/FIRMessaging.m @@ -384,6 +384,7 @@ NSString * const FIRMessagingRegistrationTokenRefreshedNotification = id appDelegate = application.delegate; SEL continueUserActivitySelector = @selector(application:continueUserActivity:restorationHandler:); + SEL openURLWithOptionsSelector = @selector(application:openURL:options:); SEL openURLWithSourceApplicationSelector = @selector(application:openURL:sourceApplication:annotation:); SEL handleOpenURLSelector = @selector(application:handleOpenURL:); @@ -402,7 +403,7 @@ NSString * const FIRMessagingRegistrationTokenRefreshedNotification = // Do nothing, as we don't support the app calling this block }]; - } else if (@available(iOS 9.0, *)) { + } else if ([appDelegate respondsToSelector:openURLWithOptionsSelector]) { [appDelegate application:application openURL:url options:@{}]; // Similarly, |application:openURL:sourceApplication:annotation:| will also always be called, due @@ -726,7 +727,7 @@ NSString * const FIRMessagingRegistrationTokenRefreshedNotification = - (void)receiver:(FIRMessagingReceiver *)receiver receivedRemoteMessage:(FIRMessagingRemoteMessage *)remoteMessage { - if (@available(iOS 10.0, *)) { + if ([self.delegate respondsToSelector:@selector(messaging:didReceiveMessage:)]) { [self.delegate messaging:self didReceiveMessage:remoteMessage]; } else if ([self.delegate respondsToSelector:@selector(applicationReceivedRemoteMessage:)]) { #pragma clang diagnostic push diff --git a/Firebase/Messaging/FIRMessagingContextManagerService.m b/Firebase/Messaging/FIRMessagingContextManagerService.m index dffd6ae..232587f 100644 --- a/Firebase/Messaging/FIRMessagingContextManagerService.m +++ b/Firebase/Messaging/FIRMessagingContextManagerService.m @@ -143,7 +143,7 @@ typedef NS_ENUM(NSUInteger, FIRMessagingContextManagerMessageType) { } if ([apsDictionary[kFIRMessagingContextManagerTitleKey] length]) { // |alertTitle| is iOS 8.2+, so check if we can set it - if (@available(iOS 8.2, *)) { + if ([notification respondsToSelector:@selector(setAlertTitle:)]) { notification.alertTitle = apsDictionary[kFIRMessagingContextManagerTitleKey]; } } diff --git a/Firebase/Messaging/FIRMessagingRmq2PersistentStore.m b/Firebase/Messaging/FIRMessagingRmq2PersistentStore.m index e468333..189f366 100644 --- a/Firebase/Messaging/FIRMessagingRmq2PersistentStore.m +++ b/Firebase/Messaging/FIRMessagingRmq2PersistentStore.m @@ -104,13 +104,9 @@ typedef void(^FCMOutgoingRmqMessagesTableHandler)(int64_t rmqId, int8_t tag, NSD // Utility to create an NSString from a sqlite3 result code NSString * _Nonnull FIRMessagingStringFromSQLiteResult(int result) { - const char *errorStr; - if (@available(iOS 8.2, *)) { - errorStr = sqlite3_errstr(result); - } else { - errorStr = "pre iOS 8.2"; - } - return [NSString stringWithFormat:@"%d - %s", result, errorStr]; + const char *errorStr = sqlite3_errstr(result); + NSString *errorString = [NSString stringWithFormat:@"%d - %s", result, errorStr]; + return errorString; } @interface FIRMessagingRmq2PersistentStore () { -- cgit v1.2.3 From 3530e819fb31011c9b87dd77be6f2f140fecf213 Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Wed, 13 Dec 2017 09:10:09 +0800 Subject: Update CHANGELOG.md --- Firebase/Storage/CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Firebase/Storage/CHANGELOG.md b/Firebase/Storage/CHANGELOG.md index 00fc3b7..1c2cfb2 100644 --- a/Firebase/Storage/CHANGELOG.md +++ b/Firebase/Storage/CHANGELOG.md @@ -1,3 +1,6 @@ +# v2.1.1 +- [changed] Internal cleanup in the firebase-ios-sdk repository. Functionality of the Storage SDK should not be affected. + # v2.1.0 - [added] Added 'md5Hash' to FIRStorageMetadata. -- cgit v1.2.3 From df6ae1beb74df3756b91a7d9c63131233e8b415a Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Wed, 13 Dec 2017 09:12:01 +0800 Subject: Update CHANGELOG.md --- Firebase/Database/CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Firebase/Database/CHANGELOG.md b/Firebase/Database/CHANGELOG.md index 867def1..a878ebe 100644 --- a/Firebase/Database/CHANGELOG.md +++ b/Firebase/Database/CHANGELOG.md @@ -1,3 +1,6 @@ +# v4.1.3 +- [changed] Internal cleanup in the firebase-ios-sdk repository. Functionality of the RTDB SDK is not affected. + # v4.1.2 - [fixed] Addresses race condition that can occur during the initialization of empty snapshots. -- cgit v1.2.3 From 7d97fd5cf47d5e9408ce5a6fd04ea106b01a09cb Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Wed, 13 Dec 2017 09:12:16 +0800 Subject: Update CHANGELOG.md --- Firebase/Storage/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firebase/Storage/CHANGELOG.md b/Firebase/Storage/CHANGELOG.md index 1c2cfb2..ee1f1fe 100644 --- a/Firebase/Storage/CHANGELOG.md +++ b/Firebase/Storage/CHANGELOG.md @@ -1,5 +1,5 @@ # v2.1.1 -- [changed] Internal cleanup in the firebase-ios-sdk repository. Functionality of the Storage SDK should not be affected. +- [changed] Internal cleanup in the firebase-ios-sdk repository. Functionality of the Storage SDK should is not affected. # v2.1.0 - [added] Added 'md5Hash' to FIRStorageMetadata. -- cgit v1.2.3 From fd96841ac4e8885023301f29b15602445d4240c3 Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Wed, 13 Dec 2017 09:38:24 +0800 Subject: Update CHANGELOG.md --- Firebase/Storage/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firebase/Storage/CHANGELOG.md b/Firebase/Storage/CHANGELOG.md index ee1f1fe..3786de6 100644 --- a/Firebase/Storage/CHANGELOG.md +++ b/Firebase/Storage/CHANGELOG.md @@ -1,5 +1,5 @@ # v2.1.1 -- [changed] Internal cleanup in the firebase-ios-sdk repository. Functionality of the Storage SDK should is not affected. +- [changed] Internal cleanup in the firebase-ios-sdk repository. Functionality of the Storage SDK is not affected. # v2.1.0 - [added] Added 'md5Hash' to FIRStorageMetadata. -- cgit v1.2.3 From 683985168ea46b8516a8c3dedd9cc9f14e5e1011 Mon Sep 17 00:00:00 2001 From: Zsika Phillip Date: Thu, 14 Dec 2017 16:20:35 -0800 Subject: Add nil check for completion handlers (#568) * Add nullability check for completion handler * Addresses comments * added line break --- Example/Auth/Sample/MainViewController.m | 44 ++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/Example/Auth/Sample/MainViewController.m b/Example/Auth/Sample/MainViewController.m index 5326463..f9e2273 100644 --- a/Example/Auth/Sample/MainViewController.m +++ b/Example/Auth/Sample/MainViewController.m @@ -38,12 +38,18 @@ #import "UserInfoViewController.h" #import "UserTableViewCell.h" +NS_ASSUME_NONNULL_BEGIN -/*! @typedef textInputCompletionBlock +/** @typedef textInputCompletionBlock @brief The type of callback used to report text input prompt results. */ typedef void (^textInputCompletionBlock)(NSString *_Nullable userInput); +/** @typedef testAutomationCallback + @brief The type of callback used when automatically testing an API. + */ +typedef void (^testAutomationCallback)(NSError *_Nullable error); + /** @var kTokenGetButtonText @brief The text of the "Get Token" button. */ @@ -2187,18 +2193,20 @@ static NSDictionary *parseURL(NSString *urlString) { @completion A completion block to be executed after the provider is unlinked. */ - (void)unlinkFromProvider:(NSString *)provider - completion:(void(^)(NSError *_Nullable))completion { + completion:(nullable testAutomationCallback)completion { [[self user] unlinkFromProvider:provider completion:^(FIRUser *_Nullable user, NSError *_Nullable error) { if (error) { [self logFailure:@"unlink auth provider failed" error:error]; - completion(error); - } else { - [self logSuccess:@"unlink auth provider succeeded."]; if (completion) { - completion(nil); + completion(error); } + return; + } + [self logSuccess:@"unlink auth provider succeeded."]; + if (completion) { + completion(nil); } [self showTypicalUIForUserUpdateResultsWithTitle:kUnlinkTitle error:error]; }]; @@ -2642,7 +2650,7 @@ static NSDictionary *parseURL(NSString *urlString) { @completion A completion block to be executed after successful phone number sign in. */ - (void)signInWithPhoneNumber:(NSString *_Nullable)phoneNumber - completion:(void(^)(NSError *_Nullable))completion { + completion:(nullable testAutomationCallback)completion { [self showSpinner:^{ [[AppManager phoneAuthProvider] verifyPhoneNumber:phoneNumber UIDelegate:nil @@ -2727,7 +2735,7 @@ static NSDictionary *parseURL(NSString *urlString) { @completion A completion block to be executed after phone number is updated. */ - (void)updatePhoneNumber:(NSString *_Nullable)phoneNumber - completion:(void(^)(NSError *_Nullable))completion{ + completion:(nullable testAutomationCallback)completion { [self showSpinner:^{ [[AppManager phoneAuthProvider] verifyPhoneNumber:phoneNumber UIDelegate:nil @@ -2736,7 +2744,9 @@ static NSDictionary *parseURL(NSString *urlString) { if (error) { [self logFailure:@"failed to send verification code" error:error]; [self showMessagePrompt:error.localizedDescription]; - completion(error); + if (completion) { + completion(error); + } return; } [self logSuccess:@"Code sent"]; @@ -2757,7 +2767,9 @@ static NSDictionary *parseURL(NSString *urlString) { if (error) { [self logFailure:@"update phone number failed" error:error]; [self showMessagePrompt:error.localizedDescription]; - completion(error); + if (completion) { + completion(error); + } } else { [self logSuccess:@"update phone number succeeded."]; if (completion) { @@ -2794,7 +2806,7 @@ static NSDictionary *parseURL(NSString *urlString) { @completion A completion block to be executed after linking phone number. */ - (void)linkPhoneNumber:(NSString *_Nullable)phoneNumber - completion:(void(^)(NSError *_Nullable))completion{ + completion:(nullable testAutomationCallback)completion { [self showSpinner:^{ [[AppManager phoneAuthProvider] verifyPhoneNumber:phoneNumber UIDelegate:nil @@ -2804,7 +2816,9 @@ static NSDictionary *parseURL(NSString *urlString) { if (error) { [self logFailure:@"failed to send verification code" error:error]; [self showMessagePrompt:error.localizedDescription]; - completion(error); + if (completion) { + completion(error); + } return; } [self logSuccess:@"Code sent"]; @@ -2845,7 +2859,9 @@ static NSDictionary *parseURL(NSString *urlString) { if (error) { [self logFailure:@"failed to verify phone number" error:error]; [self showMessagePrompt:error.localizedDescription]; - completion(error); + if (completion) { + completion(error); + } return; } }]; @@ -3147,3 +3163,5 @@ static NSDictionary *parseURL(NSString *urlString) { } @end + +NS_ASSUME_NONNULL_END -- cgit v1.2.3 From ea3369c192c998d947a2fb6caed7df336f028d98 Mon Sep 17 00:00:00 2001 From: Gil Date: Tue, 19 Dec 2017 07:44:28 -0800 Subject: Use angle brackets for nonlocal #includes in Firestore (#580) --- Firestore/Example/Firestore.xcodeproj/project.pbxproj | 2 ++ Firestore/Example/Tests/GoogleTest/FSTGoogleTestTests.mm | 3 ++- Firestore/Port/string_util_test.cc | 5 ++--- Firestore/core/test/firebase/firestore/util/autoid_test.cc | 2 +- Firestore/core/test/firebase/firestore/util/secure_random_test.cc | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Firestore/Example/Firestore.xcodeproj/project.pbxproj b/Firestore/Example/Firestore.xcodeproj/project.pbxproj index 437b661..6823ab1 100644 --- a/Firestore/Example/Firestore.xcodeproj/project.pbxproj +++ b/Firestore/Example/Firestore.xcodeproj/project.pbxproj @@ -1451,6 +1451,7 @@ "$(inherited)", "\"${PODS_ROOT}/../../..\"", "\"${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}"; @@ -1482,6 +1483,7 @@ "$(inherited)", "\"${PODS_ROOT}/../../..\"", "\"${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/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 #import +#include + #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/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 +#include using Firestore::PrefixSuccessor; using Firestore::ImmediateSuccessor; 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 -#include "gtest/gtest.h" +#include using firebase::firestore::util::CreateAutoId; 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 using firebase::firestore::util::SecureRandom; -- cgit v1.2.3 From 60fa69332e485223e0da902dc1abb0f30dfd2b81 Mon Sep 17 00:00:00 2001 From: Zsika Phillip Date: Tue, 19 Dec 2017 15:25:15 -0800 Subject: Internal code clean up (#584) Fixes indentation and removes unused imports. --- Example/Auth/Tests/FIRVerifyPasswordRequestTest.m | 16 +++++++++------- Firebase/Auth/Source/RPCs/FIRCreateAuthURIResponse.m | 2 -- Firebase/Auth/Source/RPCs/FIRDeleteAccountResponse.m | 2 -- .../Auth/Source/RPCs/FIRGetOOBConfirmationCodeResponse.m | 2 -- Firebase/Auth/Source/RPCs/FIRResetPasswordResponse.m | 2 -- Firebase/Auth/Source/RPCs/FIRSetAccountInfoResponse.m | 2 -- Firebase/Auth/Source/RPCs/FIRSignUpNewUserResponse.m | 2 -- Firebase/Auth/Source/RPCs/FIRVerifyAssertionResponse.m | 2 -- Firebase/Auth/Source/RPCs/FIRVerifyCustomTokenResponse.m | 2 -- Firebase/Auth/Source/RPCs/FIRVerifyPasswordResponse.m | 2 -- 10 files changed, 9 insertions(+), 25 deletions(-) diff --git a/Example/Auth/Tests/FIRVerifyPasswordRequestTest.m b/Example/Auth/Tests/FIRVerifyPasswordRequestTest.m index 54ba7b0..2359c46 100644 --- a/Example/Auth/Tests/FIRVerifyPasswordRequestTest.m +++ b/Example/Auth/Tests/FIRVerifyPasswordRequestTest.m @@ -18,9 +18,9 @@ #import "FIRAuthErrors.h" #import "FIRAuthBackend.h" +#import "FIRFakeBackendRPCIssuer.h" #import "FIRVerifyPasswordRequest.h" #import "FIRVerifyPasswordResponse.h" -#import "FIRFakeBackendRPCIssuer.h" /** @var kTestAPIKey @brief Fake API key used for testing. @@ -125,9 +125,10 @@ static NSString *const kExpectedAPIURL = @brief Tests the verify password request. */ - (void)testVerifyPasswordRequest { - FIRVerifyPasswordRequest * request = [[FIRVerifyPasswordRequest alloc] initWithEmail:kTestEmail - password:kTestPassword - requestConfiguration:_requestConfiguration]; + FIRVerifyPasswordRequest * request = + [[FIRVerifyPasswordRequest alloc] initWithEmail:kTestEmail + password:kTestPassword + requestConfiguration:_requestConfiguration]; request.returnSecureToken = NO; [FIRAuthBackend verifyPassword:request callback:^(FIRVerifyPasswordResponse *_Nullable response, @@ -147,9 +148,10 @@ static NSString *const kExpectedAPIURL = @brief Tests the verify password request with optional fields. */ - (void)testVerifyPasswordRequestOptionalFields { - FIRVerifyPasswordRequest * request = [[FIRVerifyPasswordRequest alloc] initWithEmail:kTestEmail - password:kTestPassword - requestConfiguration:_requestConfiguration]; + FIRVerifyPasswordRequest * request = + [[FIRVerifyPasswordRequest alloc] initWithEmail:kTestEmail + password:kTestPassword + requestConfiguration:_requestConfiguration]; request.pendingIDToken = kTestPendingToken; request.captchaChallenge = kTestCaptchaChallenge; request.captchaResponse = kTestCaptchaResponse; diff --git a/Firebase/Auth/Source/RPCs/FIRCreateAuthURIResponse.m b/Firebase/Auth/Source/RPCs/FIRCreateAuthURIResponse.m index c6b9d03..12ef97c 100644 --- a/Firebase/Auth/Source/RPCs/FIRCreateAuthURIResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRCreateAuthURIResponse.m @@ -16,8 +16,6 @@ #import "FIRCreateAuthURIResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRCreateAuthURIResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary diff --git a/Firebase/Auth/Source/RPCs/FIRDeleteAccountResponse.m b/Firebase/Auth/Source/RPCs/FIRDeleteAccountResponse.m index 671a41f..ae98175 100644 --- a/Firebase/Auth/Source/RPCs/FIRDeleteAccountResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRDeleteAccountResponse.m @@ -16,8 +16,6 @@ #import "FIRDeleteAccountResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRDeleteAccountResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary diff --git a/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeResponse.m b/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeResponse.m index bd028f1..0b6c416 100644 --- a/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeResponse.m @@ -16,8 +16,6 @@ #import "FIRGetOOBConfirmationCodeResponse.h" -#import "FIRAuthErrorUtils.h" - NS_ASSUME_NONNULL_BEGIN /** @var kOOBCodeKey diff --git a/Firebase/Auth/Source/RPCs/FIRResetPasswordResponse.m b/Firebase/Auth/Source/RPCs/FIRResetPasswordResponse.m index 9a1556b..6092cfe 100644 --- a/Firebase/Auth/Source/RPCs/FIRResetPasswordResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRResetPasswordResponse.m @@ -16,8 +16,6 @@ #import "FIRResetPasswordResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRResetPasswordResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary diff --git a/Firebase/Auth/Source/RPCs/FIRSetAccountInfoResponse.m b/Firebase/Auth/Source/RPCs/FIRSetAccountInfoResponse.m index 6e228eb..ff9c7a6 100644 --- a/Firebase/Auth/Source/RPCs/FIRSetAccountInfoResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRSetAccountInfoResponse.m @@ -16,8 +16,6 @@ #import "FIRSetAccountInfoResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRSetAccountInfoResponseProviderUserInfo - (instancetype)initWithDictionary:(NSDictionary *)dictionary { diff --git a/Firebase/Auth/Source/RPCs/FIRSignUpNewUserResponse.m b/Firebase/Auth/Source/RPCs/FIRSignUpNewUserResponse.m index 7e58c5d..2071e07 100644 --- a/Firebase/Auth/Source/RPCs/FIRSignUpNewUserResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRSignUpNewUserResponse.m @@ -16,8 +16,6 @@ #import "FIRSignUpNewUserResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRSignUpNewUserResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary diff --git a/Firebase/Auth/Source/RPCs/FIRVerifyAssertionResponse.m b/Firebase/Auth/Source/RPCs/FIRVerifyAssertionResponse.m index 8c970c8..5ee39fa 100644 --- a/Firebase/Auth/Source/RPCs/FIRVerifyAssertionResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRVerifyAssertionResponse.m @@ -16,8 +16,6 @@ #import "FIRVerifyAssertionResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRVerifyAssertionResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary diff --git a/Firebase/Auth/Source/RPCs/FIRVerifyCustomTokenResponse.m b/Firebase/Auth/Source/RPCs/FIRVerifyCustomTokenResponse.m index 8a87141..b6c3818 100644 --- a/Firebase/Auth/Source/RPCs/FIRVerifyCustomTokenResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRVerifyCustomTokenResponse.m @@ -16,8 +16,6 @@ #import "FIRVerifyCustomTokenResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRVerifyCustomTokenResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary diff --git a/Firebase/Auth/Source/RPCs/FIRVerifyPasswordResponse.m b/Firebase/Auth/Source/RPCs/FIRVerifyPasswordResponse.m index d2c4a7c..71b4edd 100644 --- a/Firebase/Auth/Source/RPCs/FIRVerifyPasswordResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRVerifyPasswordResponse.m @@ -16,8 +16,6 @@ #import "FIRVerifyPasswordResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRVerifyPasswordResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary -- cgit v1.2.3 From 3ff3f9f00328b4f9538f1a2d008034c1368758f1 Mon Sep 17 00:00:00 2001 From: zxu Date: Wed, 20 Dec 2017 13:32:57 -0500 Subject: implement C++ logger (#575) * implement logger, apple impl and other impl, with test. * some minor fixes * re-organize cmake build rules; * fix bugs in log_apple.mm; * style fix by style.sh * Complete removal of LogAssert --- .../src/firebase/firestore/util/CMakeLists.txt | 1 + Firestore/core/src/firebase/firestore/util/log.h | 63 +++++++++ .../core/src/firebase/firestore/util/log_apple.mm | 148 +++++++++++++++++++++ .../core/src/firebase/firestore/util/log_stdio.cc | 97 ++++++++++++++ .../test/firebase/firestore/util/CMakeLists.txt | 1 + .../core/test/firebase/firestore/util/log_test.cc | 51 +++++++ 6 files changed, 361 insertions(+) create mode 100644 Firestore/core/src/firebase/firestore/util/log.h create mode 100644 Firestore/core/src/firebase/firestore/util/log_apple.mm create mode 100644 Firestore/core/src/firebase/firestore/util/log_stdio.cc create mode 100644 Firestore/core/test/firebase/firestore/util/log_test.cc diff --git a/Firestore/core/src/firebase/firestore/util/CMakeLists.txt b/Firestore/core/src/firebase/firestore/util/CMakeLists.txt index ce81363..ebb2301 100644 --- a/Firestore/core/src/firebase/firestore/util/CMakeLists.txt +++ b/Firestore/core/src/firebase/firestore/util/CMakeLists.txt @@ -15,5 +15,6 @@ add_library( firebase_firestore_util autoid.cc + log_stdio.cc secure_random_arc4random.cc ) 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 + +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..7cd834b --- /dev/null +++ b/Firestore/core/src/firebase/firestore/util/log_apple.mm @@ -0,0 +1,148 @@ +/* + * 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 + +#import + +#import "Firestore/Source/API/FIRFirestore+Internal.h" + +namespace firebase { +namespace firestore { +namespace util { + +static NSString* FormatString(const char* format) { + return [[NSString alloc] initWithBytesNoCopy:(void*)format + length:strlen(format) + encoding:NSUTF8StringEncoding + freeWhenDone:NO]; +} + +void LogSetLevel(LogLevel level) { + switch (level) { + case kLogLevelVerbose: + FIRSetLoggerLevel(FIRLoggerLevelMax); + break; + case kLogLevelDebug: + FIRSetLoggerLevel(FIRLoggerLevelDebug); + break; + case kLogLevelInfo: + FIRSetLoggerLevel(FIRLoggerLevelInfo); + break; + case kLogLevelWarning: + FIRSetLoggerLevel(FIRLoggerLevelWarning); + break; + case kLogLevelError: + FIRSetLoggerLevel(FIRLoggerLevelError); + break; + default: + // Unsupported log level. FIRSetLoggerLevel will deal with it. + FIRSetLoggerLevel((FIRLoggerLevel)-1); + break; + } +} + +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", + FormatString(format), list); + va_end(list); +} + +void LogInfo(const char* format, ...) { + va_list list; + va_start(list, format); + FIRLogBasic(FIRLoggerLevelInfo, kFIRLoggerFirestore, @"I-FST000001", + FormatString(format), list); + va_end(list); +} + +void LogWarning(const char* format, ...) { + va_list list; + va_start(list, format); + FIRLogBasic(FIRLoggerLevelWarning, kFIRLoggerFirestore, @"I-FST000001", + FormatString(format), list); + va_end(list); +} + +void LogError(const char* format, ...) { + va_list list; + va_start(list, format); + FIRLogBasic(FIRLoggerLevelError, kFIRLoggerFirestore, @"I-FST000001", + FormatString(format), list); + va_end(list); +} + +void LogMessageV(LogLevel log_level, const char* format, va_list args) { + switch (log_level) { + case kLogLevelVerbose: // fall through + case kLogLevelDebug: + FIRLogBasic(FIRLoggerLevelDebug, kFIRLoggerFirestore, @"I-FST000001", + FormatString(format), args); + break; + case kLogLevelInfo: + FIRLogBasic(FIRLoggerLevelInfo, kFIRLoggerFirestore, @"I-FST000001", + FormatString(format), args); + break; + case kLogLevelWarning: + FIRLogBasic(FIRLoggerLevelWarning, kFIRLoggerFirestore, @"I-FST000001", + FormatString(format), args); + break; + case kLogLevelError: + FIRLogBasic(FIRLoggerLevelError, kFIRLoggerFirestore, @"I-FST000001", + FormatString(format), args); + break; + default: + FIRLogBasic(FIRLoggerLevelError, kFIRLoggerFirestore, @"I-FST000001", + FormatString(format), args); + break; + } +} + +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 +#include + +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/test/firebase/firestore/util/CMakeLists.txt b/Firestore/core/test/firebase/firestore/util/CMakeLists.txt index 223fa41..ae2c3b0 100644 --- a/Firestore/core/test/firebase/firestore/util/CMakeLists.txt +++ b/Firestore/core/test/firebase/firestore/util/CMakeLists.txt @@ -15,6 +15,7 @@ cc_test( firebase_firestore_util_test autoid_test.cc + log_test.cc secure_random_test.cc ) target_link_libraries( 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..09b2c08 --- /dev/null +++ b/Firestore/core/test/firebase/firestore/util/log_test.cc @@ -0,0 +1,51 @@ +/* + * 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 { + +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 -- cgit v1.2.3 From 08704a617c9b8ebb99d2eb0720c0952af70703df Mon Sep 17 00:00:00 2001 From: Ryan Wilson Date: Wed, 20 Dec 2017 18:05:17 -0500 Subject: Add changelog for Core. (#585) --- Firebase/Core/CHANGELOG.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Firebase/Core/CHANGELOG.md diff --git a/Firebase/Core/CHANGELOG.md b/Firebase/Core/CHANGELOG.md new file mode 100644 index 0000000..996617e --- /dev/null +++ b/Firebase/Core/CHANGELOG.md @@ -0,0 +1,27 @@ +# Unreleased + +# 2017-11-30 -- v4.0.12 -- M20.2 +- [fixed] Removed `FIR_SWIFT_NAME` macro, replaced with proper `NS_SWIFT_NAME`. + +# 2017-11-14 -- v4.0.11 -- M20.1 +- [feature] Added `-FIRLoggerForceSTDERR` launch argument flag to force STDERR + output for all Firebase logging + +# 2017-08-25 -- v4.0.6 -- M18.1 +- [changed] Removed unused method + +# 2017-08-09 -- v4.0.5 -- M18.0 +- [changed] Log an error for an incorrectly configured bundle ID instead of an info + message. + +# 2017-07-12 -- v4.0.4 -- M17.4 +- [changed] Switched to using the https://cocoapods.org/pods/nanopb pod instead of + linking nanopb in (preventing linker conflicts). + +# 2017-06-06 -- v4.0.1 -- M17.1 +- [fixed] Improved diagnostic messages for Swift + +# 2017-05-17 -- v4.0.0 -- M17 +- [changed] Update FIROptions to have a simpler constructor and mutable properties +- [feature] Swift naming update, FIR prefix dropped +- [changed] Internal cleanup for open source release -- cgit v1.2.3 From f851af5323b8ded1d609ced61ad319645337d6d5 Mon Sep 17 00:00:00 2001 From: Gil Date: Fri, 22 Dec 2017 15:09:20 -0800 Subject: Run FIRSetLoggerLevel and FIRIsLoggableLevel on the same thread (#592) This fixes a race condition where a caller calls FIRSetLoggerLevel and then checks FIRIsLoggableLevel immediately after. --- Firebase/Core/FIRLogger.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Firebase/Core/FIRLogger.m b/Firebase/Core/FIRLogger.m index ba22bde..2b2a0ae 100644 --- a/Firebase/Core/FIRLogger.m +++ b/Firebase/Core/FIRLogger.m @@ -164,13 +164,13 @@ void FIRSetLoggerLevel(FIRLoggerLevel loggerLevel) { return; } FIRLoggerInitializeASL(); - dispatch_async(sFIRClientQueue, ^{ - // We should not raise the logger level if we are running from App Store. - if (loggerLevel >= FIRLoggerLevelNotice && [FIRAppEnvironmentUtil isFromAppStore]) { - return; - } + // We should not raise the logger level if we are running from App Store. + if (loggerLevel >= FIRLoggerLevelNotice && [FIRAppEnvironmentUtil isFromAppStore]) { + return; + } - sFIRLoggerMaximumLevel = loggerLevel; + sFIRLoggerMaximumLevel = loggerLevel; + dispatch_async(sFIRClientQueue, ^{ asl_set_filter(sFIRLoggerClient, ASL_FILTER_MASK_UPTO(loggerLevel)); }); } -- cgit v1.2.3 From 1ede1c9cb3890b37199ead0f893da45dcc2bf2cf Mon Sep 17 00:00:00 2001 From: Gil Date: Mon, 1 Jan 2018 17:17:53 -0800 Subject: Use the log_apple.mm logger from C++ on iOS (#593) * Add all .mm files in Firestore/core to the build (which matches log_apple.mm). * Exclude log_stdio.cc * Add log_test.cc to the project --- FirebaseFirestore.podspec | 8 ++++++-- Firestore/Example/Firestore.xcodeproj/project.pbxproj | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/FirebaseFirestore.podspec b/FirebaseFirestore.podspec index 89292bf..5a3a1d6 100644 --- a/FirebaseFirestore.podspec +++ b/FirebaseFirestore.podspec @@ -32,17 +32,21 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling, 'Firestore/Source/**/*', 'Firestore/Port/**/*', 'Firestore/Protos/objc/**/*.[hm]', - 'Firestore/core/src/**/*.{h,cc}', + 'Firestore/core/src/**/*.{h,cc,mm}', 'Firestore/third_party/Immutable/*.[mh]', 'Firestore/third_party/abseil-cpp/absl/*.{h,cc}' ] s.requires_arc = [ 'Firestore/Source/**/*', + 'Firestore/core/src/**/*.mm', 'Firestore/third_party/Immutable/*.[mh]' ] s.exclude_files = [ 'Firestore/Port/*test.cc', - 'Firestore/third_party/Immutable/Tests/**' + 'Firestore/third_party/Immutable/Tests/**', + + # Exclude alternate implementations for other platforms + 'Firestore/core/src/firebase/firestore/util/log_stdio.cc' ] s.public_header_files = 'Firestore/Source/Public/*.h' diff --git a/Firestore/Example/Firestore.xcodeproj/project.pbxproj b/Firestore/Example/Firestore.xcodeproj/project.pbxproj index 6823ab1..faed0b8 100644 --- a/Firestore/Example/Firestore.xcodeproj/project.pbxproj +++ b/Firestore/Example/Firestore.xcodeproj/project.pbxproj @@ -30,6 +30,7 @@ 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 */; }; @@ -190,6 +191,7 @@ 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 = ""; }; 54764FAE1FAA21B90085E60A /* FSTGoogleTestTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = FSTGoogleTestTests.mm; path = GoogleTest/FSTGoogleTestTests.mm; sourceTree = ""; }; 5491BC711FB44593008B3588 /* FSTIntegrationTestCase.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FSTIntegrationTestCase.mm; sourceTree = ""; }; + 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 = ""; }; 54DA129C1F315EE100DD57A1 /* collection_spec_test.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = collection_spec_test.json; sourceTree = ""; }; 54DA129D1F315EE100DD57A1 /* existence_filter_spec_test.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = existence_filter_spec_test.json; sourceTree = ""; }; 54DA129E1F315EE100DD57A1 /* limbo_spec_test.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = limbo_spec_test.json; sourceTree = ""; }; @@ -372,6 +374,7 @@ isa = PBXGroup; children = ( 54740A521FC913E500713A1A /* autoid_test.cc */, + 54C2294E1FECABAE007D065B /* log_test.cc */, 54740A531FC913E500713A1A /* secure_random_test.cc */, ); name = util; @@ -1169,6 +1172,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 */, -- cgit v1.2.3 From 412e759a19117974cca18e86ea44742ae0dec659 Mon Sep 17 00:00:00 2001 From: Greg Soltis Date: Mon, 1 Jan 2018 17:43:54 -0800 Subject: Expose library version, move it out of options (#588) * slight cleanup * Use -D defines for versions * Undo FIROptionsTest change * Drop failed macro attempt * Add correct version to podspec * Add newline * Shuffle files around * Bring back log change * Fix change * Fix space --- .gitignore | 1 + Firebase/Core/FIRLogger.m | 3 ++- Firebase/Core/FIRVersion.m | 39 ++++++++++++++++++++++++++++++++++++++ Firebase/Core/Private/FIRVersion.h | 23 ++++++++++++++++++++++ FirebaseCore.podspec | 3 +++ 5 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 Firebase/Core/FIRVersion.m create mode 100644 Firebase/Core/Private/FIRVersion.h diff --git a/.gitignore b/.gitignore index 93e3974..61fc41b 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,4 @@ Podfile.lock # CMake .downloads +.idea/ diff --git a/Firebase/Core/FIRLogger.m b/Firebase/Core/FIRLogger.m index 2b2a0ae..55dfdb9 100644 --- a/Firebase/Core/FIRLogger.m +++ b/Firebase/Core/FIRLogger.m @@ -15,6 +15,7 @@ #import "Private/FIRLogger.h" #import "FIRLoggerLevel.h" +#import "FIRVersion.h" #import "third_party/FIRAppEnvironmentUtil.h" #include @@ -229,7 +230,7 @@ void FIRLogBasic(FIRLoggerLevel level, NSCAssert(numberOfMatches == 1, @"Incorrect message code format."); #endif NSString *logMsg = [[NSString alloc] initWithFormat:message arguments:args_ptr]; - logMsg = [NSString stringWithFormat:@"%@[%@] %@", service, messageCode, logMsg]; + logMsg = [NSString stringWithFormat:@"%s - %@[%@] %@", FirebaseVersionString, service, messageCode, logMsg]; dispatch_async(sFIRClientQueue, ^{ asl_log(sFIRLoggerClient, NULL, level, "%s", logMsg.UTF8String); }); diff --git a/Firebase/Core/FIRVersion.m b/Firebase/Core/FIRVersion.m new file mode 100644 index 0000000..8186683 --- /dev/null +++ b/Firebase/Core/FIRVersion.m @@ -0,0 +1,39 @@ +/* + * 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 Firebase_VERSION +#error "Firebase_VERSION is not defined: add -DFirebase_VERSION=... to the build invocation" +#endif + +#ifndef FIRCore_VERSION +#error "FIRCore_VERSION is not defined: add -DFIRCore_VERSION=... to the build invocation" +#endif + + +// The following two macros supply the incantation so that the C +// preprocessor does not try to parse the version as a floating +// point number. See +// https://www.guyrutenberg.com/2008/12/20/expanding-macros-into-string-constants-in-c/ +#define STR(x) STR_EXPAND(x) +#define STR_EXPAND(x) #x + +const unsigned char *const FirebaseVersionString = + (const unsigned char *const)STR(Firebase_VERSION); + +const unsigned char *const FirebaseCoreVersionString = + (const unsigned char *const)STR(FIRCore_VERSION); diff --git a/Firebase/Core/Private/FIRVersion.h b/Firebase/Core/Private/FIRVersion.h new file mode 100644 index 0000000..f18f61f --- /dev/null +++ b/Firebase/Core/Private/FIRVersion.h @@ -0,0 +1,23 @@ +/* + * 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. + */ + +#import + +/** The version of the Firebase SDK. */ +FOUNDATION_EXPORT const unsigned char *const FirebaseVersionString; + +/** The version of the FirebaseCore Component. */ +FOUNDATION_EXPORT const unsigned char *const FirebaseCoreVersionString; diff --git a/FirebaseCore.podspec b/FirebaseCore.podspec index ac8d5b9..59460ef 100644 --- a/FirebaseCore.podspec +++ b/FirebaseCore.podspec @@ -28,4 +28,7 @@ Firebase Core includes FIRApp and FIROptions which provide central configuration s.private_header_files = 'Firebase/Core/Private/*.h' s.framework = 'SystemConfiguration' s.dependency 'GoogleToolboxForMac/NSData+zlib', '~> 2.1' + s.pod_target_xcconfig = { + 'OTHER_CFLAGS' => '-DFIRCore_VERSION=' + s.version.to_s + ' -DFirebase_VERSION=4.8.0' + } end -- cgit v1.2.3 From 13da48d8a4fcdfe288fa15c788c59e7f54edf42c Mon Sep 17 00:00:00 2001 From: Gil Date: Mon, 1 Jan 2018 21:00:32 -0800 Subject: Build FirebaseCore from CMake (#594) * Don't bother specifying a download directory to CMake ExternalProject * Teach CMake to build pure Xcode projects as dependencies This allows downstream code (like log_apple.mm) to consume this for testing within the CMake build without requiring a CMake-native build for these components. This makes integrating these components into the cmake build essentially free from the point of view of the consumed component. * Get the CMake build semi-working on Linux again Many prebuilt versions of cmake on Linux lack the ability to download over https so use git to get googletest. Don't attempt to build FirebaseCore on Linux; there's no xcodebuild. Note the build is still ultimately broken because we don't yet have an alternative to arc4random on Linux but at least this is no more broken than it was before. --- CMakeLists.txt | 15 +++- Firestore/CMakeLists.txt | 4 + Firestore/core/src/firebase/firestore/base/port.h | 2 +- cmake/FindFirebaseCore.cmake | 57 ++++++++++++++ cmake/external/FirebaseCore.cmake | 23 ++++++ cmake/external/firestore.cmake | 2 +- cmake/external/googletest.cmake | 5 +- cmake/xcodebuild.cmake | 90 +++++++++++++++++++++++ 8 files changed, 189 insertions(+), 9 deletions(-) create mode 100644 cmake/FindFirebaseCore.cmake create mode 100644 cmake/external/FirebaseCore.cmake create mode 100644 cmake/xcodebuild.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 63e1a39..52a4376 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,15 +22,22 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Debug) endif() +if(APPLE) + # When building on the apple platform certain Objective-C++ classes bridge + # back into other Firebase Cocoapods. This requires shelling out to xcodebuild + # to verify the built frameworks are up-to-date. You can disable this to speed + # up the build. + option(BUILD_PODS, "Always build dependent cocoapods." ON) +endif(APPLE) + list(INSERT CMAKE_MODULE_PATH 0 ${PROJECT_SOURCE_DIR}/cmake) -# External Projects install into this prefix and download into the source tree -# to avoid re-downloading repeatedly during development. -set(FIREBASE_INSTALL_DIR "${PROJECT_BINARY_DIR}/usr") -set(FIREBASE_DOWNLOAD_DIR "${PROJECT_SOURCE_DIR}/.downloads") +set(FIREBASE_INSTALL_DIR ${PROJECT_BINARY_DIR}) enable_testing() +include(external/FirebaseCore) + include(external/googletest) include(external/leveldb) include(external/abseil-cpp) diff --git a/Firestore/CMakeLists.txt b/Firestore/CMakeLists.txt index 906b6e4..ba9998d 100644 --- a/Firestore/CMakeLists.txt +++ b/Firestore/CMakeLists.txt @@ -24,6 +24,10 @@ 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) set(CMAKE_CXX_STANDARD_REQUIRED ON) 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/cmake/FindFirebaseCore.cmake b/cmake/FindFirebaseCore.cmake new file mode 100644 index 0000000..e23d6db --- /dev/null +++ b/cmake/FindFirebaseCore.cmake @@ -0,0 +1,57 @@ +# 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. + +find_library( + FIREBASECORE_LIBRARY + FirebaseCore + PATHS ${FIREBASE_BINARY_DIR}/Frameworks +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + FirebaseCore + DEFAULT_MSG + FIREBASECORE_LIBRARY +) + +if(FIREBASECORE_FOUND) + # Emulate CocoaPods behavior which makes all headers available unqualified. + set( + FIREBASECORE_INCLUDE_DIRS + ${FIREBASECORE_LIBRARY}/Headers + ${FIREBASECORE_LIBRARY}/PrivateHeaders + ) + + # TODO(mcg): on iOS this should depend on UIKit. + set( + FIREBASECORE_LIBRARIES + ${FIREBASECORE_LIBRARY} + "-framework AppKit" + ) + + if(NOT TARGET FirebaseCore) + # Add frameworks as INTERFACE libraries rather than IMPORTED so that + # framework behavior is preserved. + add_library(FirebaseCore INTERFACE) + + set_property( + TARGET FirebaseCore APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES ${FIREBASECORE_INCLUDE_DIRS} + ) + set_property( + TARGET FirebaseCore APPEND PROPERTY + INTERFACE_LINK_LIBRARIES ${FIREBASECORE_LIBRARIES} + ) + endif() +endif(FIREBASECORE_FOUND) diff --git a/cmake/external/FirebaseCore.cmake b/cmake/external/FirebaseCore.cmake new file mode 100644 index 0000000..8be6969 --- /dev/null +++ b/cmake/external/FirebaseCore.cmake @@ -0,0 +1,23 @@ +# 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(xcodebuild) + +if(APPLE) + # FirebaseCore is only available as a CocoaPod build. + xcodebuild(FirebaseCore) +else() + # On non-Apple platforms, there's no way to build FirebaseCore. + add_custom_target(FirebaseCore) +endif() diff --git a/cmake/external/firestore.cmake b/cmake/external/firestore.cmake index 9fb673e..61f79f3 100644 --- a/cmake/external/firestore.cmake +++ b/cmake/external/firestore.cmake @@ -19,7 +19,7 @@ set(binary_dir ${PROJECT_BINARY_DIR}/Firestore) ExternalProject_Add( Firestore - DEPENDS abseil-cpp googletest leveldb + DEPENDS abseil-cpp FirebaseCore googletest leveldb # Lay the binary directory out as if this were a subproject. This makes it # possible to build and test in it directly. diff --git a/cmake/external/googletest.cmake b/cmake/external/googletest.cmake index a956e9f..128f849 100644 --- a/cmake/external/googletest.cmake +++ b/cmake/external/googletest.cmake @@ -17,12 +17,11 @@ include(ExternalProject) ExternalProject_Add( googletest - URL "https://github.com/google/googletest/archive/release-1.8.0.tar.gz" - URL_HASH "SHA256=58a6f4277ca2bc8565222b3bbd58a177609e9c488e8a72649359ba51450db7d8" + GIT_REPOSITORY "https://github.com/google/googletest.git" + GIT_TAG "release-1.8.0" PREFIX ${PROJECT_BINARY_DIR}/third_party/googletest - DOWNLOAD_DIR ${FIREBASE_DOWNLOAD_DIR} INSTALL_DIR ${FIREBASE_INSTALL_DIR} TEST_COMMAND "" diff --git a/cmake/xcodebuild.cmake b/cmake/xcodebuild.cmake new file mode 100644 index 0000000..8312f6d --- /dev/null +++ b/cmake/xcodebuild.cmake @@ -0,0 +1,90 @@ +# 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(CMakeParseArguments) +include(ExternalProject) + +# Builds an existing Xcode project or workspace as an external project in CMake. +# +# xcodebuild( [