encoding.h: Fix formatting.

2002-07-02  Rodney Brown  <rbrown64@csc.com.au>

	* objc/encoding.h: Fix formatting.
	* objc/hash.h: Likewise.
	* objc/objc-api.h: Likewise.
	* objc/runtime.h: Likewise.
	* objc/thr.h: Likewise.
	* archive.c: Likewise.
	* class.c: Likewise.
	* encoding.c: Likewise.
	* gc.c: Likewise.
	* hash.c: Likewise.
	* init.c: Likewise.
	* misc.c: Likewise.
	* nil_method.c: Likewise.
	* objects.c: Likewise.
	* sarray.c: Likewise.
	* selector.c: Likewise.
	* sendmsg.c: Likewise.
	* thr-mach.c: Likewise.
	* thr.c: Likewise.

From-SVN: r55190
This commit is contained in:
Rodney Brown 2002-07-02 19:43:03 +00:00 committed by Stan Shebs
parent 52702ae16e
commit 40165636b5
18 changed files with 1371 additions and 1311 deletions

View File

@ -1,3 +1,25 @@
2002-07-02 Rodney Brown <rbrown64@csc.com.au>
* objc/encoding.h: Fix formatting.
* objc/hash.h: Likewise.
* objc/objc-api.h: Likewise.
* objc/runtime.h: Likewise.
* objc/thr.h: Likewise.
* archive.c: Likewise.
* class.c: Likewise.
* encoding.c: Likewise.
* gc.c: Likewise.
* hash.c: Likewise.
* init.c: Likewise.
* misc.c: Likewise.
* nil_method.c: Likewise.
* objects.c: Likewise.
* sarray.c: Likewise.
* selector.c: Likewise.
* sendmsg.c: Likewise.
* thr-mach.c: Likewise.
* thr.c: Likewise.
2002-06-25 DJ Delorie <dj@redhat.com>
* aclocal.m4 (GLIBCPP_CONFIGURE): Split out

View File

