ObjFW  Check-in [9f9898eb8b]

Overview
Comment:OFObject: Make Foundation check work on macOS 10.5
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9f9898eb8bf70aa48b867929e7932654ca3e4bb456f1e73cb0138183ad0c21dd
User & Date: js on 2017-05-13 20:11:55
Other Links: manifest | tags
Context
2017-05-13
22:38
Reduce retain + autorelease check-in: 504e13cf00 user: js tags: trunk
20:11
OFObject: Make Foundation check work on macOS 10.5 check-in: 9f9898eb8b user: js tags: trunk
19:51
Make Apple GCC happy check-in: 7e8ee9b1f9 user: js tags: trunk
Changes

Modified src/OFObject.m from [43cde2e0c7] to [a28a9b391e].

19
20
21
22
23
24
25




26
27
28
29
30
31
32
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <assert.h>

#include <sys/time.h>





#import "OFObject.h"
#import "OFArray.h"
#import "OFLocalization.h"
#import "OFTimer.h"
#import "OFRunLoop.h"
#import "OFThread.h"







>
>
>
>







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <assert.h>

#include <sys/time.h>

#ifdef OF_APPLE_RUNTIME
# include <dlfcn.h>
#endif

#import "OFObject.h"
#import "OFArray.h"
#import "OFLocalization.h"
#import "OFTimer.h"
#import "OFRunLoop.h"
#import "OFThread.h"
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#import "instance.h"
#if defined(OF_HAVE_ATOMIC_OPS)
# import "atomic.h"
#elif defined(OF_HAVE_THREADS)
# import "threading.h"
#endif

#ifdef OF_APPLE_RUNTIME
extern double NSFoundationVersionNumber;
#endif

#if defined(OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR)
extern id of_forward(id, SEL, ...);
extern struct stret of_forward_stret(id, SEL, ...);
#else
# define of_forward of_method_not_found
# define of_forward_stret of_method_not_found_stret
#endif







<
<
<
<







59
60
61
62
63
64
65




66
67
68
69
70
71
72
#import "instance.h"
#if defined(OF_HAVE_ATOMIC_OPS)
# import "atomic.h"
#elif defined(OF_HAVE_THREADS)
# import "threading.h"
#endif





#if defined(OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR)
extern id of_forward(id, SEL, ...);
extern struct stret of_forward_stret(id, SEL, ...);
#else
# define of_forward of_method_not_found
# define of_forward_stret of_method_not_found_stret
#endif
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
	 * against Foundation. Since CoreFoundation sets its own forward
	 * handler on load, we should not set ours, as this will break
	 * Foundation.
	 *
	 * Unfortunately, there is no way to check if a forward handler has
	 * already been set, so this is the best we can do.
	 */
	if (&NSFoundationVersionNumber == NULL)
		objc_setForwardHandler((void *)&of_forward,
		    (void *)&of_forward_stret);
#else
	objc_setForwardHandler((IMP)&of_forward, (IMP)&of_forward_stret);
#endif

	objc_setEnumerationMutationHandler(enumerationMutationHandler);







|







224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
	 * against Foundation. Since CoreFoundation sets its own forward
	 * handler on load, we should not set ours, as this will break
	 * Foundation.
	 *
	 * Unfortunately, there is no way to check if a forward handler has
	 * already been set, so this is the best we can do.
	 */
	if (dlsym(RTLD_DEFAULT, "NSFoundationVersionNumber") == NULL)
		objc_setForwardHandler((void *)&of_forward,
		    (void *)&of_forward_stret);
#else
	objc_setForwardHandler((IMP)&of_forward, (IMP)&of_forward_stret);
#endif

	objc_setEnumerationMutationHandler(enumerationMutationHandler);