ObjFW  Check-in [ffb39d1df6]

Overview
Comment:Add OF_NO_RETURN_FUNC

OF_NO_RETURN_FUNC is defined when __attribute__((__noreturn__)) is
supported for functions, whereas OF_NO_RETURN is only defined when it is
supported for both functions and methods.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ffb39d1df6403a537967f0644f6910b09d941437831567f1bb25fd0090f256d2
User & Date: js on 2015-03-30 21:33:29
Other Links: manifest | tags
Context
2015-04-11
11:01
OFOpenFileFailedException: Rename File -> Item check-in: ff17b98ab2 user: js tags: trunk
2015-03-30
21:33
Add OF_NO_RETURN_FUNC check-in: ffb39d1df6 user: js tags: trunk
21:32
OFException: Fix missing #ifdef / #endif check-in: 4d16add5ae user: js tags: trunk
Changes

Modified Doxyfile from [2228832996] to [36e288b969].

10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
27
	     OF_HAVE_FILES		\
	     OF_HAVE_OPTIONAL_PROTOCOLS	\
	     OF_HAVE_PROPERTIES		\
	     OF_HAVE_SOCKETS		\
	     OF_HAVE_THREADS		\
	     OF_METHOD_NORETURN		\
	     OF_NO_RETURN		\

	     OF_SENTINEL		\
	     OF_REQUIRES_SUPER		\
	     OF_RETURNS_RETAINED	\
	     OF_RETURNS_NOT_RETAINED	\
	     OF_RETURNS_INNER_POINTER	\
	     OF_ROOT_CLASS		\
	     OF_CONSUMED		\
	     OF_WEAK_UNAVAILABLE
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
IGNORE_PREFIX = OF of_







>











10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
	     OF_HAVE_FILES		\
	     OF_HAVE_OPTIONAL_PROTOCOLS	\
	     OF_HAVE_PROPERTIES		\
	     OF_HAVE_SOCKETS		\
	     OF_HAVE_THREADS		\
	     OF_METHOD_NORETURN		\
	     OF_NO_RETURN		\
	     OF_NO_RETURN_FUNC
	     OF_SENTINEL		\
	     OF_REQUIRES_SUPER		\
	     OF_RETURNS_RETAINED	\
	     OF_RETURNS_NOT_RETAINED	\
	     OF_RETURNS_INNER_POINTER	\
	     OF_ROOT_CLASS		\
	     OF_CONSUMED		\
	     OF_WEAK_UNAVAILABLE
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
IGNORE_PREFIX = OF of_

Modified src/OFObject.h from [3a0eaddd4d] to [1907dcf7b8].

940
941
942
943
944
945
946
947
948
949
950
951
#import "OFObject+Serialization.h"

#ifdef __cplusplus
extern "C" {
#endif
extern id of_alloc_object(Class class_, size_t extraSize, size_t extraAlignment,
    void **extra);
extern void OF_NO_RETURN of_method_not_found(id self, SEL _cmd);
extern uint32_t of_hash_seed;
#ifdef __cplusplus
}
#endif







|




940
941
942
943
944
945
946
947
948
949
950
951
#import "OFObject+Serialization.h"

#ifdef __cplusplus
extern "C" {
#endif
extern id of_alloc_object(Class class_, size_t extraSize, size_t extraAlignment,
    void **extra);
extern void OF_NO_RETURN_FUNC of_method_not_found(id self, SEL _cmd);
extern uint32_t of_hash_seed;
#ifdef __cplusplus
}
#endif

Modified src/OFObject.m from [11cea8a285] to [8a0142f57a].

120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

static void
enumerationMutationHandler(id object)
{
	@throw [OFEnumerationMutationException exceptionWithObject: object];
}

void OF_NO_RETURN
of_method_not_found(id obj, SEL sel)
{
	[obj doesNotRecognizeSelector: sel];

	/*
	 * Just in case doesNotRecognizeSelector: returned, even though it must
	 * never return.
	 */
	abort();
}

void OF_NO_RETURN
of_method_not_found_stret(void *st, id obj, SEL sel)
{
	of_method_not_found(obj, sel);
}

#ifndef HAVE_OBJC_ENUMERATIONMUTATION
void







|











|







120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

static void
enumerationMutationHandler(id object)
{
	@throw [OFEnumerationMutationException exceptionWithObject: object];
}

