Skip to content

Commit e2630d5

Browse files
authored
Fix builds with GCC/Linux (#3141)
* Remove _Nullable in plain C++ * Avoid adding -framework Foundation multiplatform targets on non-Apple platforms * Fix ordered_code_benchmark to be in a .cc file
1 parent 220589d commit e2630d5

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

Firestore/Example/Firestore.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
2F6E23D7888FC82475C63010 /* token_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = ABC1D7DF2023A3EF00BA84F0 /* token_test.cc */; };
115115
300D9D215F4128E69068B863 /* FSTQueryListenerTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5492E05D202154B900B64F25 /* FSTQueryListenerTests.mm */; };
116116
3021937CBABFD9270A051900 /* FSTViewSnapshotTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5492E05C202154B800B64F25 /* FSTViewSnapshotTest.mm */; };
117+
3040FD156E1B7C92B0F2A70C /* ordered_code_benchmark.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0473AFFF5567E667A125347B /* ordered_code_benchmark.cc */; };
117118
31A396C81A107D1DEFDF4A34 /* serializer_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 61F72C5520BC48FD001A68CB /* serializer_test.cc */; };
118119
31BDB4CB0E7458C650A77ED0 /* FIRFirestoreTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5467FAFF203E56F8009C9584 /* FIRFirestoreTests.mm */; };
119120
31D8E3D925FA3F70AA20ACCE /* FSTMockDatastore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5492E02D20213FFC00B64F25 /* FSTMockDatastore.mm */; };
@@ -369,7 +370,6 @@
369370
627253FDEC6BB5549FE77F4E /* tree_sorted_map_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 549CCA4D20A36DBB00BCEB75 /* tree_sorted_map_test.cc */; };
370371
62DA31B79FE97A90EEF28B0B /* delayed_constructor_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = D0A6E9136804A41CEC9D55D4 /* delayed_constructor_test.cc */; };
371372
63BB61B6366E7F80C348419D /* FSTLevelDBTransactionTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 132E36BB104830BD806351AC /* FSTLevelDBTransactionTests.mm */; };
372-
649B9E65663480F45DDBA021 /* ordered_code_benchmark.mm in Sources */ = {isa = PBXBuildFile; fileRef = 535B1420A19BEAA7FA4D77C8 /* ordered_code_benchmark.mm */; };
373373
660E99DEDA0A6FC1CCB200F9 /* FIRArrayTransformTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 73866A9F2082B069009BB4FF /* FIRArrayTransformTests.mm */; };
374374
6672B445E006A7708B8531ED /* FSTImmutableSortedDictionary+Testing.m in Sources */ = {isa = PBXBuildFile; fileRef = DE2EF0801F3D0B6E003D0CDC /* FSTImmutableSortedDictionary+Testing.m */; };
375375
66FAB8EAC012A3822BD4D0C9 /* leveldb_util_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 332485C4DCC6BA0DBB5E31B7 /* leveldb_util_test.cc */; };
@@ -398,7 +398,6 @@
398398
731541612214AFFA0037F4DC /* query_spec_test.json in Resources */ = {isa = PBXBuildFile; fileRef = 731541602214AFFA0037F4DC /* query_spec_test.json */; };
399399
736C4E82689F1CA1859C4A3F /* XCTestCase+Await.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5492E0372021401E00B64F25 /* XCTestCase+Await.mm */; };
400400
73866AA12082B0A5009BB4FF /* FIRArrayTransformTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 73866A9F2082B069009BB4FF /* FIRArrayTransformTests.mm */; };
401-
73A76304FED6838CBFE74E0E /* ordered_code_benchmark.mm in Sources */ = {isa = PBXBuildFile; fileRef = 535B1420A19BEAA7FA4D77C8 /* ordered_code_benchmark.mm */; };
402401
73E42D984FB36173A2BDA57C /* FSTEventAccumulator.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5492E0392021401F00B64F25 /* FSTEventAccumulator.mm */; };
403402
73F1F73C2210F3D800E1F692 /* memory_index_manager_test.mm in Sources */ = {isa = PBXBuildFile; fileRef = 73F1F7392210F3D800E1F692 /* memory_index_manager_test.mm */; };
404403
73F1F73D2210F3D800E1F692 /* index_manager_test.mm in Sources */ = {isa = PBXBuildFile; fileRef = 73F1F73B2210F3D800E1F692 /* index_manager_test.mm */; };
@@ -460,7 +459,6 @@
460459
9783FAEA4CF758E8C4C2D76E /* hashing_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 54511E8D209805F8005BD28F /* hashing_test.cc */; };
461460
9794E074439ABE5457E60F35 /* xcgmock_test.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4425A513895DEC60325A139E /* xcgmock_test.mm */; };
462461
9A29D572C64CA1FA62F591D4 /* FIRQueryTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5492E069202154D500B64F25 /* FIRQueryTests.mm */; };
463-
9A5100FFDA685B5F0748EA4E /* ordered_code_benchmark.mm in Sources */ = {isa = PBXBuildFile; fileRef = 535B1420A19BEAA7FA4D77C8 /* ordered_code_benchmark.mm */; };
464462
9AC28D928902C6767A11F5FC /* objc_type_traits_apple_test.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2A0CF41BA5AED6049B0BEB2C /* objc_type_traits_apple_test.mm */; };
465463
9AC604BF7A76CABDF26F8C8E /* cc_compilation_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1B342370EAE3AA02393E33EB /* cc_compilation_test.cc */; };
466464
9BD7DC8F5ADA0FE64AFAFA75 /* FSTLRUGarbageCollectorTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CC9650220A0E93200A2D6A1 /* FSTLRUGarbageCollectorTests.mm */; };
@@ -508,6 +506,7 @@
508506
B03F286F3AEC3781C386C646 /* FIRNumericTransformTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = D5B25E7E7D6873CBA4571841 /* FIRNumericTransformTests.mm */; };
509507
B192F30DECA8C28007F9B1D0 /* array_sorted_map_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 54EB764C202277B30088B8F3 /* array_sorted_map_test.cc */; };
510508
B220E091D8F4E6DE1EA44F57 /* executor_libdispatch_test.mm in Sources */ = {isa = PBXBuildFile; fileRef = B6FB4689208F9B9100554BA2 /* executor_libdispatch_test.mm */; };
509+
B3C87C635527A2E57944B789 /* ordered_code_benchmark.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0473AFFF5567E667A125347B /* ordered_code_benchmark.cc */; };
511510
B49311BDE5EB6DF811E03C1B /* credentials_provider_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = AB38D9342023966E000A432D /* credentials_provider_test.cc */; };
512511
B513F723728E923DFF34F60F /* leveldb_key_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 54995F6E205B6E12004EFFA0 /* leveldb_key_test.cc */; };
513512
B60894F72170207200EBC644 /* fake_credentials_provider.cc in Sources */ = {isa = PBXBuildFile; fileRef = B60894F62170207100EBC644 /* fake_credentials_provider.cc */; };
@@ -609,6 +608,7 @@
609608
DE2EF0871F3D0B6E003D0CDC /* FSTImmutableSortedSet+Testing.m in Sources */ = {isa = PBXBuildFile; fileRef = DE2EF0821F3D0B6E003D0CDC /* FSTImmutableSortedSet+Testing.m */; };
610609
DE2EF0881F3D0B6E003D0CDC /* FSTTreeSortedDictionaryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DE2EF0841F3D0B6E003D0CDC /* FSTTreeSortedDictionaryTests.m */; };
611610
DEF036EA1ECEECD8E3ECC362 /* FSTImmutableSortedSet+Testing.m in Sources */ = {isa = PBXBuildFile; fileRef = DE2EF0821F3D0B6E003D0CDC /* FSTImmutableSortedSet+Testing.m */; };
611+
E08297B35E12106105F448EB /* ordered_code_benchmark.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0473AFFF5567E667A125347B /* ordered_code_benchmark.cc */; };
612612
E084921EFB7CF8CB1E950D6C /* iterator_adaptors_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 54A0353420A3D8CB003E0143 /* iterator_adaptors_test.cc */; };
613613
E0E640226A1439C59BBBA9C1 /* hard_assert_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 444B7AB3F5A2929070CB1363 /* hard_assert_test.cc */; };
614614
E11DDA3DD75705F26245E295 /* FIRCollectionReferenceTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5492E045202154AA00B64F25 /* FIRCollectionReferenceTests.mm */; };
@@ -745,6 +745,7 @@
745745
/* End PBXContainerItemProxy section */
746746

