From 77d34759e26c3a44026467370530710f396ec4e7 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 16 Jun 2021 11:07:43 -0400 Subject: [PATCH 1/4] Fix "Undefined symbols" linker error when DocumentChange::npos was used. --- firestore/integration_test/src/integration_test.cc | 8 ++++++++ .../integration_test_internal/src/integration_test.cc | 8 ++++++++ firestore/src/common/document_change.cc | 2 ++ 3 files changed, 18 insertions(+) diff --git a/firestore/integration_test/src/integration_test.cc b/firestore/integration_test/src/integration_test.cc index b62edbe5bf..a70503cf61 100644 --- a/firestore/integration_test/src/integration_test.cc +++ b/firestore/integration_test/src/integration_test.cc @@ -651,6 +651,14 @@ TEST_F(FirebaseFirestoreBasicTest, TestQuery) { "int", firebase::firestore::FieldValue::Integer(101)))))); } +TEST_F(FirebaseFirestoreBasicTest, TestDocumentChangeNpos) { + // This test may seem pointless, but it exists to avoid the long-standing + // latent bug that `npos` was not defined on non-Android platforms and + // would therefore fail to link if used. + EXPECT_EQ(firebase::firestore::DocumentChange::npos, + static_cast(-1)); +} + TEST_F(FirebaseFirestoreBasicTest, TestInvalidatingReferencesWhenDeletingFirestore) { delete firestore_; diff --git a/firestore/integration_test_internal/src/integration_test.cc b/firestore/integration_test_internal/src/integration_test.cc index b62edbe5bf..a70503cf61 100644 --- a/firestore/integration_test_internal/src/integration_test.cc +++ b/firestore/integration_test_internal/src/integration_test.cc @@ -651,6 +651,14 @@ TEST_F(FirebaseFirestoreBasicTest, TestQuery) { "int", firebase::firestore::FieldValue::Integer(101)))))); } +TEST_F(FirebaseFirestoreBasicTest, TestDocumentChangeNpos) { + // This test may seem pointless, but it exists to avoid the long-standing + // latent bug that `npos` was not defined on non-Android platforms and + // would therefore fail to link if used. + EXPECT_EQ(firebase::firestore::DocumentChange::npos, + static_cast(-1)); +} + TEST_F(FirebaseFirestoreBasicTest, TestInvalidatingReferencesWhenDeletingFirestore) { delete firestore_; diff --git a/firestore/src/common/document_change.cc b/firestore/src/common/document_change.cc index 9908b679cb..780ae27302 100644 --- a/firestore/src/common/document_change.cc +++ b/firestore/src/common/document_change.cc @@ -23,6 +23,8 @@ using Type = DocumentChange::Type; // Older NDK (r16b) fails to define this properly. Fix this when support for // the older NDK is removed. const std::size_t DocumentChange::npos = static_cast(-1); +#else +constexpr std::size_t DocumentChange::npos; #endif // defined(ANDROID) DocumentChange::DocumentChange() {} From ee4fa77861e415fc86d15d596661f04d9485eda2 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 16 Jun 2021 11:08:38 -0400 Subject: [PATCH 2/4] Add change log entry --- release_build_files/readme.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/release_build_files/readme.md b/release_build_files/readme.md index 04e65f843a..a75f0645a8 100644 --- a/release_build_files/readme.md +++ b/release_build_files/readme.md @@ -567,6 +567,11 @@ code. ## Release Notes +### 8.0.1 +- Changes + - Firestore: Fixed a linker error when DocumentChange::npos was used. + ([#474](https://github.com/firebase/firebase-cpp-sdk/pull/474)). + ### 8.0.0 - Changes - Analytics: Removed `SetCurrentScreen()` following its removal from iOS SDK From 3be0e6977890086fa50579955f39e5f5bdc8efac Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 16 Jun 2021 14:28:06 -0400 Subject: [PATCH 3/4] Fix version number in change log entry (8.0.1 -> 8.1.0) --- release_build_files/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release_build_files/readme.md b/release_build_files/readme.md index a75f0645a8..4650c6785d 100644 --- a/release_build_files/readme.md +++ b/release_build_files/readme.md @@ -567,7 +567,7 @@ code. ## Release Notes -### 8.0.1 +### 8.1.0 - Changes - Firestore: Fixed a linker error when DocumentChange::npos was used. ([#474](https://github.com/firebase/firebase-cpp-sdk/pull/474)). From 1e1c41d68af2ca43250c438498f05565fbe2f822 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Mon, 21 Jun 2021 11:24:57 -0400 Subject: [PATCH 4/4] Add backticks around DocumentChange::npos. --- release_build_files/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release_build_files/readme.md b/release_build_files/readme.md index 4650c6785d..bc1fa8df34 100644 --- a/release_build_files/readme.md +++ b/release_build_files/readme.md @@ -569,7 +569,7 @@ code. ### 8.1.0 - Changes - - Firestore: Fixed a linker error when DocumentChange::npos was used. + - Firestore: Fixed a linker error when `DocumentChange::npos` was used. ([#474](https://github.com/firebase/firebase-cpp-sdk/pull/474)). ### 8.0.0