Updated/synced with latest GCC's libobjc

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/libobjc/trunk@25127 72102866-910b-0410-8b05-ffd578937521
main
nicola 19 years ago
parent e4fd24ffea
commit f6e85c64d2

@ -1,42 +1,44 @@
2007-04-30 Richard Frith-Macdonald <rfm@gnu.org> 2007-04-21 Andrew Ruder <andy@aeruder.net>
* sendmsg.c: Add forward2 * sendmsg.c (__objc_get_forward_imp): Call
* objc/objc-api.h: Add forward2 __objc_msg_forward2 for real.
* thr-pthreads.c: Fix memory leak
2007-04-09 Andrew Ruder <andy@aeruder.net>
2006-02-24 Jeremy Bettis <jeremy@deadbeef.com>
* sendmsg.c: Added __objc_msg_forward2, a hook that allows
* misc.c: Added some missing objc_DECLARE keywords on function pointer definitions. external libraries to provide a function that returns the real
* init.c: (objc_send_load): Removed the check for NXConstantString class to fix +load. forwarding function based on both the selector and the receiver.
(again see:ChangeLog.GNUstep Tue Feb 11 17:11:00 2003) * objc/objc-api.h: Define __objc_msg_forward2.
2006-02-21 Jeremy Bettis <jeremy@deadbeef.com> 2007-02-18 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
* thr-win32.c: (__objc_thread_detach): Removed duplicate * objc/objc-list.h (list_free): Add keyword 'inline' to avoid
definitions of thread_id and win32_handle. unused warning.
* objc/objc-decls.h: Don't use __dllspec on mingw platform.
2006-02-10 Jeremy Bettis <jeremy@deadbeef.com>
* init.c (objc_init_statics, __objc_init_protocols): Fix to GCC
bug 23214 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23214) In
some odd circumstances protocols are not properly initalized. See
the Bugzilla page for testcase.
2006-02-10 Jeremy Bettis <jeremy@deadbeef.com> 2006-10-31 Geoffrey Keating <geoffk@apple.com>
* thr-win32.c: There is no such define __MINGW__, changed to __MINGW32__ * encoding.c (darwin_rs6000_special_round_type_align): New.
2006-01-20 Adam Fedor <fedor@gnu.org> 2006-02-21 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* Import from recent gcc repository 2006-01-03 with fixups (see PR libobjc/26309
ChangeLog for more info). * thr-objc.c (_XOPEN_SOURCE): Don't define on Tru64 UNIX.
* ChangeLog, GNUmakefile, Protocol.m, encoding.c, hash.c, init.c,
libobjc.def, linking.c, sarray.c, selector.c, sendmsg.c, thr-mach.c, 2006-01-24 David Ayers <d.ayers@inode.at>
thr-objc.c, thr-posix.c, thr-win32.c, objc/hash.h, objc/objc-api.h,
objc/objc-decls.h, objc/runtime.h: Import and fixup. PR libobjc/9751
* gc.c (class_ivar_set_gcinvisible): Replace strncpy with memcpy
and insure the new strings are '\0' termintated.
2006-01-24 David Ayers <d.ayers@inode.at>
PR libobjc/13946
* configure.ac: Add include directives for --enable-objc-gc.
* Makefile.in: Ditto.
* configure: Regenerate.
* README.GNUstep: Update. * gc.c (__objc_class_structure_encoding): Increment the used bytes
instead of the local pointer to them.
2005-12-14 Andrew Pinski <pinskia@physics.uc.edu> 2005-12-14 Andrew Pinski <pinskia@physics.uc.edu>

