ObjFW  Check-in [40c0aba35e]

Overview
Comment:Add an uncaught exception handler for the Apple & new GNU runtime.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 40c0aba35e06fa344c30cd4371be87487c2c2ecbf4bff1e15d85815d91f84437
User & Date: js on 2011-12-23 03:07:12
Other Links: manifest | tags
Context
2011-12-24
19:28
Don't check for -fgnu89-inline when using Clang. check-in: 1b60fffb9d user: js tags: trunk
2011-12-23
03:07
Add an uncaught exception handler for the Apple & new GNU runtime. check-in: 40c0aba35e user: js tags: trunk
2011-12-21
20:05
Work around a bug with Clang + glibc. check-in: 8ed8b90cd8 user: js tags: trunk
Changes

Modified src/OFObject.m from [f6fefc29fd] to [f8865835bf].

36
37
38
39
40
41
42


43

44
45
46
47
48
49
50
36
37
38
39
40
41
42
43
44

45
46
47
48
49
50
51
52







+
+
-
+







#import "OFMemoryNotPartOfObjectException.h"
#import "OFNotImplementedException.h"
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"

#import "macros.h"

#if defined(OF_APPLE_RUNTIME) || defined(OF_GNU_RUNTIME)
# import <objc/objc-exception.h>
#if defined(OF_OBJFW_RUNTIME)
#elif defined(OF_OBJFW_RUNTIME)
# import <objfw-rt.h>
#elif defined(OF_OLD_GNU_RUNTIME)
# import <objc/Protocol.h>
#endif

#ifdef _WIN32
# include <windows.h>
93
94
95
96
97
98
99









100
101
102
103
104
105
106
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117







+
+
+
+
+
+
+
+
+







#ifdef NEED_OBJC_SYNC_INIT
extern BOOL objc_sync_init();
#endif

#ifdef NEED_OBJC_PROPERTIES_INIT
extern BOOL objc_properties_init();
#endif

#if defined(OF_APPLE_RUNTIME) || defined(OF_GNU_RUNTIME)
static void
uncaught_exception_handler(id exception)
{
	fprintf(stderr, "Unhandled exception:\n%s\n",
	    [[exception description] UTF8String]);
}
#endif

static void
enumeration_mutation_handler(id object)
{
	@throw [OFEnumerationMutationException
	    exceptionWithClass: [object class]
			object: object];
174
175
176
177
178
179
180




181
182
183
184
185
186
187
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202







+
+
+
+







#ifdef NEED_OBJC_PROPERTIES_INIT
	if (!objc_properties_init()) {
		fputs("Runtime error: objc_properties_init() failed!\n",
		    stderr);
		abort();
	}
#endif

#if defined(OF_APPLE_RUNTIME) || defined(OF_GNU_RUNTIME)
	objc_setUncaughtExceptionHandler(uncaught_exception_handler);
#endif

#ifdef HAVE_OBJC_ENUMERATIONMUTATION
	objc_setEnumerationMutationHandler(enumeration_mutation_handler);
#endif

	cxx_construct = sel_registerName(".cxx_construct");
	cxx_destruct = sel_registerName(".cxx_destruct");