747747
/* Begin PBXFileReference section */
748+
0473AFFF5567E667A125347B /* ordered_code_benchmark.cc */ = {isa = PBXFileReference; includeInIndex = 1; path = ordered_code_benchmark.cc; sourceTree = "<group>"; };
748749
0EE5300F8233D14025EF0456 /* string_apple_test.mm */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.objcpp; path = string_apple_test.mm; sourceTree = "<group>"; };
749750
11984BA0A99D7A7ABA5B0D90 /* Pods-Firestore_Example_iOS-Firestore_SwiftTests_iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Firestore_Example_iOS-Firestore_SwiftTests_iOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-Firestore_Example_iOS-Firestore_SwiftTests_iOS/Pods-Firestore_Example_iOS-Firestore_SwiftTests_iOS.release.xcconfig"; sourceTree = "<group>"; };
750751
1277F98C20D2DF0867496976 /* Pods-Firestore_IntegrationTests_iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Firestore_IntegrationTests_iOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Firestore_IntegrationTests_iOS/Pods-Firestore_IntegrationTests_iOS.debug.xcconfig"; sourceTree = "<group>"; };
@@ -772,7 +773,6 @@
772773
444B7AB3F5A2929070CB1363 /* hard_assert_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; path = hard_assert_test.cc; sourceTree = "<group>"; };
773774
4C73C0CC6F62A90D8573F383 /* string_apple_benchmark.mm */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.objcpp; path = string_apple_benchmark.mm; sourceTree = "<group>"; };
774775
5342CDDB137B4E93E2E85CCA /* byte_string_test.cc */ = {isa = PBXFileReference; includeInIndex = 1; name = byte_string_test.cc; path = nanopb/byte_string_test.cc; sourceTree = "<group>"; };
775-
535B1420A19BEAA7FA4D77C8 /* ordered_code_benchmark.mm */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.objcpp; path = ordered_code_benchmark.mm; sourceTree = "<group>"; };
776776
54131E9620ADE678001DF3FF /* string_format_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = string_format_test.cc; sourceTree = "<group>"; };
777777
544129D021C2DDC800EFB9CC /* query.pb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = query.pb.h; sourceTree = "<group>"; };
778778
544129D121C2DDC800EFB9CC /* common.pb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = common.pb.h; sourceTree = "<group>"; };
@@ -1284,7 +1284,7 @@
12841284
54A0353420A3D8CB003E0143 /* iterator_adaptors_test.cc */,
12851285
54C2294E1FECABAE007D065B /* log_test.cc */,
12861286
B696858F221770F000271095 /* objc_compatibility_apple_test.mm */,
1287-
535B1420A19BEAA7FA4D77C8 /* ordered_code_benchmark.mm */,
1287+
0473AFFF5567E667A125347B /* ordered_code_benchmark.cc */,
12881288
AB380D03201BC6E400D97691 /* ordered_code_test.cc */,
12891289
403DBF6EFB541DFD01582AA3 /* path_test.cc */,
12901290
54740A531FC913E500713A1A /* secure_random_test.cc */,
@@ -3097,7 +3097,7 @@
30973097
4A699B93C58FDB46A308E745 /* objc_class_test_helper.mm in Sources */,
30983098
D572B4D4DBDD6B9235781646 /* objc_compatibility_apple_test.mm in Sources */,
30993099
16FE432587C1B40AF08613D2 /* objc_type_traits_apple_test.mm in Sources */,
3100-
73A76304FED6838CBFE74E0E /* ordered_code_benchmark.mm in Sources */,
3100+
E08297B35E12106105F448EB /* ordered_code_benchmark.cc in Sources */,
31013101
72AD91671629697074F2545B /* ordered_code_test.cc in Sources */,
31023102
DB7E9C5A59CCCDDB7F0C238A /* path_test.cc in Sources */,
31033103
0455FC6E2A281BD755FD933A /* precondition_test.cc in Sources */,
@@ -3272,7 +3272,7 @@
32723272
D6826E6A53030C44EA0741DE /* objc_class_test_helper.mm in Sources */,
32733273
7400AC9377419A28B782B5EC /* objc_compatibility_apple_test.mm in Sources */,
32743274
9AC28D928902C6767A11F5FC /* objc_type_traits_apple_test.mm in Sources */,
3275-
9A5100FFDA685B5F0748EA4E /* ordered_code_benchmark.mm in Sources */,
3275+
B3C87C635527A2E57944B789 /* ordered_code_benchmark.cc in Sources */,
32763276
FD8EA96A604E837092ACA51D /* ordered_code_test.cc in Sources */,
32773277
0963F6D7B0F9AE1E24B82866 /* path_test.cc in Sources */,
32783278
152543FD706D5E8851C8DA92 /* precondition_test.cc in Sources */,
@@ -3522,7 +3522,7 @@
35223522
5542632E76A0C17B61399B54 /* objc_class_test_helper.mm in Sources */,
35233523
B6968590221770F100271095 /* objc_compatibility_apple_test.mm in Sources */,
35243524
C80B10E79CDD7EF7843C321E /* objc_type_traits_apple_test.mm in Sources */,
3525-
649B9E65663480F45DDBA021 /* ordered_code_benchmark.mm in Sources */,
3525+
3040FD156E1B7C92B0F2A70C /* ordered_code_benchmark.cc in Sources */,
35263526
AB380D04201BC6E400D97691 /* ordered_code_test.cc in Sources */,
35273527
5A080105CCBFDB6BF3F3772D /* path_test.cc in Sources */,
35283528
549CCA5920A36E1F00BCEB75 /* precondition_test.cc in Sources */,