void OF_NO_RETURN_FUNC
of_method_not_found(id obj, SEL sel)
{
	[obj doesNotRecognizeSelector: sel];

	/*
	 * Just in case doesNotRecognizeSelector: returned, even though it must
	 * never return.
	 */
	abort();
}

void OF_NO_RETURN_FUNC
of_method_not_found_stret(void *st, id obj, SEL sel)
{
	of_method_not_found(obj, sel);
}

#ifndef HAVE_OBJC_ENUMERATIONMUTATION
void

Modified src/macros.h from [620c867f01] to [d141131552].

62
63
64
65
66
67
68

69
70
71
72
73

74
75
76
77
78
79
80
#endif

#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__))

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

#endif

/* Required to build universal binaries on OS X */
#ifdef OF_UNIVERSAL
# if __BIG_ENDIAN__
#  define OF_BIG_ENDIAN
#  define OF_FLOAT_BIG_ENDIAN







>





>







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#endif

#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

/* Required to build universal binaries on OS X */
#ifdef OF_UNIVERSAL
# if __BIG_ENDIAN__
#  define OF_BIG_ENDIAN
#  define OF_FLOAT_BIG_ENDIAN

Modified src/threading.h from [2d831b6bc8] to [9b92c5e911].

98
99
100
101
102
103
104
105
106
107
108
109
110
111
112

extern bool of_thread_attr_init(of_thread_attr_t *attr);
extern bool of_thread_new(of_thread_t *thread, void (*function)(id), id object,
    const of_thread_attr_t *attr);
extern void of_thread_set_name(of_thread_t thread, const char *name);
extern bool of_thread_join(of_thread_t thread);
extern bool of_thread_detach(of_thread_t thread);
extern void OF_NO_RETURN of_thread_exit(void);
extern void of_once(of_once_t *control, void (*func)(void));
extern bool of_mutex_new(of_mutex_t *mutex);
extern bool of_mutex_lock(of_mutex_t *mutex);
extern bool of_mutex_trylock(of_mutex_t *mutex);
extern bool of_mutex_unlock(of_mutex_t *mutex);
extern bool of_mutex_free(of_mutex_t *mutex);
extern bool of_rmutex_new(of_rmutex_t *rmutex);







|







98
99
100
101
102
103
104
105
106
107
108
109
110
111
112

extern bool of_thread_attr_init(of_thread_attr_t *attr);
extern bool of_thread_new(of_thread_t *thread, void (*function)(id), id object,
    const of_thread_attr_t *attr);
extern void of_thread_set_name(of_thread_t thread, const char *name);
extern bool of_thread_join(of_thread_t thread);
extern bool of_thread_detach(of_thread_t thread);
extern void OF_NO_RETURN_FUNC of_thread_exit(void);
extern void of_once(of_once_t *control, void (*func)(void));
extern bool of_mutex_new(of_mutex_t *mutex);
extern bool of_mutex_lock(of_mutex_t *mutex);
extern bool of_mutex_trylock(of_mutex_t *mutex);
extern bool of_mutex_unlock(of_mutex_t *mutex);
extern bool of_mutex_free(of_mutex_t *mutex);
extern bool of_rmutex_new(of_rmutex_t *rmutex);

Modified src/threading_pthread.m from [2ccde6dcec] to [7f18dc085f].

146
147
148
149
150
151
152
153
154
155
156
157
158
159
160

bool
of_thread_detach(of_thread_t thread)
{
	return (pthread_detach(thread) == 0);
}

void OF_NO_RETURN
of_thread_exit(void)
{
	pthread_exit(NULL);

	OF_UNREACHABLE
}








|







146
147
148
149
150
151
152
153
154
155
156
157
158
159
160

bool
of_thread_detach(of_thread_t thread)
{
	return (pthread_detach(thread) == 0);
}

void OF_NO_RETURN_FUNC
of_thread_exit(void)
{
	pthread_exit(NULL);

	OF_UNREACHABLE
}

Modified src/threading_winapi.m from [1e29dc7f87] to [c4125134ec].

67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
bool
of_thread_detach(of_thread_t thread)
{
	/* FIXME */
	return true;
}

void OF_NO_RETURN
of_thread_exit(void)
{
	ExitThread(0);

	OF_UNREACHABLE
}








|







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
bool
of_thread_detach(of_thread_t thread)
{
	/* FIXME */
	return true;
}

void OF_NO_RETURN_FUNC
of_thread_exit(void)
{
	ExitThread(0);

	OF_UNREACHABLE
}