Browse Source

Fix unused variable warnings (#5389)

* Fix unused variable warnings

These are now exposed because libprotobuf is no longer polluting the
compiler command-line with -Wno-unused-parameter.

* Convert (void)var to __unused where possible
Gil 6 years ago
parent
commit
74f4ceb4c9
28 changed files with 122 additions and 147 deletions
  1. 2 4
      Firestore/Example/App/macOS/AppDelegate.m
  2. 2 0
      Firestore/Example/Tests/API/FIRFirestoreTests.mm
  3. 4 4
      Firestore/Example/Tests/Integration/API/FIRCursorTests.mm
  4. 20 20
      Firestore/Example/Tests/Integration/API/FIRDatabaseTests.mm
  5. 16 16
      Firestore/Example/Tests/Integration/API/FIRFirestoreSourceTests.mm
  6. 3 4
      Firestore/Example/Tests/Integration/API/FIRQueryTests.mm
  7. 8 8
      Firestore/Example/Tests/Integration/API/FIRValidationTests.mm
  8. 4 4
      Firestore/Example/Tests/Integration/FSTDatastoreTests.mm
  9. 2 2
      Firestore/Example/Tests/Integration/FSTSmokeTests.mm
  10. 23 23
      Firestore/Example/Tests/Integration/FSTTransactionTests.mm
  11. 4 4
      Firestore/Example/Tests/SpecTests/FSTSpecTests.mm
  12. 1 2
      Firestore/Example/Tests/Util/FSTIntegrationTestCase.h
  13. 6 7
      Firestore/Example/Tests/Util/FSTIntegrationTestCase.mm
  14. 1 3
      Firestore/Source/API/FIRCollectionReference.mm
  15. 1 2
      Firestore/Source/API/FIRFieldPath.mm
  16. 1 3
      Firestore/Source/API/FIRFirestoreSettings.mm
  17. 1 2
      Firestore/Source/API/FIRGeoPoint.mm
  18. 1 2
      Firestore/Source/API/FIRTimestamp.m
  19. 1 3
      Firestore/Source/API/FSTFirestoreComponent.mm
  20. 1 2
      Firestore/core/src/firebase/firestore/local/lru_garbage_collector.cc
  21. 4 3
      Firestore/core/src/firebase/firestore/local/memory_lru_reference_delegate.cc
  22. 2 2
      Firestore/core/src/firebase/firestore/local/simple_query_engine.cc
  23. 2 3
      Firestore/core/src/firebase/firestore/model/verify_mutation.cc
  24. 2 3
      Firestore/core/src/firebase/firestore/remote/serializer.cc
  25. 1 1
      Firestore/core/test/firebase/firestore/local/leveldb_opener_test.cc
  26. 4 6
      Firestore/core/test/firebase/firestore/remote/datastore_test.cc
  27. 3 3
      Firestore/core/test/firebase/firestore/remote/grpc_connection_test.cc
  28. 2 11
      Firestore/core/test/firebase/firestore/remote/serializer_test.cc

+ 2 - 4
Firestore/Example/App/macOS/AppDelegate.m

@@ -23,13 +23,11 @@
 
 @implementation AppDelegate
 
-- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
-  (void)aNotification;
+- (void)applicationDidFinishLaunching:(__unused NSNotification *)aNotification {
 }
 
-- (void)applicationWillTerminate:(NSNotification *)aNotification {
+- (void)applicationWillTerminate:(__unused NSNotification *)aNotification {
   // Insert code here to tear down your application
-  (void)aNotification;
 }
 
 @end

+ 2 - 0
Firestore/Example/Tests/API/FIRFirestoreTests.mm

@@ -45,6 +45,8 @@ namespace testutil = firebase::firestore::testutil;
       [self expectationWithDescription:@"Deleting the default app should invalidate the default "
                                        @"Firestore instance."];
   [app deleteApp:^(BOOL success) {
+    XCTAssertTrue(success);
+
     // Recreate the FIRApp with the same name, fetch a new Firestore instance and make sure it's
     // different than the other one.
     [FIRApp configureWithName:appName options:options];

+ 4 - 4
Firestore/Example/Tests/Integration/API/FIRCursorTests.mm

@@ -140,10 +140,10 @@
       readDocumentSetForRef:[[query queryStartingAfterValues:@[ [db documentWithPath:@"1/a"] ]]
                                 queryEndingAtValues:@[ [db documentWithPath:@"2/b"] ]]];
   NSMutableArray<NSString *> *actual = [NSMutableArray array];
-  [querySnapshot.documents enumerateObjectsUsingBlock:^(FIRDocumentSnapshot *_Nonnull doc,
-                                                        NSUInteger idx, BOOL *_Nonnull stop) {
-    [actual addObject:doc.data[@"k"]];
-  }];
+  [querySnapshot.documents
+      enumerateObjectsUsingBlock:^(FIRDocumentSnapshot *_Nonnull doc, NSUInteger, BOOL *) {
+        [actual addObject:doc.data[@"k"]];
+      }];
   XCTAssertEqualObjects(actual, (@[ @"1b", @"2a", @"2b" ]));
 }
 

+ 20 - 20
Firestore/Example/Tests/Integration/API/FIRDatabaseTests.mm

@@ -61,7 +61,7 @@ using firebase::firestore::util::TimerId;
 }
 
 - (void)testCanUpdateAnUnknownDocument {
-  [self readerAndWriterOnDocumentRef:^(NSString *path, FIRDocumentReference *readerRef,
+  [self readerAndWriterOnDocumentRef:^(FIRDocumentReference *readerRef,
                                        FIRDocumentReference *writerRef) {
     [self writeDocumentRef:writerRef data:@{@"a" : @"a"}];
     [self updateDocumentRef:readerRef data:@{@"b" : @"b"}];
@@ -73,7 +73,7 @@ using firebase::firestore::util::TimerId;
     XCTestExpectation *expectation =
         [self expectationWithDescription:@"testCanUpdateAnUnknownDocument"];
     [readerRef getDocumentWithSource:FIRFirestoreSourceCache
-                          completion:^(FIRDocumentSnapshot *doc, NSError *_Nullable error) {
+                          completion:^(FIRDocumentSnapshot *, NSError *_Nullable error) {
                             XCTAssertNotNil(error);
                             [expectation fulfill];
                           }];
@@ -539,7 +539,7 @@ using firebase::firestore::util::TimerId;
 
   XCTestExpectation *gotInitialSnapshot = [self expectationWithDescription:@"gotInitialSnapshot"];
   __block bool setupComplete = false;
-  [ref addSnapshotListener:^(FIRDocumentSnapshot *snapshot, NSError *error) {
+  [ref addSnapshotListener:^(FIRDocumentSnapshot *, NSError *error) {
     XCTAssertNil(error);
     [events addObject:@"doc"];
     // Wait for the initial event from the backend so that we know we'll get exactly one snapshot
@@ -584,7 +584,7 @@ using firebase::firestore::util::TimerId;
         XCTAssertNil(error1);
         FIRDocumentReference *strongDoc = weakDoc;
 
-        [strongDoc addSnapshotListener:^(FIRDocumentSnapshot *snapshot2, NSError *error2) {
+        [strongDoc addSnapshotListener:^(FIRDocumentSnapshot *, NSError *error2) {
           XCTAssertNil(error2);
 
           FIRDocumentReference *strongDoc2 = weakDoc;
@@ -607,7 +607,7 @@ using firebase::firestore::util::TimerId;
   __block int callbacks = 0;
 
   id<FIRListenerRegistration> listenerRegistration =
-      [docRef addSnapshotListener:^(FIRDocumentSnapshot *_Nullable doc, NSError *error) {
+      [docRef addSnapshotListener:^(FIRDocumentSnapshot *_Nullable doc, NSError *) {
         callbacks++;
 
         if (callbacks == 1) {
@@ -633,7 +633,7 @@ using firebase::firestore::util::TimerId;
   __block int callbacks = 0;
 
   id<FIRListenerRegistration> listenerRegistration =
-      [docRef addSnapshotListener:^(FIRDocumentSnapshot *_Nullable doc, NSError *error) {
+      [docRef addSnapshotListener:^(FIRDocumentSnapshot *_Nullable doc, NSError *) {
         callbacks++;
 
         if (callbacks == 1) {
@@ -670,7 +670,7 @@ using firebase::firestore::util::TimerId;
   id<FIRListenerRegistration> listenerRegistration = [docRef
       addSnapshotListenerWithIncludeMetadataChanges:YES
                                            listener:^(FIRDocumentSnapshot *_Nullable doc,
-                                                      NSError *error) {
+                                                      NSError *) {
                                              callbacks++;
 
                                              if (callbacks == 1) {
@@ -714,7 +714,7 @@ using firebase::firestore::util::TimerId;
   __block int callbacks = 0;
 
   id<FIRListenerRegistration> listenerRegistration =
-      [docRef addSnapshotListener:^(FIRDocumentSnapshot *_Nullable doc, NSError *error) {
+      [docRef addSnapshotListener:^(FIRDocumentSnapshot *_Nullable doc, NSError *) {
         callbacks++;
 
         if (callbacks == 1) {
@@ -756,7 +756,7 @@ using firebase::firestore::util::TimerId;
   id<FIRListenerRegistration> listenerRegistration = [docRef
       addSnapshotListenerWithIncludeMetadataChanges:YES
                                            listener:^(FIRDocumentSnapshot *_Nullable doc,
-                                                      NSError *error) {
+                                                      NSError *) {
                                              callbacks++;
 
                                              if (callbacks == 1) {
@@ -807,7 +807,7 @@ using firebase::firestore::util::TimerId;
   __block int callbacks = 0;
 
   id<FIRListenerRegistration> listenerRegistration =
-      [docRef addSnapshotListener:^(FIRDocumentSnapshot *_Nullable doc, NSError *error) {
+      [docRef addSnapshotListener:^(FIRDocumentSnapshot *_Nullable doc, NSError *) {
         callbacks++;
 
         if (callbacks == 1) {
@@ -848,7 +848,7 @@ using firebase::firestore::util::TimerId;
   id<FIRListenerRegistration> listenerRegistration = [docRef
       addSnapshotListenerWithIncludeMetadataChanges:YES
                                            listener:^(FIRDocumentSnapshot *_Nullable doc,
-                                                      NSError *error) {
+                                                      NSError *) {
                                              callbacks++;
 
                                              if (callbacks == 1) {
@@ -893,7 +893,7 @@ using firebase::firestore::util::TimerId;
   __block int callbacks = 0;
 
   id<FIRListenerRegistration> listenerRegistration =
-      [roomsRef addSnapshotListener:^(FIRQuerySnapshot *_Nullable docSet, NSError *error) {
+      [roomsRef addSnapshotListener:^(FIRQuerySnapshot *_Nullable docSet, NSError *) {
         callbacks++;
 
         if (callbacks == 1) {
@@ -935,7 +935,7 @@ using firebase::firestore::util::TimerId;
   __block int callbacks = 0;
 
   id<FIRListenerRegistration> listenerRegistration =
-      [roomsRef addSnapshotListener:^(FIRQuerySnapshot *_Nullable docSet, NSError *error) {
+      [roomsRef addSnapshotListener:^(FIRQuerySnapshot *_Nullable docSet, NSError *) {
         callbacks++;
 
         if (callbacks == 1) {
@@ -977,7 +977,7 @@ using firebase::firestore::util::TimerId;
   __block int callbacks = 0;
 
   id<FIRListenerRegistration> listenerRegistration =
-      [roomsRef addSnapshotListener:^(FIRQuerySnapshot *_Nullable docSet, NSError *error) {
+      [roomsRef addSnapshotListener:^(FIRQuerySnapshot *_Nullable docSet, NSError *) {
         callbacks++;
 
         if (callbacks == 1) {
@@ -1189,7 +1189,7 @@ using firebase::firestore::util::TimerId;
   [firestore disableNetworkWithCompletion:^(NSError *error) {
     XCTAssertNil(error);
 
-    [doc getDocumentWithCompletion:^(FIRDocumentSnapshot *snapshot, NSError *error) {
+    [doc getDocumentWithCompletion:^(FIRDocumentSnapshot *, NSError *error) {
       XCTAssertNotNil(error);
       [failExpectation fulfill];
     }];
@@ -1213,7 +1213,7 @@ using firebase::firestore::util::TimerId;
       // Verify that we are reading from cache.
       XCTAssertTrue(snapshot.metadata.fromCache);
       XCTAssertEqualObjects(snapshot.data, data);
-      [firestore enableNetworkWithCompletion:^(NSError *error) {
+      [firestore enableNetworkWithCompletion:^(NSError *) {
         [networkExpectation fulfill];
       }];
     }];
@@ -1272,7 +1272,7 @@ using firebase::firestore::util::TimerId;
 
   XCTAssertThrowsSpecific(
       {
-        [firestore disableNetworkWithCompletion:^(NSError *error){
+        [firestore disableNetworkWithCompletion:^(NSError *){
         }];
       },
       NSException, @"The client has already been terminated.");
@@ -1333,7 +1333,7 @@ using firebase::firestore::util::TimerId;
   FIRDocumentReference *docRef2 = [firestore2 documentWithPath:doc.path];
   XCTestExpectation *expectation2 = [self expectationWithDescription:@"getData"];
   [docRef2 getDocumentWithSource:FIRFirestoreSourceCache
-                      completion:^(FIRDocumentSnapshot *doc2, NSError *_Nullable error) {
+                      completion:^(FIRDocumentSnapshot *, NSError *_Nullable error) {
                         XCTAssertNotNil(error);
                         XCTAssertEqualObjects(error.domain, FIRFirestoreErrorDomain);
                         XCTAssertEqual(error.code, FIRFirestoreErrorCodeUnavailable);
@@ -1403,7 +1403,7 @@ using firebase::firestore::util::TimerId;
   [self awaitExpectations];
   XCTAssertThrowsSpecific(
       {
-        [firestore disableNetworkWithCompletion:^(NSError *error){
+        [firestore disableNetworkWithCompletion:^(NSError *){
         }];
       },
       NSException, @"The client has already been terminated.");
@@ -1412,7 +1412,7 @@ using firebase::firestore::util::TimerId;
   [self awaitExpectations];
   XCTAssertThrowsSpecific(
       {
-        [firestore enableNetworkWithCompletion:^(NSError *error){
+        [firestore enableNetworkWithCompletion:^(NSError *){
         }];
       },
       NSException, @"The client has already been terminated.");

+ 16 - 16
Firestore/Example/Tests/Integration/API/FIRFirestoreSourceTests.mm

@@ -72,7 +72,7 @@
   FIRDocumentReference *doc = [self.db documentWithPath:@"foo/__invalid__"];
 
   XCTestExpectation *completed = [self expectationWithDescription:@"get completed"];
-  [doc getDocumentWithCompletion:^(FIRDocumentSnapshot *snapshot, NSError *error) {
+  [doc getDocumentWithCompletion:^(FIRDocumentSnapshot *, NSError *error) {
     XCTAssertNotNil(error);
     [completed fulfill];
   }];
@@ -84,7 +84,7 @@
   FIRCollectionReference *col = [self.db collectionWithPath:@"__invalid__"];
 
   XCTestExpectation *completed = [self expectationWithDescription:@"get completed"];
-  [col getDocumentsWithCompletion:^(FIRQuerySnapshot *snapshot, NSError *error) {
+  [col getDocumentsWithCompletion:^(FIRQuerySnapshot *, NSError *error) {
     XCTAssertNotNil(error);
     [completed fulfill];
   }];
@@ -107,7 +107,7 @@
   // server responses below.
   NSDictionary<NSString *, id> *newData = @{@"key2" : @"value2"};
   [doc setData:newData
-      completion:^(NSError *_Nullable error) {
+      completion:^(NSError *) {
         XCTAssertTrue(false, "Because we're offline, this should never occur.");
       }];
 
@@ -217,7 +217,7 @@
   // server responses below.
   NSDictionary<NSString *, id> *newData = @{@"key2" : @"value2"};
   [doc setData:newData
-      completion:^(NSError *_Nullable error) {
+      completion:^(NSError *) {
         XCTFail("Because we're offline, this should never occur.");
       }];
 
@@ -326,7 +326,7 @@
   // attempt to get doc and ensure it cannot be retreived
   XCTestExpectation *failedGetDocCompletion = [self expectationWithDescription:@"failedGetDoc"];
   [doc getDocumentWithSource:FIRFirestoreSourceServer
-                  completion:^(FIRDocumentSnapshot *snapshot, NSError *error) {
+                  completion:^(FIRDocumentSnapshot *, NSError *error) {
                     XCTAssertNotNil(error);
                     XCTAssertEqualObjects(error.domain, FIRFirestoreErrorDomain);
                     XCTAssertEqual(error.code, FIRFirestoreErrorCodeUnavailable);
@@ -352,7 +352,7 @@
   // attempt to get docs and ensure they cannot be retreived
   XCTestExpectation *failedGetDocsCompletion = [self expectationWithDescription:@"failedGetDocs"];
   [col getDocumentsWithSource:FIRFirestoreSourceServer
-                   completion:^(FIRQuerySnapshot *snapshot, NSError *error) {
+                   completion:^(FIRQuerySnapshot *, NSError *error) {
                      XCTAssertNotNil(error);
                      XCTAssertEqualObjects(error.domain, FIRFirestoreErrorDomain);
                      XCTAssertEqual(error.code, FIRFirestoreErrorCodeUnavailable);
@@ -376,14 +376,14 @@
   // server responses below.
   NSDictionary<NSString *, id> *newData = @{@"key2" : @"value2"};
   [doc setData:newData
-      completion:^(NSError *_Nullable error) {
+      completion:^(NSError *) {
         XCTAssertTrue(false, "Because we're offline, this should never occur.");
       }];
 
   // Create an initial listener for this query (to attempt to disrupt the gets below) and wait for
   // the listener to deliver its initial snapshot before continuing.
   XCTestExpectation *listenerReady = [self expectationWithDescription:@"listenerReady"];
-  [doc addSnapshotListener:^(FIRDocumentSnapshot *snapshot, NSError *error) {
+  [doc addSnapshotListener:^(FIRDocumentSnapshot *, NSError *) {
     [listenerReady fulfill];
   }];
   [self awaitExpectations];
@@ -406,7 +406,7 @@
   // attempt to get doc (from the server) and ensure it cannot be retreived
   XCTestExpectation *failedGetDocCompletion = [self expectationWithDescription:@"failedGetDoc"];
   [doc getDocumentWithSource:FIRFirestoreSourceServer
-                  completion:^(FIRDocumentSnapshot *snapshot, NSError *error) {
+                  completion:^(FIRDocumentSnapshot *, NSError *error) {
                     XCTAssertNotNil(error);
                     XCTAssertEqualObjects(error.domain, FIRFirestoreErrorDomain);
                     XCTAssertEqual(error.code, FIRFirestoreErrorCodeUnavailable);
@@ -440,7 +440,7 @@
   // below) and wait for the listener to deliver its initial snapshot before
   // continuing.
   XCTestExpectation *listenerReady = [self expectationWithDescription:@"listenerReady"];
-  [col addSnapshotListener:^(FIRQuerySnapshot *snapshot, NSError *error) {
+  [col addSnapshotListener:^(FIRQuerySnapshot *, NSError *) {
     [listenerReady fulfill];
   }];
   [self awaitExpectations];
@@ -480,7 +480,7 @@
   // attempt to get docs (from the server) and ensure they cannot be retreived
   XCTestExpectation *failedGetDocsCompletion = [self expectationWithDescription:@"failedGetDocs"];
   [col getDocumentsWithSource:FIRFirestoreSourceServer
-                   completion:^(FIRQuerySnapshot *snapshot, NSError *error) {
+                   completion:^(FIRQuerySnapshot *, NSError *error) {
                      XCTAssertNotNil(error);
                      XCTAssertEqualObjects(error.domain, FIRFirestoreErrorDomain);
                      XCTAssertEqual(error.code, FIRFirestoreErrorCodeUnavailable);
@@ -519,7 +519,7 @@
   // Attempt to get doc. This will fail since there's nothing in cache.
   XCTestExpectation *getNonExistingDocCompletion =
       [self expectationWithDescription:@"getNonExistingDoc"];
-  [doc getDocumentWithCompletion:^(FIRDocumentSnapshot *snapshot, NSError *error) {
+  [doc getDocumentWithCompletion:^(FIRDocumentSnapshot *, NSError *error) {
     XCTAssertNotNil(error);
     XCTAssertEqualObjects(error.domain, FIRFirestoreErrorDomain);
     XCTAssertEqual(error.code, FIRFirestoreErrorCodeUnavailable);
@@ -569,7 +569,7 @@
   XCTestExpectation *getNonExistingDocCompletion =
       [self expectationWithDescription:@"getNonExistingDoc"];
   [doc getDocumentWithSource:FIRFirestoreSourceCache
-                  completion:^(FIRDocumentSnapshot *snapshot, NSError *error) {
+                  completion:^(FIRDocumentSnapshot *, NSError *error) {
                     XCTAssertNotNil(error);
                     XCTAssertEqualObjects(error.domain, FIRFirestoreErrorDomain);
                     XCTAssertEqual(error.code, FIRFirestoreErrorCodeUnavailable);
@@ -599,7 +599,7 @@
   XCTestExpectation *getNonExistingDocCompletion =
       [self expectationWithDescription:@"getNonExistingDoc"];
   [doc getDocumentWithSource:FIRFirestoreSourceCache
-                  completion:^(FIRDocumentSnapshot *snapshot, NSError *error) {
+                  completion:^(FIRDocumentSnapshot *, NSError *error) {
                     XCTAssertNotNil(error);
                     XCTAssertEqualObjects(error.domain, FIRFirestoreErrorDomain);
                     XCTAssertEqual(error.code, FIRFirestoreErrorCodeUnavailable);
@@ -673,7 +673,7 @@
   XCTestExpectation *getNonExistingDocCompletion =
       [self expectationWithDescription:@"getNonExistingDoc"];
   [doc getDocumentWithSource:FIRFirestoreSourceServer
-                  completion:^(FIRDocumentSnapshot *snapshot, NSError *error) {
+                  completion:^(FIRDocumentSnapshot *, NSError *error) {
                     XCTAssertNotNil(error);
                     XCTAssertEqualObjects(error.domain, FIRFirestoreErrorDomain);
                     XCTAssertEqual(error.code, FIRFirestoreErrorCodeUnavailable);
@@ -691,7 +691,7 @@
   // attempt to get collection and ensure that it cannot be retreived
   XCTestExpectation *failedGetDocsCompletion = [self expectationWithDescription:@"failedGetDocs"];
   [col getDocumentsWithSource:FIRFirestoreSourceServer
-                   completion:^(FIRQuerySnapshot *snapshot, NSError *error) {
+                   completion:^(FIRQuerySnapshot *, NSError *error) {
                      XCTAssertNotNil(error);
                      XCTAssertEqualObjects(error.domain, FIRFirestoreErrorDomain);
                      XCTAssertEqual(error.code, FIRFirestoreErrorCodeUnavailable);

+ 3 - 4
Firestore/Example/Tests/Integration/API/FIRQueryTests.mm

@@ -60,10 +60,9 @@
 - (void)testLimitToLastMustAlsoHaveExplicitOrderBy {
   FIRCollectionReference *collRef = [self collectionRefWithDocuments:@{}];
   FIRQuery *query = [collRef queryLimitedToLast:2];
-  FSTAssertThrows(
-      [query getDocumentsWithCompletion:^(FIRQuerySnapshot *documentSet, NSError *error){
-      }],
-      @"limit(toLast:) queries require specifying at least one OrderBy() clause.");
+  FSTAssertThrows([query getDocumentsWithCompletion:^(FIRQuerySnapshot *, NSError *){
+                  }],
+                  @"limit(toLast:) queries require specifying at least one OrderBy() clause.");
 }
 
 // Two queries that mapped to the same target ID are referred to as

+ 8 - 8
Firestore/Example/Tests/Integration/API/FIRValidationTests.mm

@@ -88,13 +88,13 @@ namespace testutil = firebase::firestore::testutil;
 
 - (void)testNilTransactionBlocksFail {
   FSTAssertThrows([self.db runTransactionWithBlock:nil
-                                        completion:^(id result, NSError *error) {
+                                        completion:^(id, NSError *) {
                                           XCTFail(@"Completion shouldn't run.");
                                         }],
                   @"Transaction block cannot be nil.");
 
   FSTAssertThrows([self.db
-                      runTransactionWithBlock:^id(FIRTransaction *transaction, NSError **pError) {
+                      runTransactionWithBlock:^id(FIRTransaction *, NSError **) {
                         XCTFail(@"Transaction block shouldn't run.");
                         return nil;
                       }
@@ -223,13 +223,13 @@ namespace testutil = firebase::firestore::testutil;
 
   XCTestExpectation *transactionDone = [self expectationWithDescription:@"transaction done"];
   [ref.firestore
-      runTransactionWithBlock:^id(FIRTransaction *transaction, NSError **pError) {
+      runTransactionWithBlock:^id(FIRTransaction *transaction, NSError **) {
         // Note ref2 does not exist at this point so set that and update ref.
         [transaction updateData:data forDocument:ref];
         [transaction setData:data forDocument:ref2];
         return nil;
       }
-      completion:^(id result, NSError *error) {
+      completion:^(id, NSError *error) {
         // ends up being a no-op transaction.
         XCTAssertNil(error);
         [transactionDone fulfill];
@@ -325,7 +325,7 @@ namespace testutil = firebase::firestore::testutil;
 
   XCTestExpectation *transactionDone = [self expectationWithDescription:@"transaction done"];
   [db1
-      runTransactionWithBlock:^id(FIRTransaction *txn, NSError **pError) {
+      runTransactionWithBlock:^id(FIRTransaction *txn, NSError **) {
         FSTAssertThrows([txn getDocument:badRef error:nil], reason);
         FSTAssertThrows([txn setData:data forDocument:badRef], reason);
         FSTAssertThrows([txn setData:data forDocument:badRef merge:YES], reason);
@@ -333,7 +333,7 @@ namespace testutil = firebase::firestore::testutil;
         FSTAssertThrows([txn deleteDocument:badRef], reason);
         return nil;
       }
-      completion:^(id result, NSError *error) {
+      completion:^(id, NSError *error) {
         // ends up being a no-op transaction.
         XCTAssertNil(error);
         [transactionDone fulfill];
@@ -798,7 +798,7 @@ namespace testutil = firebase::firestore::testutil;
 
   XCTestExpectation *transactionDone = [self expectationWithDescription:@"transaction done"];
   [ref.firestore
-      runTransactionWithBlock:^id(FIRTransaction *transaction, NSError **pError) {
+      runTransactionWithBlock:^id(FIRTransaction *transaction, NSError **) {
         if (includeSets) {
           FSTAssertThrows([transaction setData:data forDocument:ref], reason, @"for %@", data);
         }
@@ -807,7 +807,7 @@ namespace testutil = firebase::firestore::testutil;
         }
         return nil;
       }
-      completion:^(id result, NSError *error) {
+      completion:^(id, NSError *error) {
         // ends up being a no-op transaction.
         XCTAssertNil(error);
         [transactionDone fulfill];

+ 4 - 4
Firestore/Example/Tests/Integration/FSTDatastoreTests.mm

@@ -143,11 +143,11 @@ NS_ASSUME_NONNULL_BEGIN
   [expectation fulfill];
 }
 
-- (void)rejectFailedWriteWithBatchID:(BatchId)batchID error:(NSError *)error {
+- (void)rejectFailedWriteWithBatchID:(__unused BatchId)batchID error:(__unused NSError *)error {
   HARD_FAIL("Not implemented");
 }
 
-- (DocumentKeySet)remoteKeysForTarget:(TargetId)targetId {
+- (DocumentKeySet)remoteKeysForTarget:(__unused TargetId)targetId {
   return DocumentKeySet{};
 }
 
@@ -158,7 +158,7 @@ NS_ASSUME_NONNULL_BEGIN
   [expectation fulfill];
 }
 
-- (void)rejectListenWithTargetID:(const TargetId)targetID error:(NSError *)error {
+- (void)rejectListenWithTargetID:(__unused const TargetId)targetID error:(__unused NSError *)error {
   HARD_FAIL("Not implemented");
 }
 
@@ -194,7 +194,7 @@ class RemoteStoreEventCapture : public RemoteStoreCallback {
     [underlying_capture_ rejectFailedWriteWithBatchID:batch_id error:error.ToNSError()];
   }
 
-  void HandleOnlineStateChange(OnlineState online_state) override {
+  void HandleOnlineStateChange(OnlineState) override {
     HARD_FAIL("Not implemented");
   }
 

+ 2 - 2
Firestore/Example/Tests/Integration/FSTSmokeTests.mm

@@ -42,7 +42,7 @@
 }
 
 - (void)testObservesExistingDocument {
-  [self readerAndWriterOnDocumentRef:^(NSString *, FIRDocumentReference *readerRef,
+  [self readerAndWriterOnDocumentRef:^(FIRDocumentReference *readerRef,
                                        FIRDocumentReference *writerRef) {
     NSDictionary<NSString *, id> *data = [self chatMessage];
     [self writeDocumentRef:writerRef data:data];
@@ -59,7 +59,7 @@
 }
 
 - (void)testObservesNewDocument {
-  [self readerAndWriterOnDocumentRef:^(NSString *, FIRDocumentReference *readerRef,
+  [self readerAndWriterOnDocumentRef:^(FIRDocumentReference *readerRef,
                                        FIRDocumentReference *writerRef) {
     id<FIRListenerRegistration> listenerRegistration =
         [readerRef addSnapshotListener:self.eventAccumulator.valueEventHandler];

+ 23 - 23
Firestore/Example/Tests/Integration/FSTTransactionTests.mm

@@ -203,11 +203,11 @@ TransactionStage get = ^(FIRTransaction *transaction, FIRDocumentReference *doc)
                          data:(NSDictionary<NSString *, id> *)data {
   __block NSError *errorResult;
   XCTestExpectation *expectation = [_testCase expectationWithDescription:@"prepareDoc:set"];
-  [_docRef setData:data
-        completion:^(NSError *error) {
-          errorResult = error;
-          [expectation fulfill];
-        }];
+  [ref setData:data
+      completion:^(NSError *error) {
+        errorResult = error;
+        [expectation fulfill];
+      }];
   [_testCase awaitExpectations];
   return errorResult;
 }
@@ -216,13 +216,13 @@ TransactionStage get = ^(FIRTransaction *transaction, FIRDocumentReference *doc)
   XCTestExpectation *expectation =
       [_testCase expectationWithDescription:@"runSuccessfulTransaction"];
   [_db
-      runTransactionWithBlock:^id _Nullable(FIRTransaction *transaction, NSError **error) {
+      runTransactionWithBlock:^id _Nullable(FIRTransaction *transaction, NSError **) {
         for (TransactionStage stage in self->_stages) {
           stage(transaction, self->_docRef);
         }
         return @YES;
       }
-      completion:^(id _Nullable result, NSError *_Nullable error) {
+      completion:^(id, NSError *error) {
         [expectation fulfill];
         NSString *message =
             [NSString stringWithFormat:@"Expected the sequence %@, to succeed, but got %d.",
@@ -237,13 +237,13 @@ TransactionStage get = ^(FIRTransaction *transaction, FIRDocumentReference *doc)
   XCTestExpectation *expectation =
       [_testCase expectationWithDescription:@"runFailingTransactionWithError"];
   [_db
-      runTransactionWithBlock:^id _Nullable(FIRTransaction *transaction, NSError **error) {
+      runTransactionWithBlock:^id _Nullable(FIRTransaction *transaction, NSError **) {
         for (TransactionStage stage in self->_stages) {
           stage(transaction, self->_docRef);
         }
         return @YES;
       }
-      completion:^(id _Nullable result, NSError *_Nullable error) {
+      completion:^(id, NSError *_Nullable error) {
         [expectation fulfill];
         NSString *message =
             [NSString stringWithFormat:@"Expected the sequence (%@), to fail, but it didn't.",
@@ -363,7 +363,7 @@ TransactionStage get = ^(FIRTransaction *transaction, FIRDocumentReference *doc)
 
   XCTestExpectation *expectation = [self expectationWithDescription:@"transaction"];
   [firestore
-      runTransactionWithBlock:^id _Nullable(FIRTransaction *transaction, NSError **error) {
+      runTransactionWithBlock:^id _Nullable(FIRTransaction *transaction, NSError **) {
         [transaction setData:@{@"a" : @"b", @"nested" : @{@"a" : @"b"}} forDocument:doc];
         [transaction setData:@{@"c" : @"d", @"nested" : @{@"c" : @"d"}} forDocument:doc merge:YES];
         return @YES;
@@ -414,7 +414,7 @@ TransactionStage get = ^(FIRTransaction *transaction, FIRDocumentReference *doc)
           [transaction setData:@{@"count" : @(newCount)} forDocument:doc];
           return @YES;
         }
-        completion:^(id _Nullable result, NSError *_Nullable error) {
+        completion:^(id, NSError *) {
           [expectation fulfill];
         }];
   }
@@ -461,7 +461,7 @@ TransactionStage get = ^(FIRTransaction *transaction, FIRDocumentReference *doc)
           [transaction updateData:@{@"count" : @(newCount)} forDocument:doc];
           return @YES;
         }
-        completion:^(id _Nullable result, NSError *_Nullable error) {
+        completion:^(id, NSError *) {
           [expectation fulfill];
         }];
   }
@@ -501,7 +501,7 @@ TransactionStage get = ^(FIRTransaction *transaction, FIRDocumentReference *doc)
         [doc1 setData:@{
           @"count" : @(1234)
         }
-            completion:^(NSError *_Nullable error) {
+            completion:^(NSError *) {
               dispatch_semaphore_signal(writeSemaphore);
             }];
         // We can block on it, because transactions run on a background queue.
@@ -511,7 +511,7 @@ TransactionStage get = ^(FIRTransaction *transaction, FIRDocumentReference *doc)
         [transaction setData:@{@"count" : @(16)} forDocument:doc2];
         return nil;
       }
-      completion:^(id _Nullable result, NSError *_Nullable error) {
+      completion:^(id, NSError *_Nullable error) {
         XCTAssertNil(error);
         XCTAssertEqual(counter->load(), 2);
         [expectation fulfill];
@@ -544,7 +544,7 @@ TransactionStage get = ^(FIRTransaction *transaction, FIRDocumentReference *doc)
         [doc setData:@{
           @"count" : @(1234 + (int)(*counter))
         }
-            completion:^(NSError *_Nullable error) {
+            completion:^(NSError *) {
               dispatch_semaphore_signal(writeSemaphore);
             }];
         // We can block on it, because transactions run on a background queue.
@@ -558,7 +558,7 @@ TransactionStage get = ^(FIRTransaction *transaction, FIRDocumentReference *doc)
         XCTAssertNotNil(*error);
         return nil;
       }
-      completion:^(id _Nullable result, NSError *_Nullable error) {
+      completion:^(id, NSError *_Nullable error) {
         [expectation fulfill];
         XCTAssertNotNil(error);
         XCTAssertEqual(error.code, FIRFirestoreErrorCodeAborted);
@@ -581,7 +581,7 @@ TransactionStage get = ^(FIRTransaction *transaction, FIRDocumentReference *doc)
         [doc setData:@{
           @"count" : @(1234)
         }
-            completion:^(NSError *_Nullable error) {
+            completion:^(NSError *) {
               dispatch_semaphore_signal(writeSemaphore);
             }];
         // We can block on it, because transactions run on a background queue.
@@ -592,7 +592,7 @@ TransactionStage get = ^(FIRTransaction *transaction, FIRDocumentReference *doc)
         [transaction updateData:@{@"count" : @(16)} forDocument:doc];
         return nil;
       }
-      completion:^(id _Nullable result, NSError *_Nullable error) {
+      completion:^(id, NSError *_Nullable error) {
         [expectation fulfill];
         XCTAssertNotNil(error);
         XCTAssertEqual(error.code, FIRFirestoreErrorCodeInvalidArgument);
@@ -613,7 +613,7 @@ TransactionStage get = ^(FIRTransaction *transaction, FIRDocumentReference *doc)
         [transaction getDocument:doc error:error];
         return nil;
       }
-      completion:^(id _Nullable result, NSError *_Nullable error) {
+      completion:^(id, NSError *_Nullable error) {
         XCTAssertNil(error);
         [expectation fulfill];
       }];
@@ -638,7 +638,7 @@ TransactionStage get = ^(FIRTransaction *transaction, FIRDocumentReference *doc)
         [transaction updateData:@{@"count" : @(16)} forDocument:doc];
         return nil;
       }
-      completion:^(id _Nullable result, NSError *_Nullable error) {
+      completion:^(id, NSError *_Nullable error) {
         [expectation fulfill];
         XCTAssertNotNil(error);
         XCTAssertEqual(error.code, FIRFirestoreErrorCodeInvalidArgument);
@@ -651,7 +651,7 @@ TransactionStage get = ^(FIRTransaction *transaction, FIRDocumentReference *doc)
   FIRFirestore *firestore = [self firestore];
   XCTestExpectation *expectation = [self expectationWithDescription:@"transaction"];
   [firestore
-      runTransactionWithBlock:^id _Nullable(FIRTransaction *transaction, NSError **error) {
+      runTransactionWithBlock:^id _Nullable(FIRTransaction *, NSError **) {
         return @"yes";
       }
       completion:^(id _Nullable result, NSError *_Nullable error) {
@@ -704,7 +704,7 @@ TransactionStage get = ^(FIRTransaction *transaction, FIRDocumentReference *doc)
                     forDocument:doc];
         return nil;
       }
-      completion:^(id result, NSError *error) {
+      completion:^(id, NSError *error) {
         XCTAssertNil(error);
         [doc getDocumentWithCompletion:^(FIRDocumentSnapshot *snapshot, NSError *error) {
           XCTAssertNil(error);
@@ -737,7 +737,7 @@ TransactionStage get = ^(FIRTransaction *transaction, FIRDocumentReference *doc)
                     forDocument:doc];
         return nil;
       }
-      completion:^(id result, NSError *error) {
+      completion:^(id, NSError *error) {
         XCTAssertNil(error);
         [doc getDocumentWithCompletion:^(FIRDocumentSnapshot *snapshot, NSError *error) {
           XCTAssertNil(error);

+ 4 - 4
Firestore/Example/Tests/SpecTests/FSTSpecTests.mm

@@ -203,7 +203,7 @@ NSString *ToTargetIdListString(const ActiveTargetMap &map) {
                                                             __func__]                              \
                         userInfo:nil];
 
-- (std::unique_ptr<Persistence>)persistenceWithGCEnabled:(BOOL)GCEnabled {
+- (std::unique_ptr<Persistence>)persistenceWithGCEnabled:(__unused BOOL)GCEnabled {
   @throw FSTAbstractMethodException();  // NOLINT
 }
 
@@ -727,7 +727,7 @@ NSString *ToTargetIdListString(const ActiveTargetMap &map) {
       __block ActiveTargetMap expectedActiveTargets;
       [expectedState[@"activeTargets"]
           enumerateKeysAndObjectsUsingBlock:^(NSString *targetIDString, NSDictionary *queryData,
-                                              BOOL *stop) {
+                                              BOOL *) {
             TargetId targetID = [targetIDString intValue];
             ByteString resumeToken = MakeResumeToken(queryData[@"resumeToken"]);
             NSArray *queriesJson = queryData[@"queries"];
@@ -942,7 +942,7 @@ NSString *ToTargetIdListString(const ActiveTargetMap &map) {
   for (NSUInteger i = 0; i < specFiles.count; i++) {
     NSLog(@"Spec test file: %@", specFiles[i]);
     // Iterate over the tests in the file and run them.
-    [parsedSpecs[i] enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
+    [parsedSpecs[i] enumerateKeysAndObjectsUsingBlock:^(id, id obj, BOOL *) {
       XCTAssertTrue([obj isKindOfClass:[NSDictionary class]]);
       NSDictionary *testDescription = (NSDictionary *)obj;
       NSString *describeName = testDescription[@"describeName"];
@@ -991,7 +991,7 @@ NSString *ToTargetIdListString(const ActiveTargetMap &map) {
 
 - (BOOL)anyTestsAreMarkedExclusive:(NSDictionary *)tests {
   __block BOOL found = NO;
-  [tests enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
+  [tests enumerateKeysAndObjectsUsingBlock:^(id, id obj, BOOL *stop) {
     XCTAssertTrue([obj isKindOfClass:[NSDictionary class]]);
     NSDictionary *testDescription = (NSDictionary *)obj;
     NSArray<NSString *> *tags = testDescription[@"tags"];

+ 1 - 2
Firestore/Example/Tests/Util/FSTIntegrationTestCase.h

@@ -81,8 +81,7 @@ extern "C" {
 - (void)writeAllDocuments:(NSDictionary<NSString *, NSDictionary<NSString *, id> *> *)documents
              toCollection:(FIRCollectionReference *)collection;
 
-- (void)readerAndWriterOnDocumentRef:(void (^)(NSString *path,
-                                               FIRDocumentReference *readerRef,
+- (void)readerAndWriterOnDocumentRef:(void (^)(FIRDocumentReference *readerRef,
                                                FIRDocumentReference *writerRef))action;
 
 - (FIRDocumentSnapshot *)readDocumentForRef:(FIRDocumentReference *)ref;

+ 6 - 7
Firestore/Example/Tests/Util/FSTIntegrationTestCase.mm

@@ -304,7 +304,7 @@ class FakeCredentialsProvider : public EmptyCredentialsProvider {
     __block XCTestExpectation *watchUpdateReceived;
     FIRDocumentReference *docRef = [db documentWithPath:[self documentPath]];
     id<FIRListenerRegistration> listenerRegistration =
-        [docRef addSnapshotListener:^(FIRDocumentSnapshot *snapshot, NSError *error) {
+        [docRef addSnapshotListener:^(FIRDocumentSnapshot *snapshot, NSError *) {
           if ([snapshot[@"value"] isEqual:@"done"]) {
             [watchUpdateReceived fulfill];
           } else {
@@ -319,11 +319,11 @@ class FakeCredentialsProvider : public EmptyCredentialsProvider {
 
     // Use a transaction to perform a write without triggering any local events.
     [docRef.firestore
-        runTransactionWithBlock:^id(FIRTransaction *transaction, NSError **pError) {
+        runTransactionWithBlock:^id(FIRTransaction *transaction, NSError **) {
           [transaction setData:@{@"value" : @"done"} forDocument:docRef];
           return nil;
         }
-                     completion:^(id result, NSError *error){
+                     completion:^(id, NSError *){
                      }];
 
     // Wait to see the write on the watch stream.
@@ -382,14 +382,13 @@ class FakeCredentialsProvider : public EmptyCredentialsProvider {
 - (void)writeAllDocuments:(NSDictionary<NSString *, NSDictionary<NSString *, id> *> *)documents
              toCollection:(FIRCollectionReference *)collection {
   [documents enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSDictionary<NSString *, id> *value,
-                                                 BOOL *stop) {
+                                                 BOOL *) {
     FIRDocumentReference *ref = [collection documentWithPath:key];
     [self writeDocumentRef:ref data:value];
   }];
 }
 
-- (void)readerAndWriterOnDocumentRef:(void (^)(NSString *path,
-                                               FIRDocumentReference *readerRef,
+- (void)readerAndWriterOnDocumentRef:(void (^)(FIRDocumentReference *readerRef,
                                                FIRDocumentReference *writerRef))action {
   FIRFirestore *reader = self.db;  // for clarity
   FIRFirestore *writer = [self firestore];
@@ -397,7 +396,7 @@ class FakeCredentialsProvider : public EmptyCredentialsProvider {
   NSString *path = [self documentPath];
   FIRDocumentReference *readerRef = [reader documentWithPath:path];
   FIRDocumentReference *writerRef = [writer documentWithPath:path];
-  action(path, readerRef, writerRef);
+  action(readerRef, writerRef);
 }
 
 - (FIRDocumentSnapshot *)readDocumentForRef:(FIRDocumentReference *)ref {

+ 1 - 3
Firestore/Source/API/FIRCollectionReference.mm

@@ -53,9 +53,7 @@ NS_ASSUME_NONNULL_BEGIN
 }
 
 // Override the designated initializer from the super class.
-- (instancetype)initWithQuery:(api::Query &&)query {
-  (void)query;
-
+- (instancetype)initWithQuery:(__unused api::Query &&)query {
   HARD_FAIL("Use FIRCollectionReference initWithPath: initializer.");
 }
 

+ 1 - 2
Firestore/Source/API/FIRFieldPath.mm

@@ -73,8 +73,7 @@ NS_ASSUME_NONNULL_BEGIN
       [[FIRFieldPath alloc] initPrivate:FieldPath::FromDotSeparatedString(util::MakeString(path))];
 }
 
-- (id)copyWithZone:(NSZone *__nullable)zone {
-  (void)zone;
+- (id)copyWithZone:(__unused NSZone *_Nullable)zone {
   return [[[self class] alloc] initPrivate:_internalValue];
 }
 

+ 1 - 3
Firestore/Source/API/FIRFirestoreSettings.mm

@@ -78,9 +78,7 @@ ABSL_CONST_INIT extern "C" const int64_t kFIRFirestoreCacheSizeUnlimited =
   return result;
 }
 
-- (id)copyWithZone:(nullable NSZone *)zone {
-  (void)zone;
-
+- (id)copyWithZone:(__unused NSZone *_Nullable)zone {
   FIRFirestoreSettings *copy = [[FIRFirestoreSettings alloc] init];
   copy.host = _host;
   copy.sslEnabled = _sslEnabled;

+ 1 - 2
Firestore/Source/API/FIRGeoPoint.mm

@@ -71,8 +71,7 @@ NS_ASSUME_NONNULL_BEGIN
 }
 
 /** Implements NSCopying without actually copying because geopoints are immutable. */
-- (id)copyWithZone:(NSZone *_Nullable)zone {
-  (void)zone;
+- (id)copyWithZone:(__unused NSZone *_Nullable)zone {
   return self;
 }
 

+ 1 - 2
Firestore/Source/API/FIRTimestamp.m

@@ -115,8 +115,7 @@ static const int kNanosPerSecond = 1000000000;
 }
 
 /** Implements NSCopying without actually copying because timestamps are immutable. */
-- (id)copyWithZone:(NSZone *_Nullable)zone {
-  (void)zone;
+- (id)copyWithZone:(__unused NSZone *_Nullable)zone {
   return self;
 }
 

+ 1 - 3
Firestore/Source/API/FSTFirestoreComponent.mm

@@ -128,9 +128,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 #pragma mark - FIRComponentLifecycleMaintainer
 
-- (void)appWillBeDeleted:(FIRApp *)app {
-  (void)app;
-
+- (void)appWillBeDeleted:(__unused FIRApp *)app {
   NSDictionary<NSString *, FIRFirestore *> *instances;
   @synchronized(_instances) {
     instances = [_instances copy];

+ 1 - 2
Firestore/core/src/firebase/firestore/local/lru_garbage_collector.cc

@@ -187,8 +187,7 @@ ListenSequenceNumber LruGarbageCollector::SequenceNumberForQueryCount(
   });
 
   delegate_->EnumerateOrphanedDocuments(
-      [&buffer](const DocumentKey& doc_key,
-                ListenSequenceNumber sequence_number) {
+      [&buffer](const DocumentKey&, ListenSequenceNumber sequence_number) {
         buffer.AddElement(sequence_number);
       });
 

+ 4 - 3
Firestore/core/src/firebase/firestore/local/memory_lru_reference_delegate.cc

@@ -76,7 +76,7 @@ void MemoryLruReferenceDelegate::UpdateLimboDocument(
   sequence_numbers_[key] = current_sequence_number_;
 }
 
-void MemoryLruReferenceDelegate::OnTransactionStarted(absl::string_view label) {
+void MemoryLruReferenceDelegate::OnTransactionStarted(absl::string_view) {
   current_sequence_number_ = listen_sequence_->Next();
 }
 
@@ -105,8 +105,9 @@ void MemoryLruReferenceDelegate::EnumerateOrphanedDocuments(
 size_t MemoryLruReferenceDelegate::GetSequenceNumberCount() {
   size_t total_count = persistence_->target_cache()->size();
   EnumerateOrphanedDocuments(
-      [&total_count](const DocumentKey& key,
-                     ListenSequenceNumber sequence_number) { total_count++; });
+      [&total_count](const DocumentKey&, ListenSequenceNumber) {
+        total_count++;
+      });
   return total_count;
 }
 

+ 2 - 2
Firestore/core/src/firebase/firestore/local/simple_query_engine.cc

@@ -29,8 +29,8 @@ using model::SnapshotVersion;
 
 model::DocumentMap SimpleQueryEngine::GetDocumentsMatchingQuery(
     const core::Query& query,
-    const SnapshotVersion& last_limbo_free_snapshot_version,
-    const model::DocumentKeySet& remote_keys) {
+    const SnapshotVersion&,
+    const model::DocumentKeySet&) {
   HARD_ASSERT(local_documents_view_, "SetLocalDocumentsView() not called");
 
   return local_documents_view_->GetDocumentsMatchingQuery(

+ 2 - 3
Firestore/core/src/firebase/firestore/model/verify_mutation.cc

@@ -39,13 +39,12 @@ VerifyMutation::VerifyMutation(const Mutation& mutation) : Mutation(mutation) {
 }
 
 MaybeDocument VerifyMutation::Rep::ApplyToRemoteDocument(
-    const absl::optional<MaybeDocument>& maybe_doc,
-    const MutationResult& mutation_result) const {
+    const absl::optional<MaybeDocument>&, const MutationResult&) const {
   HARD_FAIL("VerifyMutation should only be used in Transactions.");
 }
 
 absl::optional<MaybeDocument> VerifyMutation::Rep::ApplyToLocalView(
-    const absl::optional<MaybeDocument>& maybe_doc,
+    const absl::optional<MaybeDocument>&,
     const absl::optional<MaybeDocument>&,
     const Timestamp&) const {
   HARD_FAIL("VerifyMutation should only be used in Transactions.");

+ 2 - 3
Firestore/core/src/firebase/firestore/remote/serializer.cc

@@ -1600,7 +1600,7 @@ std::unique_ptr<WatchChange> Serializer::DecodeTargetChange(
 }
 
 WatchTargetChangeState Serializer::DecodeTargetChangeState(
-    nanopb::Reader* reader,
+    nanopb::Reader*,
     const google_firestore_v1_TargetChange_TargetChangeType state) {
   switch (state) {
     case google_firestore_v1_TargetChange_TargetChangeType_NO_CHANGE:
@@ -1681,8 +1681,7 @@ std::unique_ptr<WatchChange> Serializer::DecodeDocumentRemove(
 }
 
 std::unique_ptr<WatchChange> Serializer::DecodeExistenceFilterWatchChange(
-    nanopb::Reader* reader,
-    const google_firestore_v1_ExistenceFilter& filter) const {
+    nanopb::Reader*, const google_firestore_v1_ExistenceFilter& filter) const {
   ExistenceFilter existence_filter{filter.count};
   return absl::make_unique<ExistenceFilterWatchChange>(existence_filter,
                                                        filter.target_id);

+ 1 - 1
Firestore/core/test/firebase/firestore/local/leveldb_opener_test.cc

@@ -192,7 +192,7 @@ class OtherFilesystem : public Filesystem {
     return Path::JoinUtf8(root_dir_, absl::StrCat(".", app_name));
   }
 
-  StatusOr<Path> LegacyDocumentsDir(absl::string_view app_name) override {
+  StatusOr<Path> LegacyDocumentsDir(absl::string_view) override {
     return Status(Error::kUnimplemented, "unimplemented");
   }
 

+ 4 - 6
Firestore/core/test/firebase/firestore/remote/datastore_test.cc

@@ -347,9 +347,8 @@ TEST_F(DatastoreTest, AuthAfterDatastoreHasBeenShutDown) {
   credentials->DelayGetToken();
 
   worker_queue->EnqueueBlocking([&] {
-    datastore->CommitMutations({}, [](const Status& status) {
-      FAIL() << "Callback shouldn't be invoked";
-    });
+    datastore->CommitMutations(
+        {}, [](const Status&) { FAIL() << "Callback shouldn't be invoked"; });
   });
   Shutdown();
 
@@ -360,9 +359,8 @@ TEST_F(DatastoreTest, AuthOutlivesDatastore) {
   credentials->DelayGetToken();
 
   worker_queue->EnqueueBlocking([&] {
-    datastore->CommitMutations({}, [](const Status& status) {
-      FAIL() << "Callback shouldn't be invoked";
-    });
+    datastore->CommitMutations(
+        {}, [](const Status&) { FAIL() << "Callback shouldn't be invoked"; });
   });
   Shutdown();
   datastore.reset();

+ 3 - 3
Firestore/core/test/firebase/firestore/remote/grpc_connection_test.cc

@@ -67,7 +67,7 @@ class ConnectivityObserver : public GrpcStreamObserver {
  public:
   void OnStreamStart() override {
   }
-  void OnStreamRead(const grpc::ByteBuffer& message) override {
+  void OnStreamRead(const grpc::ByteBuffer&) override {
   }
   void OnStreamFinish(const util::Status& status) override {
     if (IsConnectivityChange(status)) {
@@ -191,9 +191,9 @@ TEST_F(GrpcConnectionTest, ShutdownFastFinishesActiveCalls) {
    public:
     void OnStreamStart() override {
     }
-    void OnStreamRead(const grpc::ByteBuffer& message) override {
+    void OnStreamRead(const grpc::ByteBuffer&) override {
     }
-    void OnStreamFinish(const util::Status& status) override {
+    void OnStreamFinish(const util::Status&) override {
       FAIL() << "Observer shouldn't have been invoked";
     }
   };

+ 2 - 11
Firestore/core/test/firebase/firestore/remote/serializer_test.cc

@@ -197,7 +197,6 @@ class SerializerTest : public ::testing::Test {
   void ExpectDeserializationRoundTrip(const WatchChange& model,
                                       const v1::ListenResponse& proto) {
     auto actual_model = Decode<google_firestore_v1_ListenResponse>(
-        google_firestore_v1_ListenResponse_fields,
         std::mem_fn(&Serializer::DecodeWatchChange), proto);
 
     EXPECT_EQ(model, *actual_model);
@@ -207,7 +206,6 @@ class SerializerTest : public ::testing::Test {
                                       const v1::WriteResult& proto,
                                       const SnapshotVersion& commit_version) {
     auto actual_model = Decode<google_firestore_v1_WriteResult>(
-        google_firestore_v1_WriteResult_fields,
         std::mem_fn(&Serializer::DecodeMutationResult), proto, commit_version);
 
     EXPECT_EQ(model, actual_model);
@@ -216,7 +214,6 @@ class SerializerTest : public ::testing::Test {
   void ExpectDeserializationRoundTrip(const SnapshotVersion& model,
                                       const v1::ListenResponse& proto) {
     auto actual_model = Decode<google_firestore_v1_ListenResponse>(
-        google_firestore_v1_ListenResponse_fields,
         std::mem_fn(&Serializer::DecodeVersionFromListenResponse), proto);
 
     EXPECT_EQ(model, actual_model);
@@ -507,12 +504,10 @@ class SerializerTest : public ::testing::Test {
     core::Target actual_model;
     if (proto.has_documents()) {
       actual_model = Decode<google_firestore_v1_Target_DocumentsTarget>(
-          google_firestore_v1_Target_DocumentsTarget_fields,
           std::mem_fn(&Serializer::DecodeDocumentsTarget), proto.documents());
 
     } else {
       actual_model = Decode<google_firestore_v1_Target_QueryTarget>(
-          google_firestore_v1_Target_QueryTarget_fields,
           std::mem_fn(&Serializer::DecodeQueryTarget), proto.query());
     }
 
@@ -531,7 +526,6 @@ class SerializerTest : public ::testing::Test {
   void ExpectDeserializationRoundTrip(const Mutation& model,
                                       const v1::Write& proto) {
     Mutation actual_model = Decode<google_firestore_v1_Write>(
-        google_firestore_v1_Write_fields,
         std::mem_fn(&Serializer::DecodeMutation), proto);
 
     EXPECT_EQ(model, actual_model);
@@ -550,7 +544,6 @@ class SerializerTest : public ::testing::Test {
       const core::Filter& model, const v1::StructuredQuery::Filter& proto) {
     FilterList actual_model =
         Decode<google_firestore_v1_StructuredQuery_Filter>(
-            google_firestore_v1_StructuredQuery_Filter_fields,
             std::mem_fn(&Serializer::DecodeFilters), proto);
 
     EXPECT_EQ(FilterList{model}, actual_model);
@@ -565,10 +558,8 @@ class SerializerTest : public ::testing::Test {
   }
 
   template <typename T, typename F, typename P, typename... Args>
-  auto Decode(const pb_field_t* fields,
-              F decode_func,
-              const P& proto,
-              const Args&... args) -> typename F::result_type {
+  auto Decode(F decode_func, const P& proto, const Args&... args) ->
+      typename F::result_type {
     ByteString bytes = ProtobufSerialize(proto);
     StringReader reader{bytes};