Small bug fixes:

- Don't call C++ constructors if they don't exist.
- Don't check the owner of retain / release methods if they are not implemented.
- Add arc.m as a file to ignore when checking for GC compatibility.
main
theraven 15 years ago
parent e34be81404
commit 7b6ba21ce5

@ -72,7 +72,7 @@ static BOOL endsWith(const char *string, const char *suffix)
PRIVATE BOOL objc_check_abi_version(struct objc_module_abi_8 *module)
{
static int runtime_modules = 4;
static int runtime_modules = 5;
// As a quick and ugly hack, skip these three tests for the .m files in the
// runtime. They should (in theory, at least) be aware of the GC mode and
// behave accordingly.
@ -80,6 +80,7 @@ PRIVATE BOOL objc_check_abi_version(struct objc_module_abi_8 *module)
{
if (endsWith(module->name, "properties.m") ||
endsWith(module->name, "associate.m") ||
endsWith(module->name, "arc.m") ||
endsWith(module->name, "blocks_runtime.m") ||
endsWith(module->name, "Protocol2.m"))
{

@ -52,19 +52,19 @@ static void checkARCAccessors(Class cls)
isARC = sel_registerName("_ARCCompliantRetainRelease");
}
struct objc_slot *slot = objc_get_slot(cls, retain);
if (!ownsMethod(slot->owner, isARC))
if ((NULL != slot) && !ownsMethod(slot->owner, isARC))
{
objc_clear_class_flag(cls, objc_class_flag_fast_arc);
return;
}
slot = objc_get_slot(cls, release);
if (!ownsMethod(slot->owner, isARC))
if ((NULL != slot) && !ownsMethod(slot->owner, isARC))
{
objc_clear_class_flag(cls, objc_class_flag_fast_arc);
return;
}
slot = objc_get_slot(cls, autorelease);
if (!ownsMethod(slot->owner, isARC))
if ((NULL != slot) && !ownsMethod(slot->owner, isARC))
{
objc_clear_class_flag(cls, objc_class_flag_fast_arc);
return;

@ -55,12 +55,15 @@ static void call_cxx_construct_for_class(Class cls, id obj)
cxx_construct = sel_registerName(".cxx_contruct");
}
struct objc_slot *slot = objc_get_slot(cls, cxx_construct);
cls = slot->owner->super_class;
if (Nil != cls)
if (NULL != slot)
{
call_cxx_construct_for_class(cls, obj);
cls = slot->owner->super_class;
if (Nil != cls)
{
call_cxx_construct_for_class(cls, obj);
}
slot->method(obj, cxx_construct);
}
slot->method(obj, cxx_construct);
}
PRIVATE void call_cxx_construct(id obj)

Loading…
Cancel
Save