Index: src/OFApplication.h ================================================================== --- src/OFApplication.h +++ src/OFApplication.h @@ -133,11 +133,11 @@ #ifdef OF_HAVE_PROPERTIES @property (readonly, copy, nonatomic) OFString *programName; @property (readonly, copy, nonatomic) OFArray OF_GENERIC(OFString*) *arguments; @property (readonly, copy, nonatomic) OFDictionary OF_GENERIC(OFString*, OFString*) *environment; -@property (assign, nullable) id delegate; +@property OF_NULLABLE_PROPERTY (assign) id delegate; #endif /*! * @brief Returns the only OFApplication instance in the application. * Index: src/OFHTTPClient.h ================================================================== --- src/OFHTTPClient.h +++ src/OFHTTPClient.h @@ -108,11 +108,11 @@ bool _lastWasHEAD; OFHTTPResponse *_lastResponse; } #ifdef OF_HAVE_PROPERTIES -@property (assign, nullable) id delegate; +@property OF_NULLABLE_PROPERTY (assign) id delegate; @property bool insecureRedirectsAllowed; #endif /*! * @brief Creates a new OFHTTPClient. Index: src/OFHTTPRequest.h ================================================================== --- src/OFHTTPRequest.h +++ src/OFHTTPRequest.h @@ -82,14 +82,14 @@ #ifdef OF_HAVE_PROPERTIES @property (copy) OFURL *URL; @property of_http_request_method_t method; @property of_http_request_protocol_version_t protocolVersion; -@property (copy, nullable) OFDictionary OF_GENERIC(OFString*, OFString*) - *headers; -@property (retain, nullable) OFDataArray *body; -@property (copy, nullable) OFString *remoteAddress; +@property OF_NULLABLE_PROPERTY (copy) + OFDictionary OF_GENERIC(OFString*, OFString*) *headers; +@property OF_NULLABLE_PROPERTY (retain) OFDataArray *body; +@property OF_NULLABLE_PROPERTY (copy) OFString *remoteAddress; #endif /*! * @brief Creates a new OFHTTPRequest. * Index: src/OFHTTPResponse.h ================================================================== --- src/OFHTTPResponse.h +++ src/OFHTTPResponse.h @@ -34,12 +34,12 @@ } #ifdef OF_HAVE_PROPERTIES @property of_http_request_protocol_version_t protocolVersion; @property short statusCode; -@property (copy, nullable) OFDictionary OF_GENERIC(OFString*, OFString*) - *headers; +@property OF_NULLABLE_PROPERTY (copy) + OFDictionary OF_GENERIC(OFString*, OFString*) *headers; #endif /*! * @brief Sets the protocol version of the HTTP request reply. * Index: src/OFHTTPServer.h ================================================================== --- src/OFHTTPServer.h +++ src/OFHTTPServer.h @@ -77,14 +77,14 @@ OFString *_name; OFTCPSocket *_listeningSocket; } #ifdef OF_HAVE_PROPERTIES -@property (copy, nullable) OFString *host; +@property OF_NULLABLE_PROPERTY (copy) OFString *host; @property uint16_t port; -@property (assign, nullable) id delegate; -@property (copy, nullable) OFString *name; +@property OF_NULLABLE_PROPERTY (assign) id delegate; +@property OF_NULLABLE_PROPERTY (copy) OFString *name; #endif /*! * @brief Creates a new HTTP server. * Index: src/OFIntrospection.h ================================================================== --- src/OFIntrospection.h +++ src/OFIntrospection.h @@ -50,11 +50,11 @@ } #ifdef OF_HAVE_PROPERTIES @property (readonly) SEL selector; @property (readonly, copy) OFString *name; -@property (assign, readonly, nullable) const char *typeEncoding; +@property OF_NULLABLE_PROPERTY (assign, readonly) const char *typeEncoding; #endif /*! * @brief Returns the selector of the method. * @@ -90,11 +90,11 @@ } #ifdef OF_HAVE_PROPERTIES @property (readonly, copy) OFString *name; @property (readonly) unsigned attributes; -@property (copy, readonly, nullable) OFString *getter, *setter; +@property OF_NULLABLE_PROPERTY (copy, readonly) OFString *getter, *setter; #endif /*! * @brief Returns the name of the property. * @@ -151,11 +151,11 @@ } #ifdef OF_HAVE_PROPERTIES @property (readonly, copy) OFString *name; @property (readonly) ptrdiff_t offset; -@property (assign, readonly, nullable) const char *typeEncoding; +@property OF_NULLABLE_PROPERTY (assign, readonly) const char *typeEncoding; #endif /*! * @brief Returns the name of the instance variable. * Index: src/OFKernelEventObserver.h ================================================================== --- src/OFKernelEventObserver.h +++ src/OFKernelEventObserver.h @@ -127,11 +127,12 @@ OFMutex *_mutex; #endif } #ifdef OF_HAVE_PROPERTIES -@property (assign, nullable) id delegate; +@property OF_NULLABLE_PROPERTY (assign) + id delegate; #endif /*! * @brief Creates a new OFKernelEventObserver. * Index: src/OFList.h ================================================================== --- src/OFList.h +++ src/OFList.h @@ -59,12 +59,12 @@ size_t _count; unsigned long _mutations; } #ifdef OF_HAVE_PROPERTIES -@property (readonly, nullable) of_list_object_t *firstListObject; -@property (readonly, nullable) of_list_object_t *lastListObject; +@property OF_NULLABLE_PROPERTY (readonly) of_list_object_t *firstListObject; +@property OF_NULLABLE_PROPERTY (readonly) of_list_object_t *lastListObject; #endif /*! * @brief Creates a new OFList. * Index: src/OFLocking.h ================================================================== --- src/OFLocking.h +++ src/OFLocking.h @@ -23,11 +23,11 @@ * * @brief A protocol for locks. */ @protocol OFLocking #ifdef OF_HAVE_PROPERTIES -@property (copy, nullable) OFString *name; +@property OF_NULLABLE_PROPERTY (copy) OFString *name; #endif /*! * @brief Locks the lock. */ Index: src/OFTCPSocket.h ================================================================== --- src/OFTCPSocket.h +++ src/OFTCPSocket.h @@ -67,11 +67,11 @@ uint16_t _SOCKS5Port; } #ifdef OF_HAVE_PROPERTIES @property (readonly, getter=isListening) bool listening; -@property (copy, nullable) OFString *SOCKS5Host; +@property OF_NULLABLE_PROPERTY (copy) OFString *SOCKS5Host; @property uint16_t SOCKS5Port; @property (getter=isKeepAliveEnabled) bool keepAliveEnabled; @property (getter=isTCPNoDelayEnabled) bool TCPNoDelayEnabled; #endif Index: src/OFTLSSocket.h ================================================================== --- src/OFTLSSocket.h +++ src/OFTLSSocket.h @@ -55,13 +55,14 @@ * @brief A protocol that should be implemented by 3rd-party libraries * implementing TLS. */ @protocol OFTLSSocket #ifdef OF_HAVE_PROPERTIES -@property (assign, nullable) id delegate; -@property (copy, nullable) OFString *certificateFile, *privateKeyFile; -@property (assign, nullable) const char *privateKeyPassphrase; +@property OF_NULLABLE_PROPERTY (assign) id delegate; +@property OF_NULLABLE_PROPERTY (copy) + OFString *certificateFile, *privateKeyFile; +@property OF_NULLABLE_PROPERTY (assign) const char *privateKeyPassphrase; @property (getter=isCertificateVerificationEnabled) bool certificateVerificationEnabled; #endif /*! Index: src/OFURL.h ================================================================== --- src/OFURL.h +++ src/OFURL.h @@ -32,19 +32,15 @@ uint16_t _port; OFString *_user, *_password, *_path, *_parameters, *_query, *_fragment; } #ifdef OF_HAVE_PROPERTIES -@property (copy) OFString *scheme; -@property (copy) OFString *host; +@property (copy) OFString *scheme, *host; @property uint16_t port; -@property (copy, nullable) OFString *user; -@property (copy, nullable) OFString *password; +@property OF_NULLABLE_PROPERTY (copy) OFString *user, *password; @property (copy) OFString *path; -@property (copy, nullable) OFString *parameters; -@property (copy, nullable) OFString *query; -@property (copy, nullable) OFString *fragment; +@property OF_NULLABLE_PROPERTY (copy) OFString *parameters, *query, *fragment; #endif /*! * Creates a new URL. * Index: src/OFXMLAttribute.h ================================================================== --- src/OFXMLAttribute.h +++ src/OFXMLAttribute.h @@ -32,13 +32,14 @@ } #ifdef OF_HAVE_PROPERTIES @property (readonly, copy) OFString *name; # ifdef __cplusplus -@property (readonly, copy, getter=namespace, nullable) OFString *namespace_; +@property OF_NULLABLE_PROPERTY (readonly, copy, getter=namespace) + OFString *namespace_; # else -@property (readonly, copy, nullable) OFString *namespace; +@property OF_NULLABLE_PROPERTY (readonly, copy) OFString *namespace; # endif #endif /*! * @brief Creates a new XML attribute. Index: src/OFXMLElement.h ================================================================== --- src/OFXMLElement.h +++ src/OFXMLElement.h @@ -41,19 +41,19 @@ } #ifdef OF_HAVE_PROPERTIES @property (copy) OFString *name; # ifdef __cplusplus -@property (copy, getter=namespace, setter=setNamespace:, nullable) +@property OF_NULLABLE_PROPERTY (copy, getter=namespace, setter=setNamespace:) OFString *namespace_; # else -@property (copy, nullable) OFString *namespace; +@property OF_NULLABLE_PROPERTY (copy) OFString *namespace; # endif -@property (copy, nullable) OFString *defaultNamespace; -@property (copy, readonly, nullable) OFArray OF_GENERIC(OFXMLAttribute*) - *attributes; -@property (copy, nullable) OFArray OF_GENERIC(OFXMLNode*) *children; +@property OF_NULLABLE_PROPERTY (copy) OFString *defaultNamespace; +@property OF_NULLABLE_PROPERTY (copy, readonly) + OFArray OF_GENERIC(OFXMLAttribute*) *attributes; +@property OF_NULLABLE_PROPERTY (copy) OFArray OF_GENERIC(OFXMLNode*) *children; #endif /*! * @brief Creates a new XML element with the specified name. * Index: src/OFXMLElementBuilder.h ================================================================== --- src/OFXMLElementBuilder.h +++ src/OFXMLElementBuilder.h @@ -111,11 +111,12 @@ OFMutableArray OF_GENERIC(OFXMLElement*) *_stack; id _delegate; } #ifdef OF_HAVE_PROPERTIES -@property (assign, nullable) id delegate; +@property OF_NULLABLE_PROPERTY (assign) + id delegate; #endif /*! * @brief Creates a new element builder. * Index: src/OFXMLParser.h ================================================================== --- src/OFXMLParser.h +++ src/OFXMLParser.h @@ -176,11 +176,11 @@ of_string_encoding_t _encoding; size_t _depthLimit; } #ifdef OF_HAVE_PROPERTIES -@property (assign, nullable) id delegate; +@property OF_NULLABLE_PROPERTY (assign) id delegate; @property size_t depthLimit; #endif /*! * @brief Creates a new XML parser. Index: src/macros.h ================================================================== --- src/macros.h +++ src/macros.h @@ -177,15 +177,17 @@ #if __has_feature(nullability) # define OF_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin") # define OF_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end") # define OF_NONNULL __nonnull # define OF_NULLABLE __nullable +# define OF_NULLABLE_PROPERTY(...) (__VA_ARGS__, nullable) #else # define OF_ASSUME_NONNULL_BEGIN # define OF_ASSUME_NONNULL_END # define OF_NONNULL # define OF_NULLABLE +# define OF_NULLABLE_PROPERTY # define nonnull # define nullable #endif #if __has_feature(objc_kindof)