@ -1,9 +1,24 @@
2007-05-06 Nicola Pero <nicola.pero@meta-innovation.com>
* ChangeLog: Removed GNUstep-specific entries. This is supposed
to be a copy of GCC's ChangeLog.
* ChangeLog.GNUstep: Added GNUstep-specific entries that were
removed from ChangeLog.
* gc.c, sendmsg.c, objc/objc-api.h, objc/objc-list.h, encoding.c,
thr-objc.c: Imported latest changes from GCC's libobjc. See
ChangeLog for details.
2007-05-06 Nicola Pero <nicola.pero@meta-innovation.com> 2007-05-06 Nicola Pero <nicola.pero@meta-innovation.com>
* configure: Added code at the very beginning to print an help * configure: Added code at the very beginning to print an help
message and abort. Users who don't read the README.GNUstep message and abort. Users who don't read the README.GNUstep
might otherwise try to run configure, messing everything up. might otherwise try to run configure, messing everything up.
2007-04-30 Richard Frith-Macdonald <rfm@gnu.org>
* thr-pthreads.c: Fix memory leak
2007-02-28 Nicola Pero <nicola.pero@meta-innovation.com> 2007-02-28 Nicola Pero <nicola.pero@meta-innovation.com>
* GNUmakefile (GNUSTEP_MAKEFILES): Use gnustep-config to * GNUmakefile (GNUSTEP_MAKEFILES): Use gnustep-config to
@ -25,6 +40,29 @@
versions of gnustep-make older than October 2001. If your versions of gnustep-make older than October 2001. If your
gnustep-make is that old, please upgrade. gnustep-make is that old, please upgrade.
2006-02-24 Jeremy Bettis <jeremy@deadbeef.com>
* misc.c: Added some missing objc_DECLARE keywords on function pointer definitions.
* init.c: (objc_send_load): Removed the check for NXConstantString class to fix +load.
(again see:ChangeLog.GNUstep Tue Feb 11 17:11:00 2003)
2006-02-21 Jeremy Bettis <jeremy@deadbeef.com>
* thr-win32.c: (__objc_thread_detach): Removed duplicate
definitions of thread_id and win32_handle.
* objc/objc-decls.h: Don't use __dllspec on mingw platform.
2006-02-10 Jeremy Bettis <jeremy@deadbeef.com>
* init.c (objc_init_statics, __objc_init_protocols): Fix to GCC
bug 23214 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23214) In
some odd circumstances protocols are not properly initalized. See
the Bugzilla page for testcase.
2006-02-10 Jeremy Bettis <jeremy@deadbeef.com>
* thr-win32.c: There is no such define __MINGW__, changed to __MINGW32__
2006-01-20 Adam Fedor <fedor@gnu.org> 2006-01-20 Adam Fedor <fedor@gnu.org>
* GNUmakefile: Update module name. * GNUmakefile: Update module name.

