Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use C99-compatible __typeof__ instead of typeof #1985

Merged
merged 2 commits into from
Oct 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Firestore/Source/Core/FSTFirestoreClient.mm
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ - (instancetype)initWithDatabaseInfo:(const DatabaseInfo &)databaseInfo

auto userPromise = std::make_shared<std::promise<User>>();

__weak typeof(self) weakSelf = self;
__weak __typeof__(self) weakSelf = self;
auto credentialChangeListener = [initialized = false, userPromise, weakSelf,
workerDispatchQueue](User user) mutable {
typeof(self) strongSelf = weakSelf;
__typeof__(self) strongSelf = weakSelf;
if (!strongSelf) return;

if (!initialized) {
Expand Down
4 changes: 2 additions & 2 deletions Firestore/Source/Util/FSTClasses.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ NS_ASSUME_NONNULL_BEGIN
userInfo:nil];

// Declare a weak pointer to the given variable
#define FSTWeakify(var) __weak typeof(var) fstWeakPointerTo##var = var;
#define FSTWeakify(var) __weak __typeof__(var) fstWeakPointerTo##var = var;

// Declare a strong pointer to a variable that's been FSTWeakified. This creates a shadow of the
// original.
#define FSTStrongify(var) \
_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wshadow\"") \
__strong typeof(var) var = fstWeakPointerTo##var; \
__strong __typeof__(var) var = fstWeakPointerTo##var; \
_Pragma("clang diagnostic pop")

NS_ASSUME_NONNULL_END