From 807a88be3ae9177f620a91e9aacf4aa59aacddaa Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 4 Nov 2009 03:14:22 +0000 Subject: [PATCH] Worked around an incorrect warning exposed by the optimizer on Linux: stack allocating Type_privateData with a pool led to the pool not being initialized on some theoretical control paths. --- Internal.hpp | 11 +++++++++-- ObjectiveC/Library.mm | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Internal.hpp b/Internal.hpp index fff510b..13987d4 100644 --- a/Internal.hpp +++ b/Internal.hpp @@ -67,9 +67,16 @@ struct Type_privateData : Type_privateData(apr_pool_t *pool, const char *type) : ffi_(NULL) { - if (pool != NULL) - pool_ = pool; + _assert(pool != NULL); + pool_ = pool; + sig::Signature signature; + sig::Parse(pool_, &signature, type, &Structor_); + type_ = signature.elements[0].type; + } + Type_privateData(const char *type) : + ffi_(NULL) + { sig::Signature signature; sig::Parse(pool_, &signature, type, &Structor_); type_ = signature.elements[0].type; diff --git a/ObjectiveC/Library.mm b/ObjectiveC/Library.mm index 9c7bcc1..f578112 100644 --- a/ObjectiveC/Library.mm +++ b/ObjectiveC/Library.mm @@ -2239,8 +2239,8 @@ void CYObjectiveC_SetupContext(JSContextRef context) { JSObjectRef global(CYGetGlobalObject(context)); apr_pool_t *pool(CYGetGlobalPool()); - Object_type = new(pool) Type_privateData(pool, "@"); - Selector_type = new(pool) Type_privateData(pool, ":"); + Object_type = new(pool) Type_privateData("@"); + Selector_type = new(pool) Type_privateData(":"); #ifdef __APPLE__ NSCFBoolean_ = objc_getClass("NSCFBoolean"); -- 2.45.2