ObjFW  Diff

Differences From Artifact [3f124a3246]:

To Artifact [baff938aeb]:

  • File src/OFObject.h — part of check-in [bac91ccede] at 2014-05-14 20:45:00 on branch trunk — Add C11 noreturn

    If it's unavailable, it's defined to __attribute__((noreturn)).

    Unfortunately, it cannot be used for ObjC methods, as noreturn is part
    of the return type while __attribute__((noreturn)) needs to be at the
    end for an ObjC method. To make matters worse, even GCC versions that
    accept noreturn don't allow it for an ObjC method. Thus, the only thing
    that can be done is to always use __attribute__((noreturn)) for ObjC
    methods using the OF_METHOD_NORETURN define. (user: js, size: 28951) [annotate] [blame] [check-ins using]


42
43
44
45
46
47
48












49
50
51
52
53
54
55
/*! @file */

#if defined(__GNUC__)
# define restrict __restrict__
#elif __STDC_VERSION__ < 199901L
# define restrict
#endif













#if defined(OF_HAVE__THREAD_LOCAL)
# define OF_HAVE_COMPILER_TLS
# ifdef OF_HAVE_THREADS_H
#  include <threads.h>
# else
#  define thread_local _Thread_local







>
>
>
>
>
>
>
>
>
>
>
>







42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*! @file */

#if defined(__GNUC__)
# define restrict __restrict__
#elif __STDC_VERSION__ < 199901L
# define restrict
#endif

#if __STDC_VERSION__ >= 201112L
# ifdef OF_HAVE_STDNORETURN_H
#  include <stdnoreturn.h>
# else
#  define noreturn _Noreturn
# endif
#elif defined(__GNUC__)
# define noreturn __attribute__((noreturn))
#else
# define noreturn
#endif

#if defined(OF_HAVE__THREAD_LOCAL)
# define OF_HAVE_COMPILER_TLS
# ifdef OF_HAVE_THREADS_H
#  include <threads.h>
# else
#  define thread_local _Thread_local
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#  undef false
#  define false ((bool)0)
# endif
#endif

#if defined(__clang__) || __GCC_VERSION__ >= 406
# define OF_SENTINEL __attribute__((__sentinel__))
# define OF_NO_RETURN __attribute__((__noreturn__))
#else
# define OF_SENTINEL
# define OF_NO_RETURN
#endif

#if __has_attribute(__objc_requires_super__)
# define OF_REQUIRES_SUPER __attribute__((__objc_requires_super__))
#else
# define OF_REQUIRES_SUPER
#endif







|


|







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#  undef false
#  define false ((bool)0)
# endif
#endif

#if defined(__clang__) || __GCC_VERSION__ >= 406
# define OF_SENTINEL __attribute__((__sentinel__))
# define OF_METHOD_NORETURN __attribute__((__noreturn__))
#else
# define OF_SENTINEL
# define OF_METHOD_NORETURN
#endif

#if __has_attribute(__objc_requires_super__)
# define OF_REQUIRES_SUPER __attribute__((__objc_requires_super__))
#else
# define OF_REQUIRES_SUPER
#endif
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
 * @brief Handles messages which are not understood by the receiver.
 *
 * @warning If you override this method, you must make sure that it never
 *	    returns.
 *
 * @param selector The selector not understood by the receiver
 */
- (void)doesNotRecognizeSelector: (SEL)selector OF_NO_RETURN;
@end

/*!
 * @protocol OFCopying OFObject.h ObjFW/OFObject.h
 *
 * @brief A protocol for the creation of copies.
 */







|







969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
 * @brief Handles messages which are not understood by the receiver.
 *
 * @warning If you override this method, you must make sure that it never
 *	    returns.
 *
 * @param selector The selector not understood by the receiver
 */
- (void)doesNotRecognizeSelector: (SEL)selector OF_METHOD_NORETURN;
@end

/*!
 * @protocol OFCopying OFObject.h ObjFW/OFObject.h
 *
 * @brief A protocol for the creation of copies.
 */