@ -1,5 +1,5 @@
/* GNU Objective C Runtime archiving
Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1993, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup
This file is part of GNU CC.
@ -908,7 +908,7 @@ objc_read_class (struct objc_typed_stream* stream, Class* class)
if (key)
objc_error (nil, OBJC_ERR_BAD_KEY, "cannot register use upcode...");
len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
(*class) = hash_value_for_key (stream->stream_table, LONG2PTR(key));
*class = hash_value_for_key (stream->stream_table, LONG2PTR(key));
if (! *class)
objc_error (nil, OBJC_ERR_BAD_CLASS,
"cannot find class for key %lu", key);
@ -1031,7 +1031,8 @@ objc_write_type(TypedStream* stream, const char* type, const void* data)
break;
case _C_CHARPTR:
return objc_write_string (stream, *(char**)data, strlen(*(char**)data));
return objc_write_string (stream,
*(char **) data, strlen (*(char **) data));
break;
case _C_ATOM:

View File

@ -1,5 +1,6 @@
/* GNU Objective C Runtime class related functions
Copyright (C) 1993, 1995, 1996, 1997, 2001 Free Software Foundation, Inc.
Copyright (C) 1993, 1995, 1996, 1997, 2001, 2002
Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup and Dennis Glatting.
Lock-free class table code designed and written from scratch by
@ -339,7 +340,7 @@ class_table_next (struct class_table_enumerator **e)
#if 0 /* DEBUGGING FUNCTIONS */
/* Debugging function - print the class table. */
void
class_table_print ()
class_table_print (void)
{
int i;
@ -362,7 +363,7 @@ class_table_print ()
function of hash key values. Useful to evaluate the hash function
in real cases. */
void
class_table_print_histogram ()
class_table_print_histogram (void)
{
int i, j;
int counter = 0;
@ -415,7 +416,8 @@ Class (*_objc_lookup_class)(const char* name) = 0; /* !T:SAFE */
BOOL __objc_class_links_resolved = NO; /* !T:UNUSED */
void __objc_init_class_tables()
void
__objc_init_class_tables (void)
{
/* Allocate the class hash table. */
@ -465,7 +467,8 @@ __objc_add_class_to_hash(Class class)
/* Get the class object for the class named NAME. If NAME does not
identify a known class, the hook _objc_lookup_class is called. If
this fails, nil is returned. */
Class objc_lookup_class (const char* name)
Class
objc_lookup_class (const char *name)
{
Class class;
@ -539,7 +542,8 @@ objc_next_class(void **enum_state)
/* Resolve super/subclass links for all classes. The only thing we
can be sure of is that the class_pointer for class objects point to
the right meta class objects. */
void __objc_resolve_class_links()
void
__objc_resolve_class_links (void)
{
struct class_table_enumerator *es = NULL;
Class object_class = objc_get_class ("Object");
@ -560,7 +564,7 @@ void __objc_resolve_class_links()
class. */
class1->class_pointer->class_pointer = object_class->class_pointer;
if (!(CLS_ISRESOLV(class1)))
if (! CLS_ISRESOLV (class1))
{
CLS_SETRESOLV (class1);
CLS_SETRESOLV (class1->class_pointer);

View File

@ -162,6 +162,7 @@ objc_sizeof_type (const char* type)
case _C_VOID:
return sizeof (void);
break;
case _C_PTR:
case _C_ATOM:
case _C_CHARPTR:
@ -171,7 +172,8 @@ objc_sizeof_type (const char* type)
case _C_ARY_B:
{
int len = atoi (type + 1);
while (isdigit((unsigned char)*++type));
while (isdigit ((unsigned char)*++type))
;
return len * objc_aligned_size (type);
}
break;
@ -183,7 +185,8 @@ objc_sizeof_type (const char* type)
int startByte, endByte;
position = atoi (type + 1);
while (isdigit ((unsigned char)*++type));
while (isdigit ((unsigned char)*++type))
;
size = atoi (type + 1);
startByte = position / BITS_PER_UNIT;
@ -207,7 +210,8 @@ objc_sizeof_type (const char* type)
case _C_UNION_B:
{
int max_size = 0;
while (*type != _C_UNION_E && *type++ != '=') /* do nothing */;
while (*type != _C_UNION_E && *type++ != '=')
/* do nothing */;
while (*type != _C_UNION_E)
{
/* Skip the variable name if any */
@ -312,7 +316,8 @@ objc_alignof_type(const char* type)
break;
case _C_ARY_B:
while (isdigit((unsigned char)*++type)) /* do nothing */;
while (isdigit ((unsigned char)*++type))
/* do nothing */;
return objc_alignof_type (type);
case _C_STRUCT_B:
@ -331,7 +336,8 @@ objc_alignof_type(const char* type)
case _C_UNION_B:
{
int maxalign = 0;
while (*type != _C_UNION_E && *type++ != '=') /* do nothing */;
while (*type != _C_UNION_E && *type++ != '=')
/* do nothing */;
while (*type != _C_UNION_E)
{
/* Skip the variable name if any */
@ -449,7 +455,8 @@ objc_skip_typespec (const char* type)
return type;
else
{
while (*++type != '"') /* do nothing */;
while (*++type != '"')
/* do nothing */;
return type + 1;
}
@ -478,7 +485,8 @@ objc_skip_typespec (const char* type)
case _C_ARY_B:
/* skip digits, typespec and closing ']' */
while(isdigit((unsigned char)*++type));
while (isdigit ((unsigned char)*++type))
;
type = objc_skip_typespec (type);
if (*type == _C_ARY_E)
return ++type;
@ -490,22 +498,32 @@ objc_skip_typespec (const char* type)
case _C_BFLD:
/* The new encoding of bitfields is: b 'position' 'type' 'size' */
while (isdigit ((unsigned char)*++type)); /* skip position */
while (isdigit ((unsigned char)*++type)); /* skip type and size */
while (isdigit ((unsigned char)*++type))
; /* skip position */
while (isdigit ((unsigned char)*++type))
; /* skip type and size */
return type;
case _C_STRUCT_B:
/* skip name, and elements until closing '}' */
while (*type != _C_STRUCT_E && *type++ != '=');
while (*type != _C_STRUCT_E) { type = objc_skip_typespec (type); }
while (*type != _C_STRUCT_E && *type++ != '=')
;
while (*type != _C_STRUCT_E)
{
type = objc_skip_typespec (type);
}
return ++type;
case _C_UNION_B:
/* skip name, and elements until closing ')' */
while (*type != _C_UNION_E && *type++ != '=');
while (*type != _C_UNION_E) { type = objc_skip_typespec (type); }
while (*type != _C_UNION_E && *type++ != '=')
;
while (*type != _C_UNION_E)
{
type = objc_skip_typespec (type);
}
return ++type;
case _C_PTR:
@ -528,8 +546,10 @@ objc_skip_typespec (const char* type)
inline const char *
objc_skip_offset (const char *type)
{
if (*type == '+') type++;
while(isdigit((unsigned char)*++type));
if (*type == '+')
type++;
while (isdigit ((unsigned char) *++type))
;
return type;
}
@ -598,8 +618,7 @@ method_get_sizeof_arguments (struct objc_method* mth)
*/
char *
method_get_next_argument (arglist_t argframe,
const char **type)
method_get_next_argument (arglist_t argframe, const char **type)
{
const char *t = objc_skip_argspec (*type);
@ -789,7 +808,9 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
{
desired_align = 1;
/* Skip the bitfield's offset */
for (bfld_type = type + 1; isdigit((unsigned char)*bfld_type); bfld_type++)
for (bfld_type = type + 1;
isdigit ((unsigned char) *bfld_type);
bfld_type++)
/* do nothing */;
bfld_type_size = objc_sizeof_type (bfld_type) * BITS_PER_UNIT;
@ -809,7 +830,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
is meaningless. */
#ifndef PCC_BITFIELD_TYPE_MATTERS
layout->record_align = MAX (layout->record_align, desired_align);
#else
#else /* PCC_BITFIELD_TYPE_MATTERS */
if (*type == _C_BFLD)
{
/* For these machines, a zero-length field does not
@ -841,7 +862,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
}
else
layout->record_align = MAX (layout->record_align, desired_align);
#endif
#endif /* PCC_BITFIELD_TYPE_MATTERS */
/* Does this field automatically have alignment it needs
by virtue of the fields that precede it and the record's

View File

@ -1,5 +1,5 @@
/* Basic data types for Objective C.
Copyright (C) 1998 Free Software Foundation, Inc.
Copyright (C) 1998, 2002 Free Software Foundation, Inc.
Contributed by Ovidiu Predescu.
This file is part of GNU CC.

View File

@ -1,5 +1,5 @@
/* GNU Objective C Runtime initialization
Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1993, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup
+load support contributed by Ovidiu Predescu <ovidiu@net-community.com>
@ -27,14 +27,14 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "runtime.h"
/* The version number of this runtime. This must match the number
defined in gcc (objc-act.c) */
defined in gcc (objc-act.c). */
#define OBJC_VERSION 8
#define PROTOCOL_VERSION 2
/* This list contains all modules currently loaded into the runtime */
/* This list contains all modules currently loaded into the runtime. */
static struct objc_list *__objc_module_list = 0; /* !T:MUTEX */
/* This list contains all proto_list's not yet assigned class links */
/* This list contains all proto_list's not yet assigned class links. */
static struct objc_list *unclaimed_proto_list = 0; /* !T:MUTEX */
/* List of unresolved static instances. */
@ -46,19 +46,19 @@ objc_mutex_t __objc_runtime_mutex = 0;
/* Number of threads that are alive. */
int __objc_runtime_threads_alive = 1; /* !T:MUTEX */
/* Check compiler vs runtime version */
/* Check compiler vs runtime version. */
static void init_check_module_version (Module_t);
/* Assign isa links to protos */
/* Assign isa links to protos. */
static void __objc_init_protocols (struct objc_protocol_list *protos);
/* Add protocol to class */
/* Add protocol to class. */
static void __objc_class_add_protocols (Class, struct objc_protocol_list *);
/* This is a hook which is called by __objc_exec_class every time a class
or a category is loaded into the runtime. This may e.g. help a
dynamic loader determine the classes that have been loaded when
an object file is dynamically linked in */
/* This is a hook which is called by __objc_exec_class every time a
class or a category is loaded into the runtime. This may e.g. help
a dynamic loader determine the classes that have been loaded when
an object file is dynamically linked in. */
void (*_objc_load_callback) (Class class, Category *category); /* !T:SAFE */
/* Is all categories/classes resolved? */
@ -72,11 +72,11 @@ __sel_register_typed_name (const char *name, const char *types,
static void objc_send_load (void);
/* Inserts all the classes defined in module in a tree of classes that
resembles the class hierarchy. This tree is traversed in preorder and the
classes in its nodes receive the +load message if these methods were not
executed before. The algorithm ensures that when the +load method of a class
is executed all the superclasses have been already received the +load
message. */
resembles the class hierarchy. This tree is traversed in preorder
and the classes in its nodes receive the +load message if these
methods were not executed before. The algorithm ensures that when
the +load method of a class is executed all the superclasses have
been already received the +load message. */
static void __objc_create_classes_tree (Module_t module);
static void __objc_call_callback (Module_t module);
@ -90,19 +90,21 @@ typedef struct objc_class_tree {
struct objc_list *subclasses; /* `head' is pointer to an objc_class_tree */
} objc_class_tree;
/* This is a linked list of objc_class_tree trees. The head of these trees
are root classes (their super class is Nil). These different trees
represent different class hierarchies. */
/* This is a linked list of objc_class_tree trees. The head of these
trees are root classes (their super class is Nil). These different
trees represent different class hierarchies. */
static struct objc_list *__objc_class_tree_list = NULL;
/* Keeps the +load methods who have been already executed. This hash should
not be destroyed during the execution of the program. */
/* Keeps the +load methods who have been already executed. This hash
should not be destroyed during the execution of the program. */
static cache_ptr __objc_load_methods = NULL;
/* Creates a tree of classes whose topmost class is directly inherited from
`upper' and the bottom class in this tree is `bottom_class'. The classes
in this tree are super classes of `bottom_class'. `subclasses' member
of each tree node point to the next subclass tree node. */
/* Creates a tree of classes whose topmost class is directly inherited
from `upper' and the bottom class in this tree is
`bottom_class'. The classes in this tree are super classes of
`bottom_class'. `subclasses' member of each tree node point to the
next subclass tree node. */
static objc_class_tree *
create_tree_of_subclasses_inherited_from (Class bottom_class, Class upper)
{
@ -134,11 +136,13 @@ create_tree_of_subclasses_inherited_from (Class bottom_class, Class upper)
return tree;
}
/* Insert the `class' into the proper place in the `tree' class hierarchy. This
function returns a new tree if the class has been successfully inserted into
the tree or NULL if the class is not part of the classes hierarchy described
by `tree'. This function is private to objc_tree_insert_class(), you should
not call it directly. */
/* Insert the `class' into the proper place in the `tree' class
hierarchy. This function returns a new tree if the class has been
successfully inserted into the tree or NULL if the class is not
part of the classes hierarchy described by `tree'. This function is
private to objc_tree_insert_class (), you should not call it
directly. */
static objc_class_tree *
__objc_tree_insert_class (objc_class_tree *tree, Class class)
{
@ -186,12 +190,13 @@ __objc_tree_insert_class (objc_class_tree *tree, Class class)
}
else
{
/* The class is not a direct subclass of tree->class. Search for class's
superclasses in the list of subclasses. */
/* The class is not a direct subclass of tree->class. Search for
class's superclasses in the list of subclasses. */
struct objc_list *subclasses = tree->subclasses;
/* Precondition: the class must be a subclass of tree->class; otherwise
return NULL to indicate our caller that it must take the next tree. */
/* Precondition: the class must be a subclass of tree->class;
otherwise return NULL to indicate our caller that it must
take the next tree. */
if (! class_is_subclass_of_class (class, tree->class))
return NULL;
@ -201,9 +206,9 @@ __objc_tree_insert_class (objc_class_tree *tree, Class class)
if (class_is_subclass_of_class (class, aClass))
{
/* If we found one of class's superclasses we insert the class
into its subtree and return the original tree since nothing
has been changed. */
/* If we found one of class's superclasses we insert the
class into its subtree and return the original tree
since nothing has been changed. */
subclasses->head
= __objc_tree_insert_class (subclasses->head, class);
DEBUG_PRINTF ("4. class %s inserted\n", class->name);
@ -211,9 +216,9 @@ __objc_tree_insert_class (objc_class_tree *tree, Class class)
}
}
/* We haven't found a subclass of `class' in the `subclasses' list.
Create a new tree of classes whose topmost class is a direct subclass
of tree->class. */
/* We haven't found a subclass of `class' in the `subclasses'
list. Create a new tree of classes whose topmost class is a
direct subclass of tree->class. */
{
objc_class_tree *new_tree
= create_tree_of_subclasses_inherited_from (class, tree->class);
@ -225,6 +230,7 @@ __objc_tree_insert_class (objc_class_tree *tree, Class class)
}
/* This function inserts `class' in the right tree hierarchy classes. */
static void
objc_tree_insert_class (Class class)
{
@ -244,8 +250,8 @@ objc_tree_insert_class (Class class)
list_node = list_node->tail;
}
/* If the list was finished but the class hasn't been inserted, insert it
here. */
/* If the list was finished but the class hasn't been inserted,
insert it here. */
if (! list_node)
{
__objc_class_tree_list = list_cons (NULL, __objc_class_tree_list);
@ -254,6 +260,7 @@ objc_tree_insert_class (Class class)
}
/* Traverse tree in preorder. Used to send +load. */
static void
objc_preorder_traverse (objc_class_tree *tree,
int level,
@ -267,6 +274,7 @@ objc_preorder_traverse (objc_class_tree *tree,
}
/* Traverse tree in postorder. Used to destroy a tree. */
static void
objc_postorder_traverse (objc_class_tree *tree,
int level,
@ -280,6 +288,7 @@ objc_postorder_traverse (objc_class_tree *tree,
}
/* Used to print a tree class hierarchy. */
#ifdef DEBUG
static void
__objc_tree_print (objc_class_tree *tree, int level)
@ -292,10 +301,12 @@ __objc_tree_print (objc_class_tree *tree, int level)
}
#endif
/* Walks on a linked list of methods in the reverse order and executes all
the methods corresponding to `op' selector. Walking in the reverse order
assures the +load of class is executed first and then +load of categories
because of the way in which categories are added to the class methods. */
/* Walks on a linked list of methods in the reverse order and executes
all the methods corresponding to `op' selector. Walking in the
reverse order assures the +load of class is executed first and then
+load of categories because of the way in which categories are
added to the class methods. */
static void
__objc_send_message_in_list (MethodList_t method_list, Class class, SEL op)
{
@ -349,8 +360,9 @@ __objc_destroy_class_tree_node (objc_class_tree *tree,
objc_free (tree);
}
/* This is used to check if the relationship between two classes before the
runtime completely installs the classes. */
/* This is used to check if the relationship between two classes
before the runtime completely installs the classes. */
static BOOL
class_is_subclass_of_class (Class class, Class superclass)
{
@ -366,12 +378,12 @@ class_is_subclass_of_class (Class class, Class superclass)
return NO;
}
/* This list contains all the classes in the runtime system for whom their
superclasses are not yet know to the runtime. */
/* This list contains all the classes in the runtime system for whom
their superclasses are not yet known to the runtime. */
static struct objc_list *unresolved_classes = 0;
/* Extern function used to reference the Object and NXConstantString classes.
*/
/* Extern function used to reference the Object and NXConstantString
classes. */
extern void __objc_force_linking (void);
@ -382,8 +394,9 @@ __objc_force_linking (void)
__objc_linking ();
}
/* Run through the statics list, removing modules as soon as all its statics
have been initialized. */
/* Run through the statics list, removing modules as soon as all its
statics have been initialized. */
static void
objc_init_statics (void)
{
@ -442,9 +455,9 @@ objc_init_statics (void)
} /* objc_init_statics */
/* This function is called by constructor functions generated for each
module compiled. (_GLOBAL_$I$...) The purpose of this function is to
gather the module pointers so that they may be processed by the
initialization routines as soon as possible */
module compiled. (_GLOBAL_$I$...) The purpose of this function is
to gather the module pointers so that they may be processed by the
initialization routines as soon as possible. */
void
__objc_exec_class (Module_t module)
@ -636,7 +649,8 @@ __objc_exec_class (Module_t module)
if (unclaimed_proto_list && objc_lookup_class ("Protocol"))
{
list_mapcar (unclaimed_proto_list,(void(*)(void*))__objc_init_protocols);
list_mapcar (unclaimed_proto_list,
(void (*) (void *))__objc_init_protocols);
list_free (unclaimed_proto_list);
unclaimed_proto_list = 0;
}
@ -646,15 +660,16 @@ __objc_exec_class (Module_t module)
objc_mutex_unlock (__objc_runtime_mutex);
}
static void objc_send_load (void)
static void
objc_send_load (void)
{
if (! __objc_module_list)
return;
/* Try to find out if all the classes loaded so far also have their
superclasses known to the runtime. We suppose that the objects that are
allocated in the +load method are in general of a class declared in the
same module. */
superclasses known to the runtime. We suppose that the objects
that are allocated in the +load method are in general of a class
declared in the same module. */
if (unresolved_classes)
{
Class class = unresolved_classes->head;
@ -668,25 +683,25 @@ static void objc_send_load (void)
break;
}
/*
* If we still have classes for whom we don't have yet their super
* classes known to the runtime we don't send the +load messages.
*/
/* If we still have classes for whom we don't have yet their
super classes known to the runtime we don't send the +load
messages. */
if (unresolved_classes)
return;
}
/* Special check to allow creating and sending messages to constant strings
in +load methods. If these classes are not yet known, even if all the
other classes are known, delay sending of +load. */
/* Special check to allow creating and sending messages to constant
strings in +load methods. If these classes are not yet known,
even if all the other classes are known, delay sending of +load. */
if (! objc_lookup_class ("NXConstantString") ||
! objc_lookup_class ("Object"))
return;
/* Iterate over all modules in the __objc_module_list and call on them the
__objc_create_classes_tree function. This function creates a tree of
classes that resembles the class hierarchy. */
list_mapcar (__objc_module_list, (void(*)(void*))__objc_create_classes_tree);
/* Iterate over all modules in the __objc_module_list and call on
them the __objc_create_classes_tree function. This function
creates a tree of classes that resembles the class hierarchy. */
list_mapcar (__objc_module_list,
(void (*) (void *)) __objc_create_classes_tree);
while (__objc_class_tree_list)
{
@ -714,8 +729,8 @@ __objc_create_classes_tree (Module_t module)
Symtab_t symtab = module->symtab;
int i;
/* Iterate thru classes defined in this module and insert them in the classes
tree hierarchy. */
/* Iterate thru classes defined in this module and insert them in
the classes tree hierarchy. */
for (i = 0; i < symtab->cls_def_cnt; i++)
{
Class class = (Class) symtab->defs[i];
@ -727,13 +742,13 @@ __objc_create_classes_tree (Module_t module)
static void
__objc_call_callback (Module_t module)
{
/* The runtime mutex is locked in this point */
/* The runtime mutex is locked in this point. */
Symtab_t symtab = module->symtab;
int i;
/* Iterate thru classes defined in this module and call the callback for
each one. */
/* Iterate thru classes defined in this module and call the callback
for each one. */
for (i = 0; i < symtab->cls_def_cnt; i++)
{
Class class = (Class) symtab->defs[i];
@ -743,9 +758,9 @@ __objc_call_callback (Module_t module)
_objc_load_callback (class, 0);
}
/* Call the _objc_load_callback for categories. Don't register the instance
methods as class methods for categories to root classes since they were
already added in the class. */
/* Call the _objc_load_callback for categories. Don't register the
instance methods as class methods for categories to root classes
since they were already added in the class. */
for (i = 0; i < symtab->cat_def_cnt; i++)
{
Category_t category = symtab->defs[i + symtab->cls_def_cnt];
@ -756,8 +771,10 @@ __objc_call_callback (Module_t module)
}
}
/* Sanity check the version of gcc used to compile `module'*/
static void init_check_module_version(Module_t module)
/* Sanity check the version of gcc used to compile `module'. */
static void
init_check_module_version (Module_t module)
{
if ((module->version != OBJC_VERSION) || (module->size != sizeof (Module)))
{
@ -815,7 +832,8 @@ __objc_init_protocols (struct objc_protocol_list* protos)
{
objc_error (nil, OBJC_ERR_PROTOCOL_VERSION,
"Version %d doesn't match runtime protocol version %d\n",
(int)((char*)protos->list[i]->class_pointer-(char*)0),
(int) ((char *) protos->list[i]->class_pointer
- (char *) 0),
PROTOCOL_VERSION);
}
}
@ -823,8 +841,8 @@ __objc_init_protocols (struct objc_protocol_list* protos)
objc_mutex_unlock (__objc_runtime_mutex);
}
static void __objc_class_add_protocols (Class class,
struct objc_protocol_list* protos)
static void
__objc_class_add_protocols (Class class, struct objc_protocol_list *protos)
{
/* Well... */
if (! protos)

View File

@ -1,5 +1,6 @@
/* GNU Objective C Runtime Miscellaneous
Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1993, 1994, 1995, 1996, 1997, 2002
Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup
This file is part of GNU CC.
@ -148,7 +149,8 @@ objc_free(void *mem)
#if OBJC_WITH_GC
#include <gc.h>
static void *GC_calloc (size_t nelem, size_t size)
static void *
GC_calloc (size_t nelem, size_t size)
{
void *p = GC_malloc (nelem * size);
if (! p)
@ -158,7 +160,10 @@ static void *GC_calloc (size_t nelem, size_t size)
return p;
}
static void noFree (void* p) {}
static void
noFree (void *p)
{
}
void *(*_objc_malloc) (size_t) = GC_malloc;
void *(*_objc_atomic_malloc) (size_t) = GC_malloc_atomic;
@ -167,7 +172,7 @@ void *(*_objc_realloc)(void *, size_t) = GC_realloc;
void *(*_objc_calloc) (size_t, size_t) = GC_calloc;
void (*_objc_free) (void *) = noFree;
#else
#else /* !OBJC_WITH_GC */
void *(*_objc_malloc) (size_t) = malloc;
void *(*_objc_atomic_malloc) (size_t) = malloc;
@ -177,4 +182,4 @@ void *(*_objc_calloc)(size_t, size_t) = calloc;
void (*_objc_free) (void *) = free;
#endif
#endif /* !OBJC_WITH_GC */

View File

@ -1,5 +1,5 @@
/* GNU Objective C Runtime nil receiver function
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
Copyright (C) 1993, 1995, 1996, 2002 Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup
This file is part of GNU CC.
@ -34,7 +34,3 @@ nil_method(id receiver, SEL op __attribute__ ((__unused__)), ...)
{
return receiver;
}

View File

@ -1,5 +1,5 @@
/* Encoding of types for Objective C.
Copyright (C) 1993, 1997 Free Software Foundation, Inc.
Copyright (C) 1993, 1997, 2002 Free Software Foundation, Inc.
Author: Kresten Krab Thorup

View File

@ -1,5 +1,5 @@
/* Thread and mutex controls for Objective C.
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
This file is part of GNU CC.

View File

@ -101,5 +101,3 @@ id __objc_object_copy(id object)
memcpy (copy, object, object->class_pointer->instance_size);
return copy;
}

View File

@ -1,5 +1,5 @@
/* Sparse Arrays for Objective C dispatch tables
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
Copyright (C) 1993, 1995, 1996, 2002 Free Software Foundation, Inc.
This file is part of GNU CC.
@ -382,8 +382,7 @@ sarray_realloc(struct sarray* array, int newsize)
/* Free a sparse array allocated with sarray_new */
void
sarray_free(struct sarray* array)
{
sarray_free (struct sarray *array) {
#ifdef OBJC_SPARSE3
size_t old_max_index = (array->capacity - 1)/INDEX_CAPACITY;
struct sindex **old_indices;
@ -499,15 +498,13 @@ sarray_lazy_copy(struct sarray* oarr)
/* Copy bucket table */
new_indices = (struct sindex **)
objc_malloc (sizeof (struct sindex *) * num_indices);
memcpy( new_indices,oarr->indices,
sizeof(struct sindex*)*num_indices);
memcpy (new_indices, oarr->indices, sizeof (struct sindex *) * num_indices);
arr->indices = new_indices;
#else
/* Copy bucket table */
new_buckets = (struct sbucket **)
objc_malloc (sizeof (struct sbucket *) * num_indices);
memcpy( new_buckets,oarr->buckets,
sizeof(struct sbucket*)*num_indices);
memcpy (new_buckets, oarr->buckets, sizeof (struct sbucket *) * num_indices);
arr->buckets = new_buckets;
#endif

View File

@ -285,8 +285,7 @@ sel_get_uid (const char *name)
/* Get name of selector. If selector is unknown, the empty string ""
is returned */
const char*
sel_get_name (SEL selector)
const char *sel_get_name (SEL selector)
{
const char *ret;
@ -308,8 +307,7 @@ sel_is_mapped (SEL selector)
}
const char*
sel_get_type (SEL selector)
const char *sel_get_type (SEL selector)
{
if (selector)
return selector->sel_types;
@ -455,4 +453,3 @@ sel_register_typed_name (const char *name, const char *type)
return ret;
}

View File

@ -1,6 +1,6 @@
/* GNU Objective C Runtime message lookup
Copyright (C) 1993, 1995, 1996, 1997, 1998,
2001 Free Software Foundation, Inc.
2001, 2002 Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup
This file is part of GNU CC.
@ -226,8 +226,7 @@ objc_msg_sendv(id object, SEL op, arglist_t arg_frame)
void
__objc_init_dispatch_tables ()
{
__objc_uninstalled_dtable
= sarray_new(200, 0);
__objc_uninstalled_dtable = sarray_new (200, 0);
}
/* This function is called by objc_msg_lookup when the
@ -645,7 +644,8 @@ __objc_print_dtable_stats()
(long) nbuckets * sizeof (struct sbucket));
total += nbuckets * sizeof (struct sbucket);
printf("idxtables: %d = %ld bytes\n", idxsize, (long)idxsize*sizeof(void*));
printf ("idxtables: %d = %ld bytes\n",
idxsize, (long) idxsize * sizeof (void *));
total += idxsize * sizeof (void *);
printf ("-----------------------------------\n");
printf ("total: %d bytes\n", total);

View File

@ -1,5 +1,5 @@
/* GNU Objective C Runtime Thread Implementation
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
Modified for Mach threads by Bill Bumgarner <bbum@friday.com>
Condition functions added by Mircea Oancea <mircea@first.elcom.pub.ro>
@ -37,7 +37,8 @@ Boston, MA 02111-1307, USA. */
maximum priority downward only-- cannot be raised without superuser
privileges. Once lowered, it cannot be raised.
*/
static int __mach_get_max_thread_priority(cthread_t t, int *base)
static int
__mach_get_max_thread_priority (cthread_t t, int *base)
{
thread_t threadP;
kern_return_t error;