Firestore/core/src/firebase/firestore/remote/grpc_connection.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ class HostConfigMap {
7272
using Guard = std::lock_guard<std::mutex>;
7373

7474
public:
75-
const HostConfig* _Nullable find(const std::string& host) const {
75+
/**
76+
* Returns a pointer to the HostConfig entry for the given host or `nullptr`
77+
* if there's no entry.
78+
*/
79+
const HostConfig* find(const std::string& host) const {
7680
Guard guard{mutex_};
7781
auto iter = map_.find(host);
7882
if (iter == map_.end()) {

Firestore/core/test/firebase/firestore/util/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ cc_library(
196196
cc_binary(
197197
firebase_firestore_util_ordered_code_benchmark
198198
SOURCES
199-
ordered_code_benchmark.mm
199+
ordered_code_benchmark.cc
200200
DEPENDS
201201
benchmark
202202
benchmark_main
File renamed without changes.

cmake/cc_rules.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function(cc_library name)
5050

5151
maybe_remove_objc_sources(sources ${ccl_SOURCES})
5252
add_library(${name} ${sources})
53-
add_objc_flags(${name} ${ccl_SOURCES})
53+
add_objc_flags(${name} ${sources})
5454
target_include_directories(
5555
${name}
5656
PUBLIC
@@ -127,7 +127,7 @@ function(cc_binary name)
127127

128128
maybe_remove_objc_sources(sources ${ccb_SOURCES})
129129
add_executable(${name} ${sources})
130-
add_objc_flags(${name} ${ccb_SOURCES})
130+
add_objc_flags(${name} ${sources})
131131

132132
target_include_directories(${name} PRIVATE ${FIREBASE_SOURCE_DIR})
133133
target_link_libraries(${name} PRIVATE ${ccb_DEPENDS})
@@ -156,7 +156,7 @@ function(cc_test name)
156156

157157
maybe_remove_objc_sources(sources ${cct_SOURCES})
158158
add_executable(${name} ${sources})
159-
add_objc_flags(${name} ${cct_SOURCES})
159+
add_objc_flags(${name} ${sources})
160160
add_test(${name} ${name})
161161

162162
target_include_directories(${name} PRIVATE ${FIREBASE_SOURCE_DIR})
@@ -233,7 +233,7 @@ endfunction()
233233
# add_objc_flags(target sources...)
234234
#
235235
# Adds OBJC_FLAGS to the compile options of the given target if any of the
236-
# sources have filenames that indicate they are are Objective-C.
236+
# sources have filenames that indicate they are Objective-C.
237237
function(add_objc_flags target)
238238
set(_has_objc OFF)
239239

0 commit comments

Comments
 (0)