ObjFW  Check-in [126632e200]

Overview
Comment:Add OF_WEAK_REF()
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 126632e2001db9bff44df47fd492173db8a813d70bf5692bd8d4c552c6a9bea7
User & Date: js on 2017-04-02 02:02:30
Other Links: manifest | tags
Context
2017-04-02
12:13
Use OF_PATH_CURRENT_DIRECTORY instead of @"." check-in: 643985e07a user: js tags: trunk
02:02
Add OF_WEAK_REF() check-in: 126632e200 user: js tags: trunk
01:06
Add OF_CONSTRUCTOR() / OF_DESTRUCTOR() check-in: d07c56a8bb user: js tags: trunk
Changes

Modified src/OFObject.m from [21ee30041a] to [349066991f].

56
57
58
59
60
61
62
63

64
65
66
67
68
69
70
#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 __attribute__((__weak__));

#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







|
>







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#if defined(OF_HAVE_ATOMIC_OPS)
# import "atomic.h"
#elif defined(OF_HAVE_THREADS)
# import "threading.h"
#endif

#ifdef OF_APPLE_RUNTIME
static double NSFoundationVersionNumber
    OF_WEAK_REF("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

Modified src/macros.h from [35fb899dee] to [b2cfcb1101].

66
67
68
69
70
71
72

73
74
75
76
77
78

79
80
81
82
83
84
85

#ifdef __GNUC__
# define OF_INLINE inline __attribute__((__always_inline__))
# define OF_LIKELY(cond) (__builtin_expect(!!(cond), 1))
# define OF_UNLIKELY(cond) (__builtin_expect(!!(cond), 0))
# define OF_CONST_FUNC __attribute__((__const__))
# define OF_NO_RETURN_FUNC __attribute__((__noreturn__))

#else
# define OF_INLINE inline
# define OF_LIKELY(cond) cond
# define OF_UNLIKELY(cond) cond
# define OF_CONST_FUNC
# define OF_NO_RETURN_FUNC

#endif

#ifdef OF_BIG_ENDIAN
# define OF_BYTE_ORDER_NATIVE OF_BYTE_ORDER_BIG_ENDIAN
#else
# define OF_BYTE_ORDER_NATIVE OF_BYTE_ORDER_LITTLE_ENDIAN
#endif







>






>







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87

#ifdef __GNUC__
# define OF_INLINE inline __attribute__((__always_inline__))
# define OF_LIKELY(cond) (__builtin_expect(!!(cond), 1))
# define OF_UNLIKELY(cond) (__builtin_expect(!!(cond), 0))
# define OF_CONST_FUNC __attribute__((__const__))
# define OF_NO_RETURN_FUNC __attribute__((__noreturn__))
# define OF_WEAK_REF(sym) __attribute__((__weakref__(sym)))
#else
# define OF_INLINE inline
# define OF_LIKELY(cond) cond
# define OF_UNLIKELY(cond) cond
# define OF_CONST_FUNC
# define OF_NO_RETURN_FUNC
# define OF_WEAK_REF(sym)
#endif

#ifdef OF_BIG_ENDIAN
# define OF_BYTE_ORDER_NATIVE OF_BYTE_ORDER_BIG_ENDIAN
#else
# define OF_BYTE_ORDER_NATIVE OF_BYTE_ORDER_LITTLE_ENDIAN
#endif

Modified src/runtime/exception.m from [b2da8e6383] to [4a94088d13].

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

#import "runtime.h"
#import "runtime-private.h"

#import "macros.h"

#if defined(HAVE_DWARF_EXCEPTIONS)
# define PERSONALITY	 __gnu_objc_personality_v0
# define CXX_PERSONALITY __gxx_personality_v0
#elif defined(HAVE_SJLJ_EXCEPTIONS)
# define PERSONALITY	 __gnu_objc_personality_sj0
# define CXX_PERSONALITY __gxx_personality_sj0
# define _Unwind_RaiseException _Unwind_SjLj_RaiseException
# define __builtin_eh_return_data_regno(i) (i)
#elif defined(HAVE_SEH_EXCEPTIONS)
# define PERSONALITY	 gnu_objc_personality
#else
# error Unknown exception type!
#endif







|
|

|
|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

#import "runtime.h"
#import "runtime-private.h"

#import "macros.h"

#if defined(HAVE_DWARF_EXCEPTIONS)
# define PERSONALITY __gnu_objc_personality_v0
# define CXX_PERSONALITY_STR "__gxx_personality_v0"
#elif defined(HAVE_SJLJ_EXCEPTIONS)
# define PERSONALITY __gnu_objc_personality_sj0
# define CXX_PERSONALITY_STR "__gxx_personality_sj0"
# define _Unwind_RaiseException _Unwind_SjLj_RaiseException
# define __builtin_eh_return_data_regno(i) (i)
#elif defined(HAVE_SEH_EXCEPTIONS)
# define PERSONALITY	 gnu_objc_personality
#else
# error Unknown exception type!
#endif
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
{
	uintptr_t thumb = _Unwind_GetGR(ctx, 15) & 1;
	_Unwind_SetGR(ctx, 15, (value | thumb));
}
#endif

#ifdef CXX_PERSONALITY
extern PERSONALITY_FUNC(CXX_PERSONALITY) __attribute__((__weak__));
#endif

#ifdef HAVE_SEH_EXCEPTIONS
extern EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, void*,
    PCONTEXT, PDISPATCHER_CONTEXT, _Unwind_Reason_Code(*)(int, int, uint64_t,
    struct _Unwind_Exception*, struct _Unwind_Context*));
#endif







|







211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
{
	uintptr_t thumb = _Unwind_GetGR(ctx, 15) & 1;
	_Unwind_SetGR(ctx, 15, (value | thumb));
}
#endif

#ifdef CXX_PERSONALITY
static PERSONALITY_FUNC(cxx_personality) OF_WEAK_REF(CXX_PERSONALITY_STR);
#endif

#ifdef HAVE_SEH_EXCEPTIONS
extern EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, void*,
    PCONTEXT, PDISPATCHER_CONTEXT, _Unwind_Reason_Code(*)(int, int, uint64_t,
    struct _Unwind_Exception*, struct _Unwind_Context*));
#endif
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
	intptr_t filter = 0;

	if (foreign) {
		switch (ex_class) {
#ifdef CXX_PERSONALITY
		case GNUCCXX0_EXCEPTION_CLASS:
		case CLNGCXX0_EXCEPTION_CLASS:
			if (CXX_PERSONALITY != NULL)
				return CALL_PERSONALITY(CXX_PERSONALITY);
			break;
#endif
		}

		/*
		 * None matched or none available - we'll try to handle it
		 * anyway, but will most likely fail.







|
|







566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
	intptr_t filter = 0;

	if (foreign) {
		switch (ex_class) {
#ifdef CXX_PERSONALITY
		case GNUCCXX0_EXCEPTION_CLASS:
		case CLNGCXX0_EXCEPTION_CLASS:
			if (cxx_personality != NULL)
				return CALL_PERSONALITY(cxx_personality);
			break;
#endif
		}

		/*
		 * None matched or none available - we'll try to handle it
		 * anyway, but will most likely fail.