@@ -1,7 +1,7 @@ /* - * Copyright (c) 2008-2022 Jonathan Schleifer + * Copyright (c) 2008-2024 Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in @@ -13,15 +13,15 @@ * file. */ #include "config.h" -#include #include #import "OFMethodSignature.h" #import "OFData.h" +#import "OFString.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFOutOfRangeException.h" @@ -34,11 +34,11 @@ static size_t alignmentOfArray(const char **type, size_t *length) { size_t alignment; - assert(*length > 0); + OFAssert(*length > 0); (*type)++; (*length)--; while (*length > 0 && OFASCIIIsDigit(**type)) { @@ -63,11 +63,11 @@ size_t alignment = 0; #if defined(OF_POWERPC) && defined(OF_MACOS) bool first = true; #endif - assert(*length > 0); + OFAssert(*length > 0); (*type)++; (*length)--; /* Skip name */ @@ -109,11 +109,11 @@ static size_t alignmentOfUnion(const char **type, size_t *length) { size_t alignment = 0; - assert(*length > 0); + OFAssert(*length > 0); (*type)++; (*length)--; /* Skip name */ @@ -144,11 +144,12 @@ return alignment; } static size_t -#if defined(__clang__) && __clang_major__ == 3 && __clang_minor__ <= 7 +#if defined(__clang__) && __has_attribute(__optnone__) && \ + __clang_major__ == 3 && __clang_minor__ <= 7 /* Work around an ICE in Clang 3.7.0 on Windows/x86 */ __attribute__((__optnone__)) #endif alignmentOfEncoding(const char **type, size_t *length, bool inStruct) { @@ -290,11 +291,11 @@ sizeOfArray(const char **type, size_t *length) { size_t count = 0; size_t size; - assert(*length > 0); + OFAssert(*length > 0); (*type)++; (*length)--; while (*length > 0 && OFASCIIIsDigit(**type)) { @@ -330,11 +331,11 @@ size_t alignment = alignmentOfStruct(&typeCopy, &lengthCopy); #if defined(OF_POWERPC) && defined(OF_MACOS) bool first = true; #endif - assert(*length > 0); + OFAssert(*length > 0); (*type)++; (*length)--; /* Skip name */ @@ -403,11 +404,11 @@ static size_t sizeOfUnion(const char **type, size_t *length) { size_t size = 0; - assert(*length > 0); + OFAssert(*length > 0); (*type)++; (*length)--; /* Skip name */ @@ -438,10 +439,15 @@ return size; } static size_t +#if defined(__clang__) && __has_attribute(__optnone__) && \ + __clang_major__ == 3 && __clang_minor__ <= 7 +/* Work around an ICE in Clang 3.7.0 on Windows/x86 */ +__attribute__((__optnone__)) +#endif sizeOfEncoding(const char **type, size_t *length) { size_t size; if (*length == 0) @@ -583,10 +589,15 @@ @implementation OFMethodSignature + (instancetype)signatureWithObjCTypes: (const char*)types { return [[[self alloc] initWithObjCTypes: types] autorelease]; } + +- (instancetype)init +{ + OF_INVALID_INIT_METHOD +} - (instancetype)initWithObjCTypes: (const char *)types { self = [super init];