Fix compiler warnings.

main
David Chisnall 7 years ago committed by David Chisnall
parent 50493c38d7
commit 369c84db35

@ -25,7 +25,6 @@ int main()
tc = [MLTestClass new];
objc_setAssociatedObject(tc, &static_char, (id)1223, OBJC_ASSOCIATION_ASSIGN);
[tc release];
int i = 0;
tc = [MLTestClass new];
objc_setAssociatedObject(tc, &static_char, (id)1223, OBJC_ASSOCIATION_ASSIGN);
SEL some_sel = sel_registerName(".some_sel");
@ -33,5 +32,6 @@ int main()
class_addMethod(object_getClass(tc), some_sel,
(IMP)ff, types);
int j = (int)objc_getAssociatedObject(tc, &static_char);
assert(j == 1223);
[tc release];
}

@ -27,6 +27,7 @@ int finally(void)
{
__attribute__((cleanup(runCleanup)))
int x;
(void)x;
@try { throw(); }
@finally { finallyEntered = YES; }
return 0;

@ -44,7 +44,7 @@ int main(int argc, char *argv[])
Ivar b1 = class_getInstanceVariable(swb, "b1");
Ivar b2 = class_getInstanceVariable(swb, "b2");
Ivar b3 = class_getInstanceVariable(swb, "b3");
Ivar b4 = class_getInstanceVariable(swb, "b3");
Ivar b4 = class_getInstanceVariable(swb, "b4");
Ivar notBitfield = class_getInstanceVariable(swb, "notBitfield");
assert(baseSmall);
assert(c1);
@ -53,6 +53,8 @@ int main(int argc, char *argv[])
assert(b1);
assert(b2);
assert(b3);
assert(b4);
assert(notBitfield);
StartsWithBitfield *swbi = [StartsWithBitfield new];
// Alternating 01 bit pattern, should catch small overwrites.
@ -77,8 +79,8 @@ int main(int argc, char *argv[])
assert(swbi->b3 == 5);
assert(swbi->b4 == 11);
ptrdiff_t baseSmallOffset = ivar_getOffset(baseSmall);
#ifdef NEW_ABI
ptrdiff_t baseSmallOffset = ivar_getOffset(baseSmall);
// These should pass with the old ABI, but they don't at the moment. The
// way that they don't is not very harmful though: we just get a bit of
// redundant padding, so I don't consider a fix a very high priority.

@ -13,6 +13,10 @@ static char selBuffer[] = "XXXXXXXselectorXXXXXXXX";
static id x(id self, SEL _cmd)
{
methodCalled = YES;
if (strcmp(selBuffer, sel_getName(_cmd)) != 0)
{
fprintf(stderr, "'%s' != '%s'\n", selBuffer, sel_getName(_cmd));
}
assert(strcmp(selBuffer, sel_getName(_cmd)) == 0);
return self;
}

@ -31,7 +31,7 @@ __attribute__((objc_root_class))
int main()
{
unsigned int outCount, i;
unsigned int outCount;
objc_property_t *properties = class_copyPropertyList([helloclass class], &outCount);
assert(outCount == 1);
objc_property_t property = properties[0];

@ -25,6 +25,7 @@ void checkProtocolMethod(Protocol *p, SEL sel, BOOL isClass, BOOL isOptional)
int main(void)
{
__attribute__((unused))
Protocol *force_reference = @protocol(Test2);
Protocol *p = objc_allocateProtocol("Test");
protocol_addMethodDescription(p, @selector(someClassMethod), "@:", YES, NO);

@ -166,9 +166,6 @@ static int failures = 0;
} while(0)
int main(int argc, char **argv) {
Class firstSuperclass = objc_getClass("DefaultSuperclass");
Class subclass1 = objc_getClass("Subclass1");
/* Transitioning to a new superclass before +initialize has been called */
{
Class subclass1 = objc_getClass("Subclass1");
@ -232,8 +229,6 @@ int main(int argc, char **argv) {
class_setSuperclass(subclass2, secondSuperclass);
assert(_notInitializedSuperclass2Initialized);
Subclass2 *subclass2instance2 = class_createInstance(subclass2, 0);
// CLASS
// can call method on subclass
expect([subclass2instance1 existsOnSubclass2]);

@ -43,7 +43,6 @@ int main()
assert(class_getInstanceSize(nsarray) == (sizeof(Class) + sizeof(NSUInteger)));
Ivar count = class_getInstanceVariable(nsarray, "count");
assert(ivar_getOffset(count) == sizeof(id));
Ivar objects = class_getInstanceVariable(nsarray, "objects");
Class bitfield = objc_getClass("BitfieldTest");
assert(bitfield);

@ -109,8 +109,6 @@ static inline struct arc_tls* getARCThreadData(void)
return tls;
#endif
}
static int count = 0;
static int poolCount = 0;
static inline void release(id obj);
/**
@ -151,7 +149,6 @@ static void emptyPool(struct arc_tls *tls, id *stop)
// This may autorelease some other objects, so we have to work in
// the case where the autorelease pool is extended during a -release.
release(*tls->pool->insert);
count--;
}
void *old = tls->pool;
tls->pool = tls->pool->previous;
@ -163,7 +160,6 @@ static void emptyPool(struct arc_tls *tls, id *stop)
(tls->pool->insert > tls->pool->pool))
{
tls->pool->insert--;
count--;
release(*tls->pool->insert);
}
}
@ -405,7 +401,6 @@ static inline id autorelease(id obj)
pool->insert = pool->pool;
tls->pool = pool;
}
count++;
*pool->insert = obj;
pool->insert++;
return obj;

@ -419,7 +419,10 @@ void method_getArgumentType(Method method,
const char *types = findParameterStart(method_getTypeEncoding(method), index);
if (NULL == types)
{
strncpy(dst, "", dst_len);
if (dst_len > 0)
{
*dst = '\0';
}
return;
}
size_t length = lengthOfTypeEncoding(types);

@ -14,7 +14,6 @@ ptrdiff_t objc_sizeof_type(const char *);
PRIVATE void objc_compute_ivar_offsets(Class class)
{
struct objc_ivar_list_legacy *legacy = NULL;
if (class->ivars == NULL)
{
Class super_class = class_getSuperclass(class);
@ -47,7 +46,6 @@ PRIVATE void objc_compute_ivar_offsets(Class class)
}
ivar_start = super->instance_size;
}
long class_size = 0 - class->instance_size;
class->instance_size = ivar_start;
/* For each instance variable, we add the offset if required (it will be zero
* if this class is compiled with a static ivar layout). We then set the

@ -180,7 +180,7 @@ struct objc_ivar_list
* `objc_ivar` structs, which have fields appended that this version of the
* runtime does not know about.
*/
static struct objc_ivar *ivar_at_index(struct objc_ivar_list *l, int i)
static inline struct objc_ivar *ivar_at_index(struct objc_ivar_list *l, int i)
{
assert(l->size >= sizeof(struct objc_ivar));
return (struct objc_ivar*)(((char*)l->ivar_list) + (i * l->size));

@ -231,7 +231,6 @@ OBJC_PUBLIC void __objc_load(struct objc_init *init)
}
objc_register_selector(sel);
}
int i = 0;
for (struct objc_protocol *proto = init->proto_begin ; proto < init->proto_end ;
proto++)
{

@ -77,7 +77,7 @@ struct objc_method_list
* `objc_method` structs, which have fields appended that this version of the
* runtime does not know about.
*/
static struct objc_method *method_at_index(struct objc_method_list *l, int i)
static inline struct objc_method *method_at_index(struct objc_method_list *l, int i)
{
assert(l->size >= sizeof(struct objc_method));
return (struct objc_method*)(((char*)l->methods) + (i * l->size));

@ -217,7 +217,7 @@ struct objc_property_list
* `objc_property` structs, which have fields appended that this version of the
* runtime does not know about.
*/
static struct objc_property *property_at_index(struct objc_property_list *l, int i)
static inline struct objc_property *property_at_index(struct objc_property_list *l, int i)
{
assert(l->size >= sizeof(struct objc_property));
return (struct objc_property*)(((char*)l->properties) + (i * l->size));

@ -705,7 +705,6 @@ void protocol_addProperty(Protocol *aProtocol,
}
struct objc_property_list *list = *listPtr;
int index = list->count-1;
const char *iVarName = NULL;
struct objc_property p = propertyFromAttrs(attributes, attributeCount, name);
assert(list->size == sizeof(p));
memcpy(&(list->properties[index]), &p, sizeof(p));

@ -79,7 +79,7 @@ struct objc_protocol_method_description_list
* array of some future version of these structs, which have fields appended
* that this version of the runtime does not know about.
*/
static struct objc_protocol_method_description *
static inline struct objc_protocol_method_description *
protocol_method_at_index(struct objc_protocol_method_description_list *l, int i)
{
assert(l->size >= sizeof(struct objc_protocol_method_description));

@ -782,7 +782,6 @@ void *object_getIndexedIvars(id obj)
size_t size = classForObject(obj)->instance_size;
if ((0 == size) && class_isMetaClass(classForObject(obj)))
{
Class cls = (Class)obj;
size = sizeof(struct objc_class);
}
return ((char*)obj) + size;

Loading…
Cancel
Save