aboutsummaryrefslogtreecommitdiffhomepage
path: root/objectivec/GPBMessage_PackagePrivate.h
diff options
context:
space:
mode:
authorGravatar Thomas Van Lenten <thomasvl@google.com>2017-03-29 14:07:07 -0400
committerGravatar GitHub <noreply@github.com>2017-03-29 14:07:07 -0400
commit258406b88f2d0ea95b90ac778f245baf9a9cea95 (patch)
treea8e22004c8673f935825a40606a4091e9293175a /objectivec/GPBMessage_PackagePrivate.h
parentba3fa41ba86cd87f1947b9e66e450b9dc39e85a6 (diff)
parent130c166697cc7df082197a10936dd9554c3e4083 (diff)
Merge pull request #2919 from thomasvl/drop_dispatch
Remove the use of dispatch_once that is heap backed.
Diffstat (limited to 'objectivec/GPBMessage_PackagePrivate.h')
-rw-r--r--objectivec/GPBMessage_PackagePrivate.h18
1 files changed, 1 insertions, 17 deletions
diff --git a/objectivec/GPBMessage_PackagePrivate.h b/objectivec/GPBMessage_PackagePrivate.h
index 9324cf8d..90834d40 100644
--- a/objectivec/GPBMessage_PackagePrivate.h
+++ b/objectivec/GPBMessage_PackagePrivate.h
@@ -70,7 +70,6 @@ typedef struct GPBMessage_Storage *GPBMessage_StoragePtr;
// Use of readOnlySemaphore_ must be prefaced by a call to
// GPBPrepareReadOnlySemaphore to ensure it has been created. This allows
// readOnlySemaphore_ to be only created when actually needed.
- dispatch_once_t readOnlySemaphoreCreationOnce_;
dispatch_semaphore_t readOnlySemaphore_;
}
@@ -105,22 +104,7 @@ CF_EXTERN_C_BEGIN
// Call this before using the readOnlySemaphore_. This ensures it is created only once.
-NS_INLINE void GPBPrepareReadOnlySemaphore(GPBMessage *self) {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdirect-ivar-access"
-
-// Starting on Xcode 8.3, the static analyzer complains that the dispatch_once_t
-// variable passed to dispatch_once should not be allocated on the heap or
-// stack. Given that the semaphore is also an instance variable of the message,
-// both variables are cleared at the same time, so this is safe.
-#if !defined(__clang_analyzer__)
- dispatch_once(&self->readOnlySemaphoreCreationOnce_, ^{
- self->readOnlySemaphore_ = dispatch_semaphore_create(1);
- });
-#endif // !defined(__clang_analyzer__)
-
-#pragma clang diagnostic pop
-}
+void GPBPrepareReadOnlySemaphore(GPBMessage *self);
// Returns a new instance that was automatically created by |autocreator| for
// its field |field|.