ObjFW  Diff

Differences From Artifact [6851361cb3]:

To Artifact [889cba075c]:

  • File src/runtime/class.m — part of check-in [ede088a30d] at 2019-04-14 13:35:38 on branch trunk — runtime: Match Apple's +[initialize] behavior

    This now calls +[initialize] several times on the same class if it is
    unimplemented in one or more of the classes in the chain, to match the
    behavior of the Apple runtime. While the behavior before was safer, it
    can lead to testing against the ObjFW runtime and everything working,
    but then failing when trying to use it with the Apple runtime. (user: js, size: 21133) [annotate] [blame] [check-ins using]


331
332
333
334
335
336
337


338
339
340
341
342
343
344
345
	/*
	 * Set it first to prevent calling it recursively due to message sends
	 * in the initialize method
	 */
	class->info |= OBJC_CLASS_INFO_INITIALIZED;
	class->isa->info |= OBJC_CLASS_INFO_INITIALIZED;



	callMethod(class, "initialize");
}

void
objc_initialize_class(Class class)
{
	if (class->info & OBJC_CLASS_INFO_INITIALIZED)
		return;







>
>
|







331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
	/*
	 * Set it first to prevent calling it recursively due to message sends
	 * in the initialize method
	 */
	class->info |= OBJC_CLASS_INFO_INITIALIZED;
	class->isa->info |= OBJC_CLASS_INFO_INITIALIZED;

	if (class_respondsToSelector(object_getClass(class),
	    @selector(initialize)))
		[class initialize];
}

void
objc_initialize_class(Class class)
{
	if (class->info & OBJC_CLASS_INFO_INITIALIZED)
		return;