ARC-compatibility tweaks in the headers. ARC will not track objects inside structures and rejects code that uses object types that are not __unsafe_unretained qualified inside structures.

This quick fix just added this type qualifier on all such structures.  Several of these should probably not be in headers at all.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33403 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
David Chisnall 2011-06-29 11:50:26 +00:00
parent 3f83dabfaa
commit 3f4dc9a72b
5 changed files with 21 additions and 12 deletions

View file

@ -53,7 +53,7 @@ typedef struct autorelease_thread_vars
/* The current, default NSAutoreleasePool for the calling thread;
the one that will hold objects that are arguments to
[NSAutoreleasePool +addObject:]. */
NSAutoreleasePool *current_pool;
__unsafe_unretained NSAutoreleasePool *current_pool;
/* The total number of objects autoreleased since the thread was
started, or since -resetTotalAutoreleasedObjects was called
@ -62,7 +62,7 @@ typedef struct autorelease_thread_vars
/* A cache of NSAutoreleasePool's already alloc'ed. Caching old pools
instead of deallocating and re-allocating them will save time. */
id *pool_cache;
__unsafe_unretained id *pool_cache;
int pool_cache_size;
int pool_cache_count;
} thread_vars_struct;
@ -92,7 +92,7 @@ typedef struct autorelease_array_list
struct autorelease_array_list *next;
unsigned size;
unsigned count;
id objects[0];
__unsafe_unretained id objects[0];
} array_list_struct;

View file

@ -37,7 +37,7 @@ extern "C" {
typedef struct
{
unsigned long state;
id *itemsPtr;
__unsafe_unretained id *itemsPtr;
unsigned long *mutationsPtr;
unsigned long extra[5];
} NSFastEnumerationState;

View file

@ -263,7 +263,7 @@ typedef struct _NSHandler
{
jmp_buf jumpState; /* place to longjmp to */
struct _NSHandler *next; /* ptr to next handler */
NSException *exception;
__unsafe_unretained NSException *exception;
} NSHandler;
/**

View file

@ -74,7 +74,7 @@ struct _NSZone
struct NSZoneStats (*stats)(struct _NSZone *zone);
size_t gran; // Zone granularity
NSString *name; // Name of zone (default is 'nil')
__unsafe_unretained NSString *name; // Name of zone (default is 'nil')
NSZone *next;
};

View file

@ -239,12 +239,21 @@
#include <stdint.h>
#endif
#if __OBJC_GC__
#define __strong __attribute__((objc_gc(strong)))
#define __weak __attribute__((objc_gc(weak)))
#else
#define __strong
#define __weak
#if !__has_feature(objc_arc)
# if __OBJC_GC__
# define __strong __attribute__((objc_gc(strong)))
# define __weak __attribute__((objc_gc(weak)))
# else
# define __strong
# define __weak
# endif
#endif
#ifndef __unsafe_unretained
# if !__has_feature(objc_arc)
# define __unsafe_unretained
# endif
#endif
#endif /* __preface_h_OBJECTS_INCLUDE */