Преглед на файлове

Firestore: Remove vestigial mentions of STLport (#14348)

Denver Coneybeare преди 1 година
родител
ревизия
92f5241e17
променени са 3 файла, в които са добавени 5 реда и са изтрити 45 реда
  1. 2 10
      Firestore/core/include/firebase/firestore/timestamp.h
  2. 3 20
      Firestore/core/src/timestamp.cc
  3. 0 15
      Firestore/core/src/util/firestore_exceptions.h

+ 2 - 10
Firestore/core/include/firebase/firestore/timestamp.h

@@ -19,12 +19,10 @@
 
 #include <cstdint>
 #include <ctime>
-#include <iosfwd>
-#include <string>
 
-#if !defined(_STLPORT_VERSION)
 #include <chrono>
-#endif  // !defined(_STLPORT_VERSION)
+#include <iosfwd>
+#include <string>
 
 namespace firebase {
 
@@ -117,7 +115,6 @@ class Timestamp {
    */
   static Timestamp FromTimeT(time_t seconds_since_unix_epoch);
 
-#if !defined(_STLPORT_VERSION)
   /**
    * Converts `std::chrono::time_point` to a `Timestamp`.
    *
@@ -145,7 +142,6 @@ class Timestamp {
   template <typename Clock = std::chrono::system_clock,
             typename Duration = std::chrono::microseconds>
   std::chrono::time_point<Clock, Duration> ToTimePoint() const;
-#endif  // !defined(_STLPORT_VERSION)
 
   /**
    * Returns a string representation of this `Timestamp` for logging/debugging
@@ -205,8 +201,6 @@ inline bool operator==(const Timestamp& lhs, const Timestamp& rhs) {
   return !(lhs != rhs);
 }
 
-#if !defined(_STLPORT_VERSION)
-
 // Make sure the header compiles even when included after `<windows.h>` without
 // `NOMINMAX` defined. `push/pop_macro` pragmas are supported by Visual Studio
 // as well as Clang and GCC.
@@ -239,8 +233,6 @@ std::chrono::time_point<Clock, Duration> Timestamp::ToTimePoint() const {
 #pragma pop_macro("max")
 #pragma pop_macro("min")
 
-#endif  // !defined(_STLPORT_VERSION)
-
 }  // namespace firebase
 
 #endif  // FIRESTORE_CORE_INCLUDE_FIREBASE_FIRESTORE_TIMESTAMP_H_

+ 3 - 20
Firestore/core/src/timestamp.cc

@@ -20,8 +20,6 @@
 
 #if defined(__APPLE__)
 #import <CoreFoundation/CoreFoundation.h>
-#elif defined(_STLPORT_VERSION)
-#include <ctime>
 #endif
 
 #include "Firestore/core/src/util/hard_assert.h"
@@ -76,29 +74,16 @@ Timestamp Timestamp::Now() {
   auto nanos = static_cast<int32_t>(fraction * kNanosPerSecond);
   return MakeNormalizedTimestamp(seconds, nanos);
 
-#elif !defined(_STLPORT_VERSION)
-  // Use the standard <chrono> library from C++11 if possible.
-  return FromTimePoint(std::chrono::system_clock::now());
 #else
-  // If <chrono> is unavailable, use clock_gettime from POSIX, which supports
-  // up to nanosecond resolution. Note that it's a non-standard function
-  // contained in <time.h>.
-  //
-  // Note: it's possible to check for availability of POSIX clock_gettime using
-  // macros (see "Availability" at https://linux.die.net/man/3/clock_gettime).
-  // However, the only platform where <chrono> isn't available is Android with
-  // STLPort standard library, where clock_gettime is known to be available.
-  timespec now;
-  clock_gettime(CLOCK_REALTIME, &now);
-  return MakeNormalizedTimestamp(now.tv_sec, now.tv_nsec);
-#endif  // !defined(_STLPORT_VERSION)
+  // Use the standard <chrono> library from C++11.
+  return FromTimePoint(std::chrono::system_clock::now());
+#endif  // defined(__APPLE__)
 }
 
 Timestamp Timestamp::FromTimeT(const time_t seconds_since_unix_epoch) {
   return {seconds_since_unix_epoch, 0};
 }
 
-#if !defined(_STLPORT_VERSION)
 Timestamp Timestamp::FromTimePoint(
     const std::chrono::time_point<std::chrono::system_clock> time_point) {
   namespace chr = std::chrono;
@@ -111,8 +96,6 @@ Timestamp Timestamp::FromTimePoint(
   return result;
 }
 
-#endif  // !defined(_STLPORT_VERSION)
-
 std::string Timestamp::ToString() const {
   return absl::StrCat("Timestamp(seconds=", seconds_,
                       ", nanoseconds=", nanoseconds_, ")");

+ 0 - 15
Firestore/core/src/util/firestore_exceptions.h

@@ -27,26 +27,11 @@
 
 #include "Firestore/core/include/firebase/firestore/firestore_errors.h"
 
-#if defined(__ANDROID__)
-// Abseil does not support STLPort, so avoid their config.h here.
-//
-// TODO(b/163140650): Remove once the Firebase support floor moves to NDK R18.
-//
-// Meanwhile, NDK R16b (the current minimum) includes Clang 5.0.3 and GCC 4.9.
-// While Clang supports `__cpp_exceptions` at that version, GCC does not. Both
-// support `__EXCEPTIONS`.
-#if __EXCEPTIONS
-#define FIRESTORE_HAVE_EXCEPTIONS 1
-#endif
-
-#else  // !defined(__ANDROID__)
-// On any other supported platform, just take Abseil's word for it.
 #include "absl/base/config.h"
 
 #if ABSL_HAVE_EXCEPTIONS
 #define FIRESTORE_HAVE_EXCEPTIONS 1
 #endif
-#endif  // defined(__ANDROID__)
 
 namespace firebase {
 namespace firestore {