Overview
Comment: | runtime: Add nullability annotations |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
8c7e612885a126b5086e4241645ee170 |
User & Date: | js on 2017-05-14 02:15:45 |
Other Links: | manifest | tags |
Context
2017-05-14
| ||
14:18 | Add nullability annotations to remaining headers check-in: c5b3c8ea87 user: js tags: trunk | |
02:15 | runtime: Add nullability annotations check-in: 8c7e612885 user: js tags: trunk | |
01:30 | macros.h: Add null_unspecified check-in: 03963d9304 user: js tags: trunk | |
Changes
Modified src/runtime/class.m from [bb8140f5e4] to [ac59d0cf50].
︙ | ︙ | |||
610 611 612 613 614 615 616 | return cls->name; } Class class_getSuperclass(Class cls) { if (cls == Nil) | | | 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | return cls->name; } Class class_getSuperclass(Class cls) { if (cls == Nil) return Nil; return cls->superclass; } unsigned long class_getInstanceSize(Class cls) { |
︙ | ︙ |
Modified src/runtime/misc.m from [f3943f8a7d] to [8f9e858d65].
︙ | ︙ | |||
18 19 20 21 22 23 24 | #include <stdio.h> #include <stdlib.h> #include "runtime.h" #include "runtime-private.h" | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #include <stdio.h> #include <stdlib.h> #include "runtime.h" #include "runtime-private.h" static objc_enumeration_mutation_handler enumeration_mutation_handler = NULL; void objc_enumerationMutation(id obj) { if (enumeration_mutation_handler != NULL) enumeration_mutation_handler(obj); else |
︙ | ︙ |
Modified src/runtime/protocol.m from [a6710fd48b] to [b64c537258].
︙ | ︙ | |||
51 52 53 54 55 56 57 58 59 60 61 62 63 64 | return false; } bool class_conformsToProtocol(Class cls, Protocol *p) { struct objc_category **cats; for (struct objc_protocol_list *pl = cls->protocols; pl != NULL; pl = pl->next) for (long i = 0; i < pl->count; i++) if (protocol_conformsToProtocol(pl->list[i], p)) return true; | > > > | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | return false; } bool class_conformsToProtocol(Class cls, Protocol *p) { struct objc_category **cats; if (cls == Nil) return false; for (struct objc_protocol_list *pl = cls->protocols; pl != NULL; pl = pl->next) for (long i = 0; i < pl->count; i++) if (protocol_conformsToProtocol(pl->list[i], p)) return true; |
︙ | ︙ |
Modified src/runtime/runtime.h from [5f553e5436] to [c2bf2e5fcb].
︙ | ︙ | |||
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | #endif #if __has_feature(objc_arc) # define OBJC_UNSAFE_UNRETAINED __unsafe_unretained #else # define OBJC_UNSAFE_UNRETAINED #endif #if __has_attribute(__objc_root_class__) # define OBJC_ROOT_CLASS __attribute__((__objc_root_class__)) #else # define OBJC_ROOT_CLASS #endif #define Nil (Class)0 #define nil (id)0 #define YES (BOOL)1 #define NO (BOOL)0 typedef struct objc_class *Class; typedef struct objc_object *id; typedef const struct objc_selector *SEL; typedef signed char BOOL; | > > > > > | | > | | | | | | | | | | | | | | | | | | | | | | | | | | 37 38 39 40 41 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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | #endif #if __has_feature(objc_arc) # define OBJC_UNSAFE_UNRETAINED __unsafe_unretained #else # define OBJC_UNSAFE_UNRETAINED #endif #if !__has_feature(nullability) # define _Nonnull # define _Nullable #endif #if __has_attribute(__objc_root_class__) # define OBJC_ROOT_CLASS __attribute__((__objc_root_class__)) #else # define OBJC_ROOT_CLASS #endif #define Nil (Class)0 #define nil (id)0 #define YES (BOOL)1 #define NO (BOOL)0 typedef struct objc_class *Class; typedef struct objc_object *id; typedef const struct objc_selector *SEL; typedef signed char BOOL; typedef id _Nullable (*IMP)(id _Nonnull, SEL _Nonnull, ...); typedef void (*objc_uncaught_exception_handler)(id _Nullable); typedef void (*objc_enumeration_mutation_handler)(id _Nonnull); struct objc_class { Class _Nonnull isa; Class _Nullable superclass; const char *_Nonnull name; unsigned long version; unsigned long info; long instance_size; struct objc_ivar_list *_Nullable ivars; struct objc_method_list *_Nullable methodlist; struct objc_dtable *_Nullable dtable; Class _Nonnull *_Nullable subclass_list; void *_Nullable sibling_class; struct objc_protocol_list *_Nullable protocols; void *_Nullable gc_object_type; unsigned long abi_version; int32_t *_Nonnull *_Nullable ivar_offsets; struct objc_property_list *_Nullable properties; }; enum objc_class_info { OBJC_CLASS_INFO_CLASS = 0x001, OBJC_CLASS_INFO_METACLASS = 0x002, OBJC_CLASS_INFO_NEW_ABI = 0x010, OBJC_CLASS_INFO_SETUP = 0x100, OBJC_CLASS_INFO_LOADED = 0x200, OBJC_CLASS_INFO_DTABLE = 0x400, OBJC_CLASS_INFO_INITIALIZED = 0x800 }; struct objc_object { Class _Nonnull isa; }; struct objc_selector { uintptr_t uid; const char *_Nullable types; }; struct objc_super { id OBJC_UNSAFE_UNRETAINED _Nullable self; Class _Nonnull cls; }; struct objc_method { struct objc_selector sel; IMP _Nonnull imp; }; struct objc_method_list { struct objc_method_list *_Nullable next; unsigned int count; struct objc_method methods[1]; }; struct objc_category { const char *_Nonnull category_name; const char *_Nonnull class_name; struct objc_method_list *_Nullable instance_methods; struct objc_method_list *_Nullable class_methods; struct objc_protocol_list *_Nullable protocols; }; struct objc_ivar { const char *_Nonnull name; const char *_Nonnull type; unsigned int offset; }; struct objc_ivar_list { unsigned int count; struct objc_ivar ivars[1]; }; |
︙ | ︙ | |||
151 152 153 154 155 156 157 | OBJC_PROPERTY_ATOMIC = 0x4, OBJC_PROPERTY_WEAK = 0x8, OBJC_PROPERTY_STRONG = 0x10, OBJC_PROPERTY_UNSAFE_UNRETAINED = 0x20 }; struct objc_property { | | | | | | | | | | | | | | | | > | | | | | | | | | | | | | > | > | > | > | > | | | | | | | | | | | | | | > | > | | | | > > | | > | > | | > > > > > > | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | OBJC_PROPERTY_ATOMIC = 0x4, OBJC_PROPERTY_WEAK = 0x8, OBJC_PROPERTY_STRONG = 0x10, OBJC_PROPERTY_UNSAFE_UNRETAINED = 0x20 }; struct objc_property { const char *_Nonnull name; unsigned char attributes, extended_attributes; struct { const char *_Nullable name; const char *_Nullable type; } getter, setter; }; struct objc_property_list { unsigned int count; struct objc_property_list *_Nullable next; struct objc_property properties[1]; }; #ifdef __OBJC__ OBJC_ROOT_CLASS @interface Protocol { @public #else typedef struct { #endif Class _Nonnull isa; const char *_Nonnull name; struct objc_protocol_list *_Nullable protocol_list; struct objc_abi_method_description_list *_Nullable instance_methods; struct objc_abi_method_description_list *_Nullable class_methods; #ifdef __OBJC__ } @end #else } Protocol; #endif struct objc_protocol_list { struct objc_protocol_list *_Nullable next; long count; Protocol *OBJC_UNSAFE_UNRETAINED _Nonnull list[1]; }; #ifdef __cplusplus extern "C" { #endif extern SEL _Nonnull sel_registerName(const char *_Nonnull); extern const char *_Nonnull sel_getName(SEL _Nonnull); extern bool sel_isEqual(SEL _Nonnull, SEL _Nonnull); extern Class _Nonnull objc_allocateClassPair(Class _Nullable, const char *_Nonnull, size_t); extern void objc_registerClassPair(Class _Nonnull); extern id _Nullable objc_lookUpClass(const char *_Nonnull); extern id _Nullable objc_getClass(const char *_Nonnull); extern id _Nonnull objc_getRequiredClass(const char *_Nonnull); extern unsigned int objc_getClassList(Class _Nonnull *_Nullable, unsigned int); extern Class _Nonnull *_Nonnull objc_copyClassList(unsigned int *_Nullable); extern bool class_isMetaClass(Class _Nullable); extern const char *_Nonnull class_getName(Class _Nullable); extern Class _Nullable class_getSuperclass(Class _Nullable); extern unsigned long class_getInstanceSize(Class _Nullable); extern bool class_respondsToSelector(Class _Nullable, SEL _Nonnull); extern bool class_conformsToProtocol(Class _Nullable, Protocol *_Nonnull); extern IMP _Nullable class_getMethodImplementation(Class _Nullable, SEL _Nonnull); extern IMP _Nullable class_getMethodImplementation_stret(Class _Nullable, SEL _Nonnull); extern const char *_Nullable class_getMethodTypeEncoding(Class _Nullable, SEL _Nonnull); extern bool class_addMethod(Class _Nonnull, SEL _Nonnull, IMP _Nonnull, const char *_Nullable); extern IMP _Nullable class_replaceMethod(Class _Nonnull, SEL _Nonnull, IMP _Nonnull, const char *_Nullable); extern Class _Nullable object_getClass(id _Nullable); extern Class _Nullable object_setClass(id _Nullable, Class _Nonnull); extern const char *_Nonnull object_getClassName(id _Nullable); extern const char *_Nonnull protocol_getName(Protocol *_Nonnull); extern bool protocol_isEqual(Protocol *_Nonnull, Protocol *_Nonnull); extern bool protocol_conformsToProtocol(Protocol *_Nonnull, Protocol *_Nonnull); extern void objc_exit(void); extern _Nullable objc_uncaught_exception_handler objc_setUncaughtExceptionHandler(objc_uncaught_exception_handler _Nullable); extern void objc_setForwardHandler(IMP _Nullable, IMP _Nullable); extern void objc_zero_weak_references(id _Nonnull); /* * Used by the compiler, but can also be called manually. * * These declarations are also required to prevent Clang's implicit * declarations which include __declspec(dllimport) on Windows. */ struct objc_abi_module; extern void __objc_exec_class(void *_Nonnull); extern IMP _Nonnull objc_msg_lookup(id _Nullable, SEL _Nonnull); extern IMP _Nonnull objc_msg_lookup_stret(id _Nullable, SEL _Nonnull); extern IMP _Nonnull objc_msg_lookup_super(struct objc_super *_Nonnull, SEL _Nonnull); extern IMP _Nonnull objc_msg_lookup_super_stret(struct objc_super *_Nonnull, SEL _Nonnull); extern void objc_exception_throw(id _Nullable); extern int objc_sync_enter(id _Nullable); extern int objc_sync_exit(id _Nullable); extern id _Nullable objc_getProperty(id _Nonnull, SEL _Nonnull, ptrdiff_t, BOOL); extern void objc_setProperty(id _Nonnull, SEL _Nonnull, ptrdiff_t, id _Nullable, BOOL, signed char); extern void objc_getPropertyStruct(void *_Nonnull, const void *_Nonnull, ptrdiff_t, BOOL, BOOL); extern void objc_setPropertyStruct(void *_Nonnull, const void *_Nonnull, ptrdiff_t, BOOL, BOOL); extern void objc_enumerationMutation(id _Nonnull); extern void objc_setEnumerationMutationHandler( objc_enumeration_mutation_handler _Nullable); #ifdef __cplusplus } #endif #undef OBJC_UNSAFE_UNRETAINED #undef OBJC_ROOT_CLASS #if !__has_feature(nullability) # undef _Nonnull # undef _Nullable #endif #endif |
Modified src/runtime/synchronized.m from [675119db68] to [d3901856c6].
︙ | ︙ | |||
40 41 42 43 44 45 46 47 48 49 50 51 52 53 | OBJC_ERROR("Failed to create mutex!") } #endif int objc_sync_enter(id object) { #ifdef OF_HAVE_THREADS struct lock_s *lock; if (!of_mutex_lock(&mutex)) OBJC_ERROR("Failed to lock mutex!"); /* Look if we already have a lock */ | > > > | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | OBJC_ERROR("Failed to create mutex!") } #endif int objc_sync_enter(id object) { if (object == nil) return 0; #ifdef OF_HAVE_THREADS struct lock_s *lock; if (!of_mutex_lock(&mutex)) OBJC_ERROR("Failed to lock mutex!"); /* Look if we already have a lock */ |
︙ | ︙ | |||
88 89 90 91 92 93 94 95 96 97 98 99 100 101 | return 0; } int objc_sync_exit(id object) { #ifdef OF_HAVE_THREADS struct lock_s *lock, *last = NULL; if (!of_mutex_lock(&mutex)) OBJC_ERROR("Failed to lock mutex!"); for (lock = locks; lock != NULL; lock = lock->next) { | > > > | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | return 0; } int objc_sync_exit(id object) { if (object == nil) return 0; #ifdef OF_HAVE_THREADS struct lock_s *lock, *last = NULL; if (!of_mutex_lock(&mutex)) OBJC_ERROR("Failed to lock mutex!"); for (lock = locks; lock != NULL; lock = lock->next) { |
︙ | ︙ |