1998-09-21 03:22:07 +02:00
|
|
|
/* Basic data types for Objective C.
|
2009-04-09 17:00:19 +02:00
|
|
|
Copyright (C) 1998, 2002, 2004, 2005, 2006, 2009 Free Software Foundation, Inc.
|
1998-09-21 03:22:07 +02:00
|
|
|
Contributed by Ovidiu Predescu.
|
|
|
|
|
Makefile.in, [...]: Replace "GNU CC" with "GCC".
2003-05-23 Nathanael Nerode <neroden@gcc.gnu.org>
* Makefile.in, NXConstStr.m, Object.m, Protocol.m, archive.c,
class.c, encoding.c, gc.c, objc/NXConstStr.h, objc/Object.h,
objc/Protocol.h, objc/encoding.h, objc/hash.h, objc/objc-api.h,
objc/objc-list.h, objc/objc.h, ocjc/runtime.h, objc/sarray.h,
objc/thr.h, objc/typedstream.h: Replace "GNU CC" with "GCC".
From-SVN: r67131
2003-05-23 22:04:58 +02:00
|
|
|
This file is part of GCC.
|
1998-09-21 03:22:07 +02:00
|
|
|
|
Makefile.in, [...]: Replace "GNU CC" with "GCC".
2003-05-23 Nathanael Nerode <neroden@gcc.gnu.org>
* Makefile.in, NXConstStr.m, Object.m, Protocol.m, archive.c,
class.c, encoding.c, gc.c, objc/NXConstStr.h, objc/Object.h,
objc/Protocol.h, objc/encoding.h, objc/hash.h, objc/objc-api.h,
objc/objc-list.h, objc/objc.h, ocjc/runtime.h, objc/sarray.h,
objc/thr.h, objc/typedstream.h: Replace "GNU CC" with "GCC".
From-SVN: r67131
2003-05-23 22:04:58 +02:00
|
|
|
GCC is free software; you can redistribute it and/or modify
|
1998-09-21 03:22:07 +02:00
|
|
|
it under the terms of the GNU General Public License as published by
|
2009-04-09 17:00:19 +02:00
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
1998-09-21 03:22:07 +02:00
|
|
|
any later version.
|
|
|
|
|
Makefile.in, [...]: Replace "GNU CC" with "GCC".
2003-05-23 Nathanael Nerode <neroden@gcc.gnu.org>
* Makefile.in, NXConstStr.m, Object.m, Protocol.m, archive.c,
class.c, encoding.c, gc.c, objc/NXConstStr.h, objc/Object.h,
objc/Protocol.h, objc/encoding.h, objc/hash.h, objc/objc-api.h,
objc/objc-list.h, objc/objc.h, ocjc/runtime.h, objc/sarray.h,
objc/thr.h, objc/typedstream.h: Replace "GNU CC" with "GCC".
From-SVN: r67131
2003-05-23 22:04:58 +02:00
|
|
|
GCC is distributed in the hope that it will be useful,
|
1998-09-21 03:22:07 +02:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
2009-04-09 17:00:19 +02:00
|
|
|
Under Section 7 of GPL version 3, you are granted additional
|
|
|
|
permissions described in the GCC Runtime Library Exception, version
|
|
|
|
3.1, as published by the Free Software Foundation.
|
1998-09-21 03:22:07 +02:00
|
|
|
|
2009-04-09 17:00:19 +02:00
|
|
|
You should have received a copy of the GNU General Public License and
|
|
|
|
a copy of the GCC Runtime Library Exception along with this program;
|
|
|
|
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
1998-09-21 03:22:07 +02:00
|
|
|
|
2010-09-12 00:47:14 +02:00
|
|
|
#include "objc-private/common.h"
|
1998-09-30 04:13:15 +02:00
|
|
|
#include "tconfig.h"
|
archive.c, [...]: Include hash.h.
2005-06-07 David Ayers <d.ayers@inode.at>
* archive.c, init.c, selector.c: Include hash.h.
* archive.c, class.c, encoding.c, gc.c, hash.c, hash_compat.c,
init.c, misc.c, nil_method.c, objects.c, sarray.c, selector.c,
sendmsg.c, thr-dce.c, thr-decosf1.c, thr-irix.c, thr-mach.c,
thr-objc.c, thr-os2.c, thr-posix.c, thr-pthreads.c, thr-rtems.c,
thr-single.c, thr-solaris.c, thr-vxworks.c, thr-win32.c, thr.c:
Include Objective-C headers with quotes and objc/ directory
prefix.
From-SVN: r100723
2005-06-07 23:04:19 +02:00
|
|
|
#include "objc/objc.h"
|
|
|
|
#include "objc/encoding.h"
|
1998-09-21 03:22:07 +02:00
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <string.h>
|
2004-12-20 23:32:39 +01:00
|
|
|
#include <stdlib.h>
|
1998-09-21 03:22:07 +02:00
|
|
|
|
|
|
|
#if OBJC_WITH_GC
|
|
|
|
|
|
|
|
#include <gc.h>
|
2004-12-20 23:32:39 +01:00
|
|
|
#include <limits.h>
|
1998-09-21 03:22:07 +02:00
|
|
|
|
|
|
|
/* gc_typed.h uses the following but doesn't declare them */
|
|
|
|
typedef GC_word word;
|
|
|
|
typedef GC_signed_word signed_word;
|
2004-12-20 23:32:39 +01:00
|
|
|
#define BITS_PER_WORD (CHAR_BIT * sizeof (word))
|
1998-09-21 03:22:07 +02:00
|
|
|
|
|
|
|
#include <gc_typed.h>
|
|
|
|
|
|
|
|
/* The following functions set up in `mask` the corresponding pointers.
|
|
|
|
The offset is incremented with the size of the type. */
|
|
|
|
|
|
|
|
#define ROUND(V, A) \
|
2002-07-02 21:43:03 +02:00
|
|
|
({ typeof (V) __v = (V); typeof (A) __a = (A); \
|
|
|
|
__a * ((__v+__a - 1)/__a); })
|
1998-09-21 03:22:07 +02:00
|
|
|
|
|
|
|
#define SET_BIT_FOR_OFFSET(mask, offset) \
|
2002-07-02 21:43:03 +02:00
|
|
|
GC_set_bit (mask, offset / sizeof (void *))
|
1998-09-21 03:22:07 +02:00
|
|
|
|
|
|
|
/* Some prototypes */
|
|
|
|
static void
|
|
|
|
__objc_gc_setup_struct (GC_bitmap mask, const char *type, int offset);
|
|
|
|
static void
|
|
|
|
__objc_gc_setup_union (GC_bitmap mask, const char *type, int offset);
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
__objc_gc_setup_array (GC_bitmap mask, const char *type, int offset)
|
|
|
|
{
|
2002-07-02 21:43:03 +02:00
|
|
|
int i, len = atoi (type + 1);
|
1998-09-21 03:22:07 +02:00
|
|
|
|
2002-07-02 21:43:03 +02:00
|
|
|
while (isdigit (*++type))
|
1998-09-21 03:22:07 +02:00
|
|
|
/* do nothing */; /* skip the size of the array */
|
|
|
|
|
|
|
|
switch (*type) {
|
|
|
|
case _C_ARY_B:
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
__objc_gc_setup_array (mask, type, offset);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case _C_STRUCT_B:
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
__objc_gc_setup_struct (mask, type, offset);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case _C_UNION_B:
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
__objc_gc_setup_union (mask, type, offset);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
__objc_gc_setup_struct (GC_bitmap mask, const char *type, int offset)
|
|
|
|
{
|
|
|
|
struct objc_struct_layout layout;
|
|
|
|
unsigned int position;
|
|
|
|
const char *mtype;
|
|
|
|
|
|
|
|
objc_layout_structure (type, &layout);
|
|
|
|
|
|
|
|
while (objc_layout_structure_next_member (&layout))
|
|
|
|
{
|
|
|
|
BOOL gc_invisible = NO;
|
|
|
|
|
|
|
|
objc_layout_structure_get_info (&layout, &position, NULL, &mtype);
|
|
|
|
|
|
|
|
/* Skip the variable name */
|
|
|
|
if (*mtype == '"')
|
|
|
|
{
|
|
|
|
for (mtype++; *mtype++ != '"';)
|
|
|
|
/* do nothing */;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*mtype == _C_GCINVISIBLE)
|
|
|
|
{
|
|
|
|
gc_invisible = YES;
|
|
|
|
mtype++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Add to position the offset of this structure */
|
|
|
|
position += offset;
|
|
|
|
|
|
|
|
switch (*mtype) {
|
|
|
|
case _C_ID:
|
|
|
|
case _C_CLASS:
|
|
|
|
case _C_SEL:
|
|
|
|
case _C_PTR:
|
|
|
|
case _C_CHARPTR:
|
|
|
|
case _C_ATOM:
|
2002-07-02 21:43:03 +02:00
|
|
|
if (! gc_invisible)
|
|
|
|
SET_BIT_FOR_OFFSET (mask, position);
|
1998-09-21 03:22:07 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case _C_ARY_B:
|
|
|
|
__objc_gc_setup_array (mask, mtype, position);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case _C_STRUCT_B:
|
|
|
|
__objc_gc_setup_struct (mask, mtype, position);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case _C_UNION_B:
|
|
|
|
__objc_gc_setup_union (mask, mtype, position);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
__objc_gc_setup_union (GC_bitmap mask, const char *type, int offset)
|
|
|
|
{
|
|
|
|
/* Sub-optimal, quick implementation: assume the union is made of
|
|
|
|
pointers, set up the mask accordingly. */
|
|
|
|
|
|
|
|
int i, size, align;
|
|
|
|
|
|
|
|
/* Skip the variable name */
|
|
|
|
if (*type == '"')
|
|
|
|
{
|
|
|
|
for (type++; *type++ != '"';)
|
|
|
|
/* do nothing */;
|
|
|
|
}
|
|
|
|
|
|
|
|
size = objc_sizeof_type (type);
|
|
|
|
align = objc_alignof_type (type);
|
|
|
|
|
2002-07-02 21:43:03 +02:00
|
|
|
offset = ROUND (offset, align);
|
|
|
|
for (i = 0; i < size; i += sizeof (void *))
|
1998-09-21 03:22:07 +02:00
|
|
|
{
|
2002-07-02 21:43:03 +02:00
|
|
|
SET_BIT_FOR_OFFSET (mask, offset);
|
|
|
|
offset += sizeof (void *);
|
1998-09-21 03:22:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Iterates over the types in the structure that represents the class
|
|
|
|
encoding and sets the bits in mask according to each ivar type. */
|
|
|
|
static void
|
|
|
|
__objc_gc_type_description_from_type (GC_bitmap mask, const char *type)
|
|
|
|
{
|
|
|
|
struct objc_struct_layout layout;
|
|
|
|
unsigned int offset, align;
|
|
|
|
const char *ivar_type;
|
|
|
|
|
|
|
|
objc_layout_structure (type, &layout);
|
|
|
|
|
|
|
|
while (objc_layout_structure_next_member (&layout))
|
|
|
|
{
|
|
|
|
BOOL gc_invisible = NO;
|
|
|
|
|
|
|
|
objc_layout_structure_get_info (&layout, &offset, &align, &ivar_type);
|
|
|
|
|
|
|
|
/* Skip the variable name */
|
|
|
|
if (*ivar_type == '"')
|
|
|
|
{
|
|
|
|
for (ivar_type++; *ivar_type++ != '"';)
|
|
|
|
/* do nothing */;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*ivar_type == _C_GCINVISIBLE)
|
|
|
|
{
|
|
|
|
gc_invisible = YES;
|
|
|
|
ivar_type++;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (*ivar_type) {
|
|
|
|
case _C_ID:
|
|
|
|
case _C_CLASS:
|
|
|
|
case _C_SEL:
|
|
|
|
case _C_PTR:
|
|
|
|
case _C_CHARPTR:
|
2002-07-02 21:43:03 +02:00
|
|
|
if (! gc_invisible)
|
|
|
|
SET_BIT_FOR_OFFSET (mask, offset);
|
1998-09-21 03:22:07 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case _C_ARY_B:
|
|
|
|
__objc_gc_setup_array (mask, ivar_type, offset);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case _C_STRUCT_B:
|
|
|
|
__objc_gc_setup_struct (mask, ivar_type, offset);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case _C_UNION_B:
|
|
|
|
__objc_gc_setup_union (mask, ivar_type, offset);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Computes in *type the full type encoding of this class including
|
|
|
|
its super classes. '*size' gives the total number of bytes allocated
|
|
|
|
into *type, '*current' the number of bytes used so far by the
|
|
|
|
encoding. */
|
|
|
|
static void
|
|
|
|
__objc_class_structure_encoding (Class class, char **type, int *size,
|
|
|
|
int *current)
|
|
|
|
{
|
|
|
|
int i, ivar_count;
|
2002-07-02 21:43:03 +02:00
|
|
|
struct objc_ivar_list *ivars;
|
1998-09-21 03:22:07 +02:00
|
|
|
|
2002-07-02 21:43:03 +02:00
|
|
|
if (! class)
|
1998-09-21 03:22:07 +02:00
|
|
|
{
|
|
|
|
strcat (*type, "{");
|
2006-01-24 22:57:22 +01:00
|
|
|
(*current)++;
|
1998-09-21 03:22:07 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Add the type encodings of the super classes */
|
|
|
|
__objc_class_structure_encoding (class->super_class, type, size, current);
|
|
|
|
|
|
|
|
ivars = class->ivars;
|
2002-07-02 21:43:03 +02:00
|
|
|
if (! ivars)
|
1998-09-21 03:22:07 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
ivar_count = ivars->ivar_count;
|
|
|
|
|
|
|
|
for (i = 0; i < ivar_count; i++)
|
|
|
|
{
|
|
|
|
struct objc_ivar *ivar = &(ivars->ivar_list[i]);
|
|
|
|
const char *ivar_type = ivar->ivar_type;
|
|
|
|
int len = strlen (ivar_type);
|
|
|
|
|
|
|
|
if (*current + len + 1 >= *size)
|
|
|
|
{
|
|
|
|
/* Increase the size of the encoding string so that it
|
|
|
|
contains this ivar's type. */
|
2002-07-02 21:43:03 +02:00
|
|
|
*size = ROUND (*current + len + 1, 10);
|
1998-09-21 03:22:07 +02:00
|
|
|
*type = objc_realloc (*type, *size);
|
|
|
|
}
|
|
|
|
strcat (*type + *current, ivar_type);
|
|
|
|
*current += len;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Allocates the memory that will hold the type description for class
|
|
|
|
and calls the __objc_class_structure_encoding that generates this
|
|
|
|
value. */
|
|
|
|
void
|
|
|
|
__objc_generate_gc_type_description (Class class)
|
|
|
|
{
|
|
|
|
GC_bitmap mask;
|
|
|
|
int bits_no, size;
|
|
|
|
int type_size = 10, current;
|
|
|
|
char *class_structure_type;
|
|
|
|
|
2002-07-02 21:43:03 +02:00
|
|
|
if (! CLS_ISCLASS (class))
|
1998-09-21 03:22:07 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* We have to create a mask in which each bit counts for a pointer member.
|
|
|
|
We take into consideration all the non-pointer instance variables and we
|
|
|
|
round them up to the alignment. */
|
|
|
|
|
|
|
|
/* The number of bits in the mask is the size of an instance in bytes divided
|
|
|
|
by the size of a pointer. */
|
2002-07-02 21:43:03 +02:00
|
|
|
bits_no = (ROUND (class_get_instance_size (class), sizeof (void *))
|
|
|
|
/ sizeof (void *));
|
|
|
|
size = ROUND (bits_no, BITS_PER_WORD) / BITS_PER_WORD;
|
1998-09-21 03:22:07 +02:00
|
|
|
mask = objc_atomic_malloc (size * sizeof (int));
|
|
|
|
memset (mask, 0, size * sizeof (int));
|
|
|
|
|
|
|
|
class_structure_type = objc_atomic_malloc (type_size);
|
|
|
|
*class_structure_type = current = 0;
|
|
|
|
__objc_class_structure_encoding (class, &class_structure_type,
|
|
|
|
&type_size, ¤t);
|
|
|
|
if (current + 1 == type_size)
|
|
|
|
class_structure_type = objc_realloc (class_structure_type, ++type_size);
|
|
|
|
strcat (class_structure_type + current, "}");
|
2001-09-10 18:22:42 +02:00
|
|
|
#ifdef DEBUG
|
|
|
|
printf ("type description for '%s' is %s\n", class->name, class_structure_type);
|
|
|
|
#endif
|
1998-09-21 03:22:07 +02:00
|
|
|
|
|
|
|
__objc_gc_type_description_from_type (mask, class_structure_type);
|
|
|
|
objc_free (class_structure_type);
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
printf (" mask for '%s', type '%s' (bits %d, mask size %d) is:",
|
|
|
|
class_structure_type, class->name, bits_no, size);
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < size; i++)
|
|
|
|
printf (" %lx", mask[i]);
|
|
|
|
}
|
|
|
|
puts ("");
|
|
|
|
#endif
|
|
|
|
|
2002-07-02 21:43:03 +02:00
|
|
|
class->gc_object_type = (void *) GC_make_descriptor (mask, bits_no);
|
1998-09-21 03:22:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Returns YES if type denotes a pointer type, NO otherwise */
|
|
|
|
static inline BOOL
|
|
|
|
__objc_ivar_pointer (const char *type)
|
|
|
|
{
|
|
|
|
type = objc_skip_type_qualifiers (type);
|
|
|
|
|
|
|
|
return (*type == _C_ID
|
|
|
|
|| *type == _C_CLASS
|
|
|
|
|| *type == _C_SEL
|
|
|
|
|| *type == _C_PTR
|
|
|
|
|| *type == _C_CHARPTR
|
|
|
|
|| *type == _C_ATOM);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Mark the instance variable whose name is given by ivarname as a
|
|
|
|
weak pointer (a pointer hidden to the garbage collector) if
|
|
|
|
gc_invisible is true. If gc_invisible is false it unmarks the
|
|
|
|
instance variable and makes it a normal pointer, visible to the
|
|
|
|
garbage collector.
|
|
|
|
|
|
|
|
This operation only makes sense on instance variables that are
|
|
|
|
pointers. */
|
|
|
|
void
|
2002-07-02 21:43:03 +02:00
|
|
|
class_ivar_set_gcinvisible (Class class, const char *ivarname,
|
1998-09-21 03:22:07 +02:00
|
|
|
BOOL gc_invisible)
|
|
|
|
{
|
|
|
|
int i, ivar_count;
|
2002-07-02 21:43:03 +02:00
|
|
|
struct objc_ivar_list *ivars;
|
1998-09-21 03:22:07 +02:00
|
|
|
|
2002-07-02 21:43:03 +02:00
|
|
|
if (! class || ! ivarname)
|
1998-09-21 03:22:07 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
ivars = class->ivars;
|
2002-07-02 21:43:03 +02:00
|
|
|
if (! ivars)
|
1998-09-21 03:22:07 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
ivar_count = ivars->ivar_count;
|
|
|
|
|
|
|
|
for (i = 0; i < ivar_count; i++)
|
|
|
|
{
|
|
|
|
struct objc_ivar *ivar = &(ivars->ivar_list[i]);
|
|
|
|
const char *type;
|
|
|
|
|
2002-07-02 21:43:03 +02:00
|
|
|
if (! ivar->ivar_name || strcmp (ivar->ivar_name, ivarname))
|
1998-09-21 03:22:07 +02:00
|
|
|
continue;
|
|
|
|
|
|
|
|
assert (ivar->ivar_type);
|
|
|
|
type = ivar->ivar_type;
|
|
|
|
|
|
|
|
/* Skip the variable name */
|
|
|
|
if (*type == '"')
|
|
|
|
{
|
|
|
|
for (type++; *type++ != '"';)
|
|
|
|
/* do nothing */;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*type == _C_GCINVISIBLE)
|
|
|
|
{
|
|
|
|
char *new_type;
|
2006-01-25 00:37:24 +01:00
|
|
|
size_t len;
|
1998-09-21 03:22:07 +02:00
|
|
|
|
2002-07-02 21:43:03 +02:00
|
|
|
if (gc_invisible || ! __objc_ivar_pointer (type))
|
1998-09-21 03:22:07 +02:00
|
|
|
return; /* The type of the variable already matches the
|
|
|
|
requested gc_invisible type */
|
|
|
|
|
2006-01-25 00:37:24 +01:00
|
|
|
/* The variable is gc_invisible so we make it gc visible. */
|
|
|
|
new_type = objc_atomic_malloc (strlen(ivar->ivar_type));
|
|
|
|
len = (type - ivar->ivar_type);
|
|
|
|
memcpy (new_type, ivar->ivar_type, len);
|
|
|
|
new_type[len] = 0;
|
1998-09-21 03:22:07 +02:00
|
|
|
strcat (new_type, type + 1);
|
|
|
|
ivar->ivar_type = new_type;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char *new_type;
|
2006-01-25 00:37:24 +01:00
|
|
|
size_t len;
|
1998-09-21 03:22:07 +02:00
|
|
|
|
2002-07-02 21:43:03 +02:00
|
|
|
if (! gc_invisible || ! __objc_ivar_pointer (type))
|
1998-09-21 03:22:07 +02:00
|
|
|
return; /* The type of the variable already matches the
|
|
|
|
requested gc_invisible type */
|
|
|
|
|
2006-01-25 00:37:24 +01:00
|
|
|
/* The variable is gc visible so we make it gc_invisible. */
|
|
|
|
new_type = objc_malloc (strlen(ivar->ivar_type) + 2);
|
|
|
|
len = (type - ivar->ivar_type);
|
|
|
|
memcpy (new_type, ivar->ivar_type, len);
|
|
|
|
new_type[len] = 0;
|
1998-09-21 03:22:07 +02:00
|
|
|
strcat (new_type, "!");
|
|
|
|
strcat (new_type, type);
|
|
|
|
ivar->ivar_type = new_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
__objc_generate_gc_type_description (class);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Search the instance variable in the superclasses */
|
|
|
|
class_ivar_set_gcinvisible (class->super_class, ivarname, gc_invisible);
|
|
|
|
}
|
|
|
|
|
|
|
|
#else /* !OBJC_WITH_GC */
|
|
|
|
|
|
|
|
void
|
Object.m: Fix signed/unsigned warning.
* Object.m: Fix signed/unsigned warning.
* Protocol.m: Likewise.
* archive.c: Always include stdlib.h.
(objc_read_short, objc_read_unsigned_short, objc_read_int,
objc_read_long, __objc_read_nbyte_uint, __objc_read_nbyte_ulong):
Fix signed/unsigned warning.
(objc_write_type, objc_read_type, objc_write_types,
objc_read_types): Ensure ctype 8-bit safety.
(__objc_no_write, __objc_no_read): Mark unused parameters.
* class.c (class_table_setup): Specify void arg.
* encoding.c (atoi, objc_sizeof_type, objc_alignof_type,
objc_skip_typespec, objc_skip_offset,
objc_layout_structure_next_member): Ensure ctype 8-bit safety.
(objc_layout_structure_next_member): Ensure variables are
initialized.
* gc.c (__objc_generate_gc_type_description,
class_ivar_set_gcinvisible): Mark unused parameters.
* init.c (__objc_send_load, __objc_destroy_class_tree_node): Mark
unused parameters.
(__objc_init_protocols) Fix signed/unsigned warning.
* nil_method.c (nil_method): Mark unused parameters.
* thr.h (objc_thread_callback): Specify void arg.
* sarray.c (sarray_new, sarray_realloc, sarray_free): Fix
signed/unsigned warning.
(sarray_free): Fix formatting.
* selector.c (sel_types_match): Ensure ctype 8-bit safety.
* sendmsg.c (__objc_init_install_dtable) Mark unused parameters.
From-SVN: r54649
2002-06-15 19:50:14 +02:00
|
|
|
__objc_generate_gc_type_description (Class class __attribute__ ((__unused__)))
|
1998-09-21 03:22:07 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
Object.m: Fix signed/unsigned warning.
* Object.m: Fix signed/unsigned warning.
* Protocol.m: Likewise.
* archive.c: Always include stdlib.h.
(objc_read_short, objc_read_unsigned_short, objc_read_int,
objc_read_long, __objc_read_nbyte_uint, __objc_read_nbyte_ulong):
Fix signed/unsigned warning.
(objc_write_type, objc_read_type, objc_write_types,
objc_read_types): Ensure ctype 8-bit safety.
(__objc_no_write, __objc_no_read): Mark unused parameters.
* class.c (class_table_setup): Specify void arg.
* encoding.c (atoi, objc_sizeof_type, objc_alignof_type,
objc_skip_typespec, objc_skip_offset,
objc_layout_structure_next_member): Ensure ctype 8-bit safety.
(objc_layout_structure_next_member): Ensure variables are
initialized.
* gc.c (__objc_generate_gc_type_description,
class_ivar_set_gcinvisible): Mark unused parameters.
* init.c (__objc_send_load, __objc_destroy_class_tree_node): Mark
unused parameters.
(__objc_init_protocols) Fix signed/unsigned warning.
* nil_method.c (nil_method): Mark unused parameters.
* thr.h (objc_thread_callback): Specify void arg.
* sarray.c (sarray_new, sarray_realloc, sarray_free): Fix
signed/unsigned warning.
(sarray_free): Fix formatting.
* selector.c (sel_types_match): Ensure ctype 8-bit safety.
* sendmsg.c (__objc_init_install_dtable) Mark unused parameters.
From-SVN: r54649
2002-06-15 19:50:14 +02:00
|
|
|
void class_ivar_set_gcinvisible (Class class __attribute__ ((__unused__)),
|
2002-07-02 21:43:03 +02:00
|
|
|
const char *ivarname __attribute__ ((__unused__)),
|
Object.m: Fix signed/unsigned warning.
* Object.m: Fix signed/unsigned warning.
* Protocol.m: Likewise.
* archive.c: Always include stdlib.h.
(objc_read_short, objc_read_unsigned_short, objc_read_int,
objc_read_long, __objc_read_nbyte_uint, __objc_read_nbyte_ulong):
Fix signed/unsigned warning.
(objc_write_type, objc_read_type, objc_write_types,
objc_read_types): Ensure ctype 8-bit safety.
(__objc_no_write, __objc_no_read): Mark unused parameters.
* class.c (class_table_setup): Specify void arg.
* encoding.c (atoi, objc_sizeof_type, objc_alignof_type,
objc_skip_typespec, objc_skip_offset,
objc_layout_structure_next_member): Ensure ctype 8-bit safety.
(objc_layout_structure_next_member): Ensure variables are
initialized.
* gc.c (__objc_generate_gc_type_description,
class_ivar_set_gcinvisible): Mark unused parameters.
* init.c (__objc_send_load, __objc_destroy_class_tree_node): Mark
unused parameters.
(__objc_init_protocols) Fix signed/unsigned warning.
* nil_method.c (nil_method): Mark unused parameters.
* thr.h (objc_thread_callback): Specify void arg.
* sarray.c (sarray_new, sarray_realloc, sarray_free): Fix
signed/unsigned warning.
(sarray_free): Fix formatting.
* selector.c (sel_types_match): Ensure ctype 8-bit safety.
* sendmsg.c (__objc_init_install_dtable) Mark unused parameters.
From-SVN: r54649
2002-06-15 19:50:14 +02:00
|
|
|
BOOL gc_invisible __attribute__ ((__unused__)))
|
1998-09-21 03:22:07 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* OBJC_WITH_GC */
|