@ -120,6 +120,10 @@ static int __attribute__ ((__unused__)) not_target_flags = 0;
: TREE_TYPE (_fields)) == DFmode) \ : TREE_TYPE (_fields)) == DFmode) \
? MAX (MAX (COMPUTED, SPECIFIED), 64) \ ? MAX (MAX (COMPUTED, SPECIFIED), 64) \
: MAX (COMPUTED, SPECIFIED));}) : MAX (COMPUTED, SPECIFIED));})
/* FIXME: The word 'fixme' is insufficient to explain the wrong-ness
of this next macro definition. */
#define darwin_rs6000_special_round_type_align(S,C,S2) \
rs6000_special_round_type_align(S,C,S2)
/* /*
return the size of an object specified by type return the size of an object specified by type

24
gc.c

@ -1,5 +1,5 @@
/* Basic data types for Objective C. /* Basic data types for Objective C.
Copyright (C) 1998, 2002 Free Software Foundation, Inc. Copyright (C) 1998, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Ovidiu Predescu. Contributed by Ovidiu Predescu.
This file is part of GCC. This file is part of GCC.
@ -250,7 +250,7 @@ __objc_class_structure_encoding (Class class, char **type, int *size,
if (! class) if (! class)
{ {
strcat (*type, "{"); strcat (*type, "{");
*current++; (*current)++;
return; return;
} }
@ -397,30 +397,34 @@ class_ivar_set_gcinvisible (Class class, const char *ivarname,
if (*type == _C_GCINVISIBLE) if (*type == _C_GCINVISIBLE)
{ {
char *new_type; char *new_type;
size_t len;
if (gc_invisible || ! __objc_ivar_pointer (type)) if (gc_invisible || ! __objc_ivar_pointer (type))
return; /* The type of the variable already matches the return; /* The type of the variable already matches the
requested gc_invisible type */ requested gc_invisible type */
/* The variable is gc_invisible and we have to reverse it */ /* The variable is gc_invisible so we make it gc visible. */
new_type = objc_atomic_malloc (strlen (ivar->ivar_type)); new_type = objc_atomic_malloc (strlen(ivar->ivar_type));
strncpy (new_type, ivar->ivar_type, len = (type - ivar->ivar_type);
(size_t)(type - ivar->ivar_type)); memcpy (new_type, ivar->ivar_type, len);
new_type[len] = 0;
strcat (new_type, type + 1); strcat (new_type, type + 1);
ivar->ivar_type = new_type; ivar->ivar_type = new_type;
} }
else else
{ {
char *new_type; char *new_type;
size_t len;
if (! gc_invisible || ! __objc_ivar_pointer (type)) if (! gc_invisible || ! __objc_ivar_pointer (type))
return; /* The type of the variable already matches the return; /* The type of the variable already matches the
requested gc_invisible type */ requested gc_invisible type */
/* The variable is gc visible and we have to make it gc_invisible */ /* The variable is gc visible so we make it gc_invisible. */
new_type = objc_malloc (strlen (ivar->ivar_type) + 2); new_type = objc_malloc (strlen(ivar->ivar_type) + 2);
strncpy (new_type, ivar->ivar_type, len = (type - ivar->ivar_type);
(size_t)(type - ivar->ivar_type)); memcpy (new_type, ivar->ivar_type, len);
new_type[len] = 0;
strcat (new_type, "!"); strcat (new_type, "!");
strcat (new_type, type); strcat (new_type, type);
ivar->ivar_type = new_type; ivar->ivar_type = new_type;

@ -41,11 +41,9 @@ extern "C" {
/* For functions which return Method_t */ /* For functions which return Method_t */
#define METHOD_NULL (Method_t)0 #define METHOD_NULL (Method_t)0
/* Boolean typedefs */ /* Boolean typedefs */
/* /* Method descriptor returned by introspective Object methods.
** Method descriptor returned by introspective Object methods. This is really just the first part of the more complete objc_method
** This is really just the first part of the more complete objc_method structure defined below and used internally by the runtime. */
** structure defined below and used internally by the runtime.
*/
struct objc_method_description struct objc_method_description
{ {
SEL name; /* this is a selector, not a string */ SEL name; /* this is a selector, not a string */
@ -85,36 +83,32 @@ struct objc_method_description
#define _C_COMPLEX 'j' #define _C_COMPLEX 'j'
/* /* Error handling
** Error handling
** Call objc_error() or objc_verror() to record an error; this error
** Call objc_error() or objc_verror() to record an error; this error routine will generally exit the program but not necessarily if the
** routine will generally exit the program but not necessarily if the user has installed his own error handler.
** user has installed his own error handler.
** Call objc_set_error_handler to assign your own function for
** Call objc_set_error_handler to assign your own function for handling errors. The function should return YES if it is ok
** handling errors. The function should return YES if it is ok to continue execution, or return NO or just abort if the
** to continue execution, or return NO or just abort if the program should be stopped. The default error handler is just to
** program should be stopped. The default error handler is just to print a message on stderr.
** print a message on stderr.
** The error handler function should be of type objc_error_handler
** The error handler function should be of type objc_error_handler The first parameter is an object instance of relevance.
** The first parameter is an object instance of relevance. The second parameter is an error code.
** The second parameter is an error code. The third parameter is a format string in the printf style.
** The third parameter is a format string in the printf style. The fourth parameter is a variable list of arguments. */
** The fourth parameter is a variable list of arguments.
*/
extern void objc_error(id object, int code, const char* fmt, ...); extern void objc_error(id object, int code, const char* fmt, ...);
extern void objc_verror(id object, int code, const char* fmt, va_list ap); extern void objc_verror(id object, int code, const char* fmt, va_list ap);
typedef BOOL (*objc_error_handler)(id, int code, const char *fmt, va_list ap); typedef BOOL (*objc_error_handler)(id, int code, const char *fmt, va_list ap);
extern objc_error_handler objc_set_error_handler(objc_error_handler func); extern objc_error_handler objc_set_error_handler(objc_error_handler func);
/* /* Error codes
** Error codes These are used by the runtime library, and your
** These are used by the runtime library, and your error handling may use them to determine if the error is
** error handling may use them to determine if the error is hard or soft thus whether execution can continue or abort. */
** hard or soft thus whether execution can continue or abort.
*/
#define OBJC_ERR_UNKNOWN 0 /* Generic error */ #define OBJC_ERR_UNKNOWN 0 /* Generic error */
#define OBJC_ERR_OBJC_VERSION 1 /* Incorrect runtime version */ #define OBJC_ERR_OBJC_VERSION 1 /* Incorrect runtime version */
@ -139,10 +133,8 @@ extern objc_error_handler objc_set_error_handler(objc_error_handler func);
#define OBJC_ERR_BAD_STATE 40 /* Bad thread state */ #define OBJC_ERR_BAD_STATE 40 /* Bad thread state */
/* /* Set this variable nonzero to print a line describing each
** Set this variable nonzero to print a line describing each message that is sent. (this is currently disabled) */
** message that is sent. (this is currently disabled)
*/
extern BOOL objc_trace; extern BOOL objc_trace;
@ -160,14 +152,12 @@ struct objc_static_instances
#endif #endif
}; };
/* /* Whereas a Module (defined further down) is the root (typically) of a file,
** Whereas a Module (defined further down) is the root (typically) of a file, a Symtab is the root of the class and category definitions within the
** a Symtab is the root of the class and category definitions within the module.
** module.
** A Symtab contains a variable length array of pointers to classes and
** A Symtab contains a variable length array of pointers to classes and categories defined in the module. */
** categories defined in the module.
*/
typedef struct objc_symtab { typedef struct objc_symtab {
unsigned long sel_ref_cnt; /* Unknown. */ unsigned long sel_ref_cnt; /* Unknown. */
SEL refs; /* Unknown. */ SEL refs; /* Unknown. */

@ -139,7 +139,7 @@ list_find(struct objc_list** list, void* elem)
/* Free list (backwards recursive) */ /* Free list (backwards recursive) */
static void static inline void
list_free(struct objc_list* list) list_free(struct objc_list* list)
{ {
if(list) if(list)

@ -74,8 +74,7 @@ static void __objc_init_install_dtable (id, SEL);
return type for the selector. return type for the selector.
__objc_block_forward for structures. __objc_block_forward for structures.
__objc_double_forward for floats/doubles. __objc_double_forward for floats/doubles.
__objc_word_forward for pointers or types that fit in registers. __objc_word_forward for pointers or types that fit in registers. */
*/
static double __objc_double_forward (id, SEL, ...); static double __objc_double_forward (id, SEL, ...);
static id __objc_word_forward (id, SEL, ...); static id __objc_word_forward (id, SEL, ...);
typedef struct { id many[8]; } __big; typedef struct { id many[8]; } __big;
@ -92,7 +91,7 @@ id nil_method (id, SEL);
/* Given a selector, return the proper forwarding implementation. */ /* Given a selector, return the proper forwarding implementation. */
inline inline
IMP IMP
__objc_get_forward_imp (SEL sel) __objc_get_forward_imp (id rcv, SEL sel)
{ {
/* If a custom forwarding hook was registered, try getting a forwarding /* If a custom forwarding hook was registered, try getting a forwarding
function from it. There are two forward routine hooks, one that function from it. There are two forward routine hooks, one that
@ -111,7 +110,7 @@ __objc_get_forward_imp (SEL sel)
} }
/* In all other cases, use the default forwarding functions built using /* In all other cases, use the default forwarding functions built using
* __builtin_apply and friends. */ __builtin_apply and friends. */
{ {
const char *t = sel->sel_types; const char *t = sel->sel_types;
@ -180,7 +179,7 @@ get_imp (Class class, SEL sel)
is not in the dispatch table. So the method just is not in the dispatch table. So the method just
doesn't exist for the class. Return the forwarding doesn't exist for the class. Return the forwarding
implementation. */ implementation. */
res = __objc_get_forward_imp (sel); res = __objc_get_forward_imp ((id)class, sel);
} }
} }
} }
@ -249,7 +248,7 @@ objc_msg_lookup (id receiver, SEL op)
{ {
/* If the method still just doesn't exist for the /* If the method still just doesn't exist for the
class, attempt to forward the method. */ class, attempt to forward the method. */
result = __objc_get_forward_imp (op); result = __objc_get_forward_imp (receiver, op);
} }
} }
} }

@ -1,5 +1,6 @@
/* GNU Objective C Runtime Thread Interface. /* GNU Objective C Runtime Thread Interface.
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006
Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
@ -26,8 +27,11 @@ Boston, MA 02110-1301, USA. */
#define _LIBOBJC #define _LIBOBJC
/* The line below is needed for declarations of functions such as /* The line below is needed for declarations of functions such as
pthread_mutexattr_settype, without which gthr-posix.h may fail to pthread_mutexattr_settype, without which gthr-posix.h may fail to
compile within libobjc. */ compile within libobjc. Unfortunately, this breaks compilation on
Tru64 UNIX V4.0F, so disable it there. */
#ifndef __osf__
#define _XOPEN_SOURCE 500 #define _XOPEN_SOURCE 500
#endif
#include "config.h" #include "config.h"
#include "tconfig.h" #include "tconfig.h"
#include "coretypes.h" #include "coretypes.h"

Loading…
Cancel
Save