GCC 4.2.0 release Objective C runtime support code.

This commit is contained in:
Alexander Kabaev 2007-05-19 01:25:45 +00:00
parent f8a1b7d9d8
commit 00e4af377d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/gcc/dist/; revision=169693
54 changed files with 7815 additions and 2930 deletions

View File

@ -1,6 +1,55 @@
2006-03-05 Release Manager
2007-05-13 Release Manager
* GCC 3.4.6 released.
* GCC 4.2.0 released.
2006-10-14 Geoffrey Keating <geoffk@apple.com>
* Makefile.in: Use multi_basedir instead of toplevel_srcdir.
* configure.ac: Use multi.m4 from aclocal rather than custom
code. Use multi_basedir instead of toplevel_srcdir.
* aclocal.m4: Regenerate.
* configure: Regenerate.
2006-10-10 Brooks Moses <bmoses@stanford.edu>
* Makefile.in: Added empty "pdf" target.
2006-07-18 Paolo Bonzini <bonzini@gnu.org>
* configure: Regenerate.
2006-05-23 Carlos O'Donell <carlos@codesourcery.com>
* Makefile.in: Add install-html target. Add install-html to .PHONY
2006-02-21 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
PR libobjc/26309
* thr-objc.c (_XOPEN_SOURCE): Don't define on Tru64 UNIX.
2006-01-24 David Ayers <d.ayers@inode.at>
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.
* 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>
PR objc/25360
* objc/objc-api.c (_C_COMPLEX): New define.
* encoding.c (objc_sizeof_type): Handle _C_Complex.
(objc_alignof_type): Likewise.
(objc_skip_typespec): Likewise.
2005-12-15 David Ayers <d.ayers@inode.at>
@ -8,13 +57,175 @@
* README (+load,+initialize): Fix documentation to reflect
intended and implemented semantics for +load and +initialize.
2005-11-30 Release Manager
2005-12-12 Andrew Pinski <pinskia@physics.uc.edu>
* GCC 3.4.5 released.
* encoding.c (TYPE_FIELDS): Fix to skip over just _C_STRUCT_B and
the name.
(get_inner_array_type): Fix to skip over _C_ARY_B and size.
(rs6000_special_round_type_align): Update for the ABI fix.
(objc_layout_finish_structure): Correct the encoding which is passed to
ROUND_TYPE_ALIGN.
2005-05-19 Release Manager
2005-12-11 Andrew Pinski <pinskia@physics.uc.edu>
* GCC 3.4.4 released.
PR libobjc/25347
* encoding.c (objc_sizeof_type): Don't handle _C_UNION_B special
but use the struct layout functions.
(objc_alignof_type): Likewise.
(objc_layout_structure): Handle _C_UNION_B also.
(objc_layout_structure_next_member): Likewise.
(objc_layout_finish_structure): Likewise.
2005-12-11 Andrew Pinski <pinskia@physics.uc.edu>
PR libobjc/25346
* objc/objc-api.h (_C_BOOL): New define.
* encoding.c (objc_sizeof_type): Handle _C_BOOL.
(objc_alignof_type): Likewise.
(objc_skip_typespec): Likewise.
2005-11-20 David Ayers <d.ayers@inode.at>
PR libobjc/19024
* objc/hash.h: Remove deprecated hash API.
* hash_compat.c: Remove.
* Makefile.in: Remove reference to hash_compat.c.
* configure.ac (VERSION): Bump library version to 2:0:0.
* configure: Regenerate.
2005-11-09 Alexandre Oliva <aoliva@redhat.com>
PR other/4372
* thr-objc.c (_XOPEN_SOURCE): Define.
2005-10-07 Ulrich Weigand <uweigand@de.ibm.com>
PR libobjc/23612
* objc/objc-api.h (struct objc_ivar): Move definition to
global scope.
2005-09-04 Andrew Pinski <pinskia@physics.uc.edu>
Rasmus Hahn <rassahah@neofonie.de>
PR libobjc/23108
* archive.c (objc_write_type): Correct the element offset.
(objc_read_type): Likewise.
2005-08-17 Kelley Cook <kcook@gcc.gnu.org>
* All files: Update FSF address.
2005-08-13 Marcin Koziej <creep@desk.pl>
Andrew Pinski <pinskia@physics.uc.edu>
PR libobjc/22492
* exception.c (PERSONALITY_FUNCTION): Fix the PC with finally.
2005-08-13 Andrew Pinski <pinskia@physics.uc.edu>
* Makefile.in (extra_ldflags_libobjc): New.
(libobjc$(libext).la): Add extra_ldflags_libobjc to the link line.
(libobjc_gc$(libext).la): Likewise.
* configure.ac (extra_ldflags_libgfortran): Set for *-darwin* to
"-Wl,-single_module".
* configure: Regenerate.
* linking.m (_objcInit): Remove.
2005-07-26 Andrew Pinski <pinskia@physics.uc.edu>
PR libobjc/22606
* Makefile.in (ALL_CFLAGS): Add -fexceptions.
2005-06-08 David Ayers <d.ayers@inode.at>
* objc/NXConstStr.h, objc/Object.h, objc/Protocol.h,
objc/encoding.h, objc/hash.h, objc/objc-api.h,
objc/runtime.h, objc/sarray.h, objc/thr.h,
objc/typedstream.h: Do not include Objective-C headers as
system headers.
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.
2005-05-19 Richard Henderson <rth@redhat.com>
* exception.c: Revert last change.
2005-05-19 David Ayers <d.ayers@inode.at>
* exception.c: Include tsystem.h for unwind.h.
2005-05-09 Mike Stump <mrs@apple.com>
* configure: Regenerate.
2005-04-12 Mike Stump <mrs@apple.com>
* configure: Regenerate.
2005-03-21 Zack Weinberg <zack@codesourcery.com>
* Makefile.in: Set gcc_version here.
* configure.ac: Do not invoke TL_AC_GCC_VERSION. Adjust quoting
in definition of toolexeclibdir so that $(gcc_version) is expanded
by the Makefile.
* aclocal.m4, configure: Regenerate.
2005-03-03 David Ayers <d.ayers@inode.at>
* objc/hash.h (OBJC_IGNORE_DEPRECATED_API): Update deprecated
version reference. Correct typo.
2005-03-02 David Ayers <d.ayers@inode.at>
PR libobjc/19024
* Makefile.in (OBJS): Add hash_compat.lo.
(OBJS_GC): Add hash_compat_gc.lo.
(hash_compat_gc.lo): New target and rule.
* objc/hash.h (hash_new, hash_delete, hash_add, hash_remove)
(hash_next, hash_value_for_key, hash_is_key_in_hash)
(hash_ptr, hash_string, compare_ptrs, compare_strings): Prefix
with objc_. Add deprecated non prefixed inlined versions.
(OBJC_IGNORE_DEPRECATED_API): New macro to hide deprecated
declarations.
* hash.c (hash_new, hash_delete, hash_add, hash_remove, hash_next)
(hash_value_for_key, hash_is_key_in_hash): Prefix with objc_ and
update callers.
* hash_compat.c: New file.
* archive.c: Update callers.
* init.c: Likewise.
* selector.c: Likewise.
* libobjc.def: Add objc_ versions of hash functions.
2005-02-28 Andrew Pinski <pinskia@physics.uc.edu>
PR libobjc/20252
* Makefile.in (GTHREAD_FLAGS): Remove.
(ALL_CFLAGS): Remove usage of GTHREAD_FLAGS.
* thr-objc.c: Include config.h.
* configure.ac: Instead of looking at GCC's makefile, figure out if
GTHREAD_FLAGS should be defined by looking at the `thread model'
of the current gcc.
* configure: Regenerate.
* config.h.in: Regenerate.
2005-02-28 Paolo Bonzini <bonzini@gnu.org>
PR bootstrap/17383
* configure.ac: Call GCC_TOPLEV_SUBDIRS.
(Determine CFLAGS for gthread): Use $host_subdir.
* configure: Regenerate.
* Makefile.in (host_subdir): New.
(INCLUDES): Use it.
2004-12-20 Andrew Pinski <pinskia@physics.uc.edu>
@ -24,26 +235,371 @@
Include limits.h and stdlib.h.
Define BITS_PER_WORD.
2004-11-04 Release Manager
2004-12-12 Alexander Malmberg <alexander@malmberg.org>
* GCC 3.4.3 released.
* selector.c (__objc_init_selector_tables): Add missing void to
definition.
2004-09-06 Release Manager
2004-12-02 Richard Sandiford <rsandifo@redhat.com>
* GCC 3.4.2 released.
* configure.ac: Use TL_AC_GCC_VERSION to set gcc_version.
* configure, aclocal.m4: Regenerate.
2004-07-01 Release Manager
2004-11-29 Kelley Cook <kcook@gcc.gnu.org>
* GCC 3.4.1 released.
* configure: Regenerate for libtool change.
2004-04-18 Release Manager
2004-11-25 Kelley Cook <kcook@gcc.gnu.org>
* GCC 3.4.0 released.
* configure: Regenerate for libtool reversion.
2004-11-24 Kelley Cook <kcook@gcc.gnu.org>
* configure: Regenerate for libtool change.
2004-11-24 Kelley Cook <kcook@gcc.gnu.org>
* aclocal.m4, config.h.in: Regenerate.
2004-10-08 Mike Stump <mrs@apple.com>
Andrew Pinski <pinskia@physics.uc.edu>
* aclocal.m4: Rename to ...
* acinclude.m4: here and also use m4_include instead of sinclude.
* aclocal.m4: Regenerate.
* configure: Regenerate.
* configure.ac: Add AM_MAINTAINER_MODE and AM_PROG_CC_C_O.
* Makefile.in (configure): Add @MAINT@ infront of configure.ac
2004-10-08 Andrew Pinski <pinskia@physics.uc.edu>
* archive.c: Fix all the warnings about passing unsigned char*
to char* and the other way too.
2004-09-16 Andrew Pinski <pinskia@physics.uc.edu>
PR libobjc/16448
* exception.c: Include config.h
(objc_exception_throw): Change _GLIBCXX_SJLJ_EXCEPTIONS to
SJLJ_EXCEPTIONS.
* configure.ac: Find out what exception handling code we use.
* configure: Regenerate.
* config.h.in: New file, regenerate.
2004-09-16 Andrew Pinski <apinski@apple.com>
* encoding.c (ALTIVEC_VECTOR_MODE): Define a bogus macro.
2004-08-28 Nathanael Nerode <neroden@gcc.gnu.org>
* configure.ac: Switch from _GCC_TOPLEV_NONCANONICAL_TARGET to
ACX_NONCANONICAL_TARGET.
* configure: Regenerate.
2004-08-13 Ziemowit Laski <zlaski@apple.com>
* objc/sarray.h: Hoist include of assert.h near the top of file,
and mark the remainder of the file 'extern "C"'.
2004-08-13 Andrew Pinski <pinskia@physics.uc.edu>
* objc/Object.h: Move includes out of extern "C" blocks.
* objc/encoding.h: Likewise.
* objc/hash.h: Likewise.
* objc/objc-api.h: Likewise.
* objc/runtime.h: Likewise.
* objc/sarray.h: Likewise.
* objc/typedstream.h: Likewise.
2004-08-12 Ziemowit Laski <zlaski@apple.com>
* objc/NXConstStr.h: Update copyright date; bracket with
'extern "C"' for C++ use; make include syntax consistent
by using <...> instead of "..."; hoist <objc/...> includes
above the 'extern "C"' block.
* objc/Object.h: Likewise.
* objc/Protocol.h: Likewise.
* objc/encoding.h: Likewise.
* objc/hash.h: Likewise.
* objc/runtime.h: Likewise.
* objc/sarray.h: Likewise.
* objc/thr.h: Likewise.
* objc/typedstream.h: Likewise.
* objc/objc-api.h: Add 'extern "C"' block for C++ use.
(objc_static_instances): For C++ case, do away with
zero-sized array.
(objc_method): Hoist definition to file scope.
(_objc_load_callback, _objc_object_alloc, class_get_class_method,
class_get_instance_method, class_create_instance,
class_get_class_name, class_get_instance_size,
class_get_meta_class, class_get_super_class, class_get_version,
class_is_class, class_is_meta_class, class_set_version,
class_get_gc_object_type, class_ivar_set_gcinvisible,
get_imp): Rename 'class' parameter to '_class'.
* objc/objc-list.h: Add 'extern "C"' block for C++ use.
* objc/objc.h: Update copyright date.
(arglist_t): Provide a union tag.
2004-07-22 Andrew Pinski <pinskia@physics.uc.edu>
* thr.c (__objc_thread_detach_function): Do not mark as volatile
but instead use the attribute noreturn.
2004-06-28 Zack Weinberg <zack@codesourcery.com>
* encoding.c: Rename target_flags with a #define to avoid
conflict with a prior declaration.
2004-06-24 Andrew Pinski <apinski@apple.com>
* objc/encoding.h: Wrap the functions with extern "C" for C++
mode.
* objc/hash.h: Likewise.
* objc/objc-api.h: Likewise.
* objc/objc-list.h: Likewise.
* objc/runtime.h: Likewise.
* objc/sarray.h: Likewise.
* objc/thr.h: Likewise.
* objc/typedstream.h: Likewise.
2004-06-21 Nick Clifton <nickc@redhat.com>
* encoding.c (BITS_PER_UNIT): Define if a definition is not
provided.
2004-06-20 Alexander Malmberg <alexander@malmberg.org>
* Makefile.in (exception.lo): Remove $(OBJC_GCFLAGS).
(exception_gc.lo): New.
(OBJS_GC): Add exception_gc.lo.
2004-06-17 Richard Henderson <rth@redhat.com>
* exception.c: New file.
* Makefile.in (exception.lo): New.
(OBJS): Add it.
2004-06-14 Andrew Pinski <pinskia@physics.uc.edu>
* linking.m (_objcInit): New empty function
for Darwin only.
2004-06-11 Andrew Pinski <pinskia@physics.uc.edu>
* configure.ac: Support --enable-shared=libobjc.
* configure: Regenerate.
PR libobjc/15901
* configure.ac: Do not disable shared by default.
* configure: Regenerate.
2004-06-03 Nicola Pero <n.pero@mi.flashnet.it>
* Protocol.m ([-isEqual:]): Small optimizations returning
immediately if the argument is equal to self, and accessing
the argument's name directly if it's a protocol.
2004-06-03 David Ayers <d.ayers@inode.at>
* Protocol.m ([-isEqual:]): Test the class of the argument.
2004-05-25 Andrew Pinski <pinskia@physics.uc.edu>
* configure.ac (includedir): Rename to ...
(includedirname).
* Makefile.in: s/includedir/includedirname/.
PR target/11572
* configure.ac (includedir): Set to "include"
except for Darwin.
(libext) Set to empty except for Darwin.
* configure: Regenerate
* Makefile.in: s/libobjc.la/libobjc$(libext).la/g.
s/include/$(includedir)/g.
2004-05-25 Daniel Jacobowitz <drow@false.org>
* Makefile.in: Add .NOEXPORT.
2004-05-25 Andrew Pinski <pinskia@physics.uc.edu>
Merge from the libobjc-branch
2004-02-09 Andrew Pinski <pinskia@physics.uc.edu>
* Makefile.in (OBJC_H): Change objc-deps.h to objc-decls.h.
2004-02-03 Andrew Pinski <pinskia@physics.uc.edu>
* Makefile.in (OBJC_H): Add objc-deps.h.
2004-01-27 Nicola Pero <n.pero@mi.flashnet.it>
* Protocol.m ([-conformsTo:]): If the argument is nil, return NO.
([-hash], [-isEqual:]): New methods.
2004-01-27 Richard Frith-Macdonald <rfm@gnu.org>
* sarray.c (sarray_free): Add a better comment.
2004-01-27 Adam Fedor <fedor@gnu.org>
* hash.c (hash_add): Cast cachep to int.
* selector.c (__sel_register_typed_name): Cast
soffset_decode to int.
2004-01-27 Alexander Malmberg <alexander@malmberg.org>
* selector.c: Rename register_selectors_from_list to
__objc_register_selectors_from_list. Update caller.
(__objc_register_selectors_from_list): Lock __objc_runtime_mutex
while registering selectors. Use __sel_register_typed_name instead
of sel_register_typed_name. Check for NULL method_name:s.
(pool_alloc_selector): New function.
(__sel_register_typed_name): Use pool_alloc_selector to allocate
selector structures.
* sendmsg.c (class_add_method_list): Use
__objc_register_selectors_from_list.
* objc/runtime.h: Add __objc_register_selectors_from_list.
2004-01-25 Adam Fedor <fedor@gnu.org>
Nicola Pero <n.pero@mi.flashnet.it>
Andrew Pinski <pinskia@physics.uc.edu>
* objc/objc-decls.h: New file.
* objc/objc-api.h (_objc_lookup_class): Mark as export.
(_objc_load_callback): Likewise.
(_objc_object_alloc): Likewise.
(_objc_object_copy): Likewise.
(_objc_object_dispose): Likewise.
2004-01-25 Andrew Pinski <pinskia@physics.uc.edu>
* archive.c: s/__inline__/inline
* sendmsg.c: Likewise.
* encoding.c: Remove FIXME about the warning
about unused variable.
* sendmsg.c: Add a FIXME comment saying that
this should be using libffi.
* Makefile.in (LIBTOOL): Use @LIBTOOL@ now as it works.
2004-05-13 Andrew Pinski <pinskia@physics.uc.edu>
* archive.c (objc_read_class): Initialize class_name.
(objc_read_selector): Initialize selector_name.
2004-05-09 Richard Sandiford <rsandifo@redhat.com>
* Makefile.in (toolexecdir): Remove trailing space.
2004-04-15 Nathanael Nerode <neroden@gcc.gnu.org>
PR libobjc/14948
* configure.ac: De-precious CC so multilibs work.
* configure: Regenerate.
2004-04-14 Nathanael Nerode <neroden@gcc.gnu.org>
* configure.ac: Restore toolexecdir.
* Makefile.in: Restore toolexecdir.
* configure: Regenerate.
2004-04-09 Nathanael Nerode <neroden@gcc.gnu.org>
* configure.ac: Remove (unused) glibcpp_prefixdir.
* configure: Regenerate.
* configure.in: Rename to configure.ac.
* Makefile.in: Update to match.
* Makefile.in: Remove toolexecdir, glibcpp_toolexecdir (unused).
Replace glibcpp_toolexeclibdir with toolexeclibdir.
* configure.in: Remove glibcpp_toolexecdir (unused).
Replace glibcpp_toolexeclibdir with toolexeclibdir. Don't generate
config.h or stamp-h (unused). Move one comment to the right place.
* configure: Regenerate.
* config.h.in: Remove (unused).
* config.h.in: Regenerate with autoheader.
* Makefile.in: Remove (unused) gcc_version_trigger.
* configure.in: Remove (unused) glibcpp_builddir. Don't AC_SUBST
gcc_version_trigger.
* configure: Regenerate.
* configure.in: Switch to modern style for AC_INIT, AC_OUTPUT.
Sort file into sections. Remove dnl where appropriate. Fix
other style issues.
* configure: Regenerate.
* configure.in: Replace old AC_PROG_CC hack with new one.
Define toplevel_srcdir in terms of srcdir, not top_srcdir (there
are no subdirectory output files, so this is fine). Change prereq
to autoconf 2.59.
* aclocal.m4: Include ../config/no-executables.m4.
* configure: Regenerate with autoconf 2.59.
* configure.in: Improve comments on gthread_cflags. Improve m4
quotation, and replace 'if test' with 'case', for --enable-objc-gc.
* configure: Regenerate.
* configure.in: Move PACKAGE and VERSION settings up top. Remove
unused call to AC_PROG_LN_S. Default RANLIB to ':'. Remove
redundant checks for values of RANLIB, AR, INSTALL.
* configure: Regenerate.
* configure.in: Clean up handling of
--enable-version-specific-runtime-libs and related variables;
replace 'if test' with 'case' where reasonable. Fix comments.
Remove useless libstdcxx_interface.
* configure: Regenerate.
* configure.in: Use _GCC_TOPLEV_NONCANONICAL_TARGET.
Replace uses of target_alias with target_noncanonical.
* aclocal.m4: Include ../config/acx.m4.
* configure: Regenerate.
* Makefile.in: Replace uses of target_alias with target_noncanonical.
Fix copyright statement.
* configure.in: Hand-inline bulky, confusing macros from
aclocal.m4. Replace references to "GNU Objective C" with "GCC".
Update copyright notice. Remove stuff for automake, which isn't
used in this directory. Remove emacs local variables.
* aclocal.m4: Remove hand-inlined macros. Update copyright notice.
* configure: Regenerate.
2004-03-16 Manfred Hollstein <mh@suse.com>
* Makefile.in, configure.in, configure: Update copyright years.
2004-03-15 Manfred Hollstein <mh@suse.com>
* Makefile.in (LIBOBJC_VERSION, LIBOBJC_GC_VERSION): Use
definition from configure.in.
* configure.in (PACKAGE): Add definition.
(VERSION): Add definition; substitute it in output files.
* configure: Re-generate.
2004-03-05 Ziemowit Laski <zlaski@apple.com>
* objc/hash.h (hash_string, compare_strings):
Add type-casts to make Objective-C++ happy.
* objc/typedstream.h (objc_get_stream_class_version):
Rename parameter from 'class' to 'class_name' to make
Objective-C++ happy.
2004-03-01 Michael Matz <matz@suse.de>
* Makefile.in (ALL_CFLAGS): Add -fno-strict-aliasing.
2004-02-06 Ziemowit Laski <zlaski@apple.com>
* objc/objc-api.h (objc_super): The 'class' field shall
be named 'super_class' #ifdef __cplusplus.
2004-01-17 Andrew Pinski <pinskia@physics.uc.edu>
PR target/10781

View File

@ -1,6 +1,6 @@
# Makefile for GNU Objective C runtime library.
# Copyright (C) 1993, 95-98, 1999, 2001, 2002, 2003
# Free Software Foundation, Inc.
# Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004,
# 2005, 2006 Free Software Foundation, Inc.
#This file is part of GCC.
@ -16,8 +16,8 @@
#You should have received a copy of the GNU General Public License
#along with GCC; see the file COPYING. If not, write to
#the Free Software Foundation, 59 Temple Place - Suite 330,
#Boston, MA 02111-1307, USA. */
#the Free Software Foundation, 51 Franklin Street, Fifth Floor,
#Boston, MA 02110-1301, USA. */
#This was cribbed from the libchill, libiberty and libstdc++
#Makefile.in files. Some of this stuff may be unnecessary and
@ -32,19 +32,24 @@ srcdir = @glibcpp_srcdir@
VPATH = @glibcpp_srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
target_alias = @target_alias@
gcc_version = @gcc_version@
gcc_version_trigger = @gcc_version_trigger@
target_noncanonical = @target_noncanonical@
gcc_version := $(shell cat $(srcdir)/../gcc/BASE-VER)
host_subdir = @host_subdir@
top_srcdir = @top_srcdir@
toplevel_srcdir = @toplevel_srcdir@
toolexecdir = @glibcpp_toolexecdir@
glibcpp_toolexecdir = @glibcpp_toolexecdir@
glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@
multi_basedir = @multi_basedir@
toolexecdir = @toolexecdir@
# Toolexecdir is used only by toolexeclibdir
toolexeclibdir = @toolexeclibdir@
includedirname = @includedirname@
libext = @libext@
extra_ldflags_libobjc = @extra_ldflags_libobjc@
top_builddir = .
libdir = $(exec_prefix)/lib
libsubdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)
libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)
# Multilib support variables.
MULTISRCTOP =
@ -69,32 +74,34 @@ RANLIB = @RANLIB@
CC = @CC@
CFLAGS = @CFLAGS@
WARN_CFLAGS = -W -Wall -Wwrite-strings -Wstrict-prototypes
GTHREAD_FLAGS=@GTHREAD_FLAGS@
ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(WARN_CFLAGS) \
$(GTHREAD_FLAGS) -DIN_GCC -DIN_TARGET_LIBS -fno-strict-aliasing
-DIN_GCC -DIN_TARGET_LIBS -fno-strict-aliasing -fexceptions
# Libtool
# The following strings describe the version of the obj-C library
# begin compiled and compatibility issues.
# Please refer to Libtool documentation about how to manage these
# numbers.
LIBOBJC_VERSION = 1:0:0
LIBOBJC_GC_VERSION = 1:0:0
# @LIBTOOL@ does not get it right, so we hack it in - FIXME
LIBTOOL = ./libtool
LIBOBJC_VERSION = @VERSION@
LIBOBJC_GC_VERSION = @VERSION@
LIBTOOL = @LIBTOOL@
LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile
LIBTOOL_LINK = $(LIBTOOL) --mode=link
LIBTOOL_INSTALL = $(LIBTOOL) --mode=install
LIBTOOL_CLEAN = $(LIBTOOL) --mode=clean
#LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall
INCLUDES = -I$(srcdir)/objc -I$(srcdir)/$(MULTISRCTOP)../gcc \
-I$(srcdir)/$(MULTISRCTOP)../gcc/config -I$(MULTIBUILDTOP)../../gcc \
-I$(srcdir)/$(MULTISRCTOP)../include
OBJC_GCFLAGS=-DOBJC_WITH_GC=1
OBJC_THREAD_FILE=thr-objc
OBJC_BOEHM_GC=@OBJC_BOEHM_GC@
OBJC_BOEHM_GC_INCLUDES=@OBJC_BOEHM_GC_INCLUDES@
INCLUDES = -I$(srcdir)/objc -I$(srcdir)/$(MULTISRCTOP)../gcc \
-I$(srcdir)/$(MULTISRCTOP)../gcc/config \
-I$(MULTIBUILDTOP)../../$(host_subdir)/gcc \
-I$(srcdir)/$(MULTISRCTOP)../include \
$(OBJC_BOEHM_GC_INCLUDES)
.SUFFIXES:
.SUFFIXES: .c .m .lo
@ -130,27 +137,27 @@ FLAGS_TO_PASS = \
"libsubdir=$(libsubdir)" \
"tooldir=$(tooldir)"
all: libobjc.la $(OBJC_BOEHM_GC)
all: libobjc$(libext).la $(OBJC_BOEHM_GC)
: $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
# User-visible header files.
OBJC_H = hash.h objc-list.h sarray.h objc.h objc-api.h \
NXConstStr.h Object.h Protocol.h encoding.h typedstream.h \
thr.h
thr.h objc-decls.h
# Modules that comprise the runtime library.
OBJS = archive.lo class.lo encoding.lo gc.lo hash.lo init.lo linking.lo \
misc.lo nil_method.lo NXConstStr.lo Object.lo objects.lo \
Protocol.lo sarray.lo selector.lo sendmsg.lo thr.lo \
$(OBJC_THREAD_FILE).lo
$(OBJC_THREAD_FILE).lo exception.lo
OBJS_GC = archive_gc.lo class_gc.lo encoding_gc.lo gc_gc.lo hash_gc.lo \
init_gc.lo linking_gc.lo misc_gc.lo nil_method_gc.lo \
NXConstStr_gc.lo Object_gc.lo objects_gc.lo Protocol_gc.lo \
sarray_gc.lo selector_gc.lo sendmsg_gc.lo thr_gc.lo \
$(OBJC_THREAD_FILE)_gc.lo
$(OBJC_THREAD_FILE)_gc.lo exception_gc.lo
runtime-info.h:
echo "" > tmp-runtime.m
@ -252,17 +259,29 @@ $(OBJC_THREAD_FILE)_gc.lo: $(OBJC_THREAD_FILE).c
$(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
$(INCLUDES) $<
doc: info dvi html
exception.lo: exception.c
$(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) \
-fexceptions $(INCLUDES) $<
libobjc.la: $(OBJS)
exception_gc.lo: exception.c
$(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
-fexceptions $(INCLUDES) $<
doc: info dvi pdf html
# No install-html support
.PHONY: install-html
install-html:
libobjc$(libext).la: $(OBJS)
$(LIBTOOL_LINK) $(CC) -o $@ $(OBJS) \
-rpath $(glibcpp_toolexeclibdir) \
-version-info $(LIBOBJC_VERSION)
-rpath $(toolexeclibdir) \
-version-info $(LIBOBJC_VERSION) $(extra_ldflags_libobjc)
libobjc_gc.la: $(OBJS_GC)
libobjc_gc$(libext).la: $(OBJS_GC)
$(LIBTOOL_LINK) $(CC) -o $@ $(OBJS_GC) \
-rpath $(glibcpp_toolexeclibdir) \
-version-info $(LIBOBJC_GC_VERSION)
-rpath $(toolexeclibdir) \
-version-info $(LIBOBJC_GC_VERSION) $(extra_ldflags_libobjc)
#
# FIXME -- The following part does not fit in the libtool context.
@ -295,6 +314,7 @@ libobjc.dll: libobjc_s.a libobjc_entry.o
info:
dvi:
pdf:
html:
Makefile: Makefile.in config.status
@ -305,36 +325,36 @@ config.status: configure
CONFIG_SITE=no-such-file CC='$(CC)' AR='$(AR)' CFLAGS='$(CFLAGS)' \
CPPFLAGS='$(CPPFLAGS)' $(SHELL) config.status --recheck
${srcdir}/configure: configure.in
${srcdir}/configure: @MAINT@ configure.ac
rm -f config.cache
cd ${srcdir} && autoconf
install: install-libs install-headers
install-libs: installdirs
$(SHELL) $(toplevel_srcdir)/mkinstalldirs $(DESTDIR)$(glibcpp_toolexeclibdir)
$(LIBTOOL_INSTALL) $(INSTALL) libobjc.la $(DESTDIR)$(glibcpp_toolexeclibdir);
$(SHELL) $(multi_basedir)/mkinstalldirs $(DESTDIR)$(toolexeclibdir)
$(LIBTOOL_INSTALL) $(INSTALL) libobjc$(libext).la $(DESTDIR)$(toolexeclibdir);
if [ "$(OBJC_BOEHM_GC)" ]; then \
$(LIBTOOL_INSTALL) $(INSTALL) libobjc_gc.la \
$(DESTDIR)$(glibcpp_toolexeclibdir);\
$(LIBTOOL_INSTALL) $(INSTALL) libobjc_gc$(libext).la \
$(DESTDIR)$(toolexeclibdir);\
fi
$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
@-$(LIBTOOL) --mode=finish $(DESTDIR)$(glibcpp_toolexeclibdir)
@-$(LIBTOOL) --mode=finish $(DESTDIR)$(toolexeclibdir)
# Copy Objective C headers to installation include directory.
install-headers:
$(SHELL) $(toplevel_srcdir)/mkinstalldirs $(DESTDIR)$(libsubdir)/include/objc
$(SHELL) $(multi_basedir)/mkinstalldirs $(DESTDIR)$(libsubdir)/$(includedirname)/objc
for file in $(OBJC_H); do \
realfile=$(srcdir)/objc/$${file}; \
$(INSTALL_DATA) $${realfile} $(DESTDIR)$(libsubdir)/include/objc; \
$(INSTALL_DATA) $${realfile} $(DESTDIR)$(libsubdir)/$(includedirname)/objc; \
done
check uninstall install-strip dist installcheck installdirs:
mostlyclean:
-$(LIBTOOL_CLEAN) rm -f libobjc.la libobjc_gc.la *.lo
-$(LIBTOOL_CLEAN) rm -f libobjc$(libext).la libobjc_gc$(libext).la *.lo
-rm -f runtime-info.h tmp-runtime.s *.o *.lo libobjc* xforward \
fflags *.aux *.cp *.dvi *.fn *.info *.ky *.log *.pg \
fflags *.aux *.cp *.dvi *.pdf *.fn *.info *.ky *.log *.pg \
*.toc *.tp *.vr *.html libobj.exp
@$(MULTICLEAN) multi-clean DO=mostlyclean
@ -350,3 +370,7 @@ maintainer-clean realclean: distclean
.PHONY: mostlyclean clean distclean maintainer-clean all check uninstall \
install-strip dist installcheck installdirs
# Don't export variables to the environment, in order to not confuse
# configure.
.NOEXPORT:

View File

@ -16,8 +16,8 @@ License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files
compiled with GCC to produce an executable, this does not cause

View File

@ -15,8 +15,8 @@ License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled
with GCC to produce an executable, this does not cause the resulting

View File

@ -1,5 +1,5 @@
/* This file contains the implementation of class Protocol.
Copyright (C) 1993 Free Software Foundation, Inc.
Copyright (C) 1993, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@ -15,8 +15,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files
compiled with GCC to produce an executable, this does not cause
@ -56,6 +56,9 @@ struct objc_method_description_list {
size_t i;
struct objc_protocol_list* proto_list;
if (aProtocolObject == nil)
return NO;
if (!strcmp(aProtocolObject->protocol_name, self->protocol_name))
return YES;
@ -129,4 +132,51 @@ struct objc_method_description_list {
return NULL;
}
- (unsigned) hash
{
/* Compute a hash of the protocol_name; use the same hash algorithm
* that we use for class names; protocol names and class names are
* somewhat similar types of string spaces.
*/
int hash = 0, index;
for (index = 0; protocol_name[index] != '\0'; index++)
{
hash = (hash << 4) ^ (hash >> 28) ^ protocol_name[index];
}
hash = (hash ^ (hash >> 10) ^ (hash >> 20));
return hash;
}
/*
* Equality between formal protocols is only formal (nothing to do
* with actually checking the list of methods they have!). Two formal
* Protocols are equal if and only if they have the same name.
*
* Please note (for comparisons with other implementations) that
* checking the names is equivalent to checking that Protocol A
* conforms to Protocol B and Protocol B conforms to Protocol A,
* because this happens iff they have the same name. If they have
* different names, A conforms to B if and only if A includes B, but
* the situation where A includes B and B includes A is a circular
* dependency between Protocols which is forbidden by the compiler, so
* A conforms to B and B conforms to A with A and B having different
* names is an impossible case.
*/
- (BOOL) isEqual: (id)obj
{
if (obj == self)
return YES;
if ([obj isKindOf: [Protocol class]])
{
if (strcmp (protocol_name, ((Protocol *)obj)->protocol_name) == 0)
return YES;
}
return NO;
}
@end

View File

@ -0,0 +1,24 @@
dnl Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2004
dnl Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
m4_include(../config/acx.m4)
m4_include(../config/no-executables.m4)
m4_include(../libtool.m4)
dnl The lines below arrange for aclocal not to bring an installed
dnl libtool.m4 into aclocal.m4, while still arranging for automake to
dnl add a definition of LIBTOOL to Makefile.in.
ifelse(yes,no,[
AC_DEFUN([AM_PROG_LIBTOOL],)
AC_DEFUN([AC_LIBTOOL_DLOPEN],)
AC_DEFUN([AC_LIBLTDL_CONVENIENCE],)
AC_SUBST(LIBTOOL)
])

View File

@ -1,235 +1,158 @@
dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
dnl
dnl Initialize configure bits.
dnl
dnl GLIBCPP_TOPREL_CONFIGURE
AC_DEFUN(GLIBCPP_TOPREL_CONFIGURE, [
dnl Default to --enable-multilib
AC_ARG_ENABLE(multilib,
[ --enable-multilib build hella library versions (default)],
[case "${enableval}" in
yes) multilib=yes ;;
no) multilib=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
esac], [multilib=yes])dnl
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# When building with srcdir == objdir, links to the source files will
# be created in directories within the target_subdir. We have to
# adjust toplevel_srcdir accordingly, so that configure finds
# install-sh and other auxiliary files that live in the top-level
# source directory.
if test "${srcdir}" = "."; then
if test -z "${with_target_subdir}"; then
toprel=".."
else
if test "${with_target_subdir}" != "."; then
toprel="${with_multisrctop}../.."
else
toprel="${with_multisrctop}.."
fi
fi
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
# therefore $ac_aux_dir as well) can be either absolute or relative,
# depending on how configure is run. This is pretty annoying, since
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
# source directory, any form will work fine, but in subdirectories a
# relative path needs to be adjusted first.
#
# $ac_aux_dir/missing
# fails when called from a subdirectory if $ac_aux_dir is relative
# $top_srcdir/$ac_aux_dir/missing
# fails if $ac_aux_dir is absolute,
# fails when called from a subdirectory in a VPATH build with
# a relative $ac_aux_dir
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is `.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
# and then we would define $MISSING as
# MISSING="\${SHELL} $am_aux_dir/missing"
# This will work as long as MISSING is not called from configure, because
# unfortunately $(top_srcdir) has no meaning in configure.
# However there are other variables, like CC, which are often used in
# configure, and could therefore not use this "fixed" $ac_aux_dir.
#
# Another solution, used here, is to always expand $ac_aux_dir to an
# absolute PATH. The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
[dnl Rely on autoconf to set up CDPATH properly.
AC_PREREQ([2.50])dnl
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
])
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 7
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ(2.52)dnl
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])
AC_SUBST([$1_FALSE])
if $2; then
$1_TRUE=
$1_FALSE='#'
else
toprel=".."
$1_TRUE='#'
$1_FALSE=
fi
AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
toplevel_srcdir=\${top_srcdir}/$toprel
AC_SUBST(toplevel_srcdir)
])
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])
dnl
dnl Initialize configure bits.
dnl
dnl GLIBCPP_CONFIGURE
AC_DEFUN(GLIBCPP_CONFIGURE, [
# Export build and source directories.
# These need to be absolute paths, yet at the same time need to
# canonicalize only relative paths, because then amd will not unmount
# drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
glibcpp_builddir=`${PWDCMD-pwd}`
case $srcdir in
[\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
*) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
esac
AC_SUBST(glibcpp_builddir)
AC_SUBST(glibcpp_srcdir)
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
dnl This is here just to satisfy automake.
ifelse(not,equal,[AC_CONFIG_AUX_DIR(..)])
# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# Will set LN_S to either 'ln -s' or 'ln'. With autoconf 2.50+, can also
# be 'cp -p' if linking isn't available.
#ac_cv_prog_LN_S='cp -p'
AC_PROG_LN_S
# serial 4
# We use these options to decide which functions to include.
AC_ARG_WITH(target-subdir,
[ --with-target-subdir=SUBDIR
configuring in a subdirectory])
AC_ARG_WITH(cross-host,
[ --with-cross-host=HOST configuring with a cross compiler])
AC_DEFUN([AM_MAINTAINER_MODE],
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode is disabled by default
AC_ARG_ENABLE(maintainer-mode,
[ --enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer],
USE_MAINTAINER_MODE=$enableval,
USE_MAINTAINER_MODE=no)
AC_MSG_RESULT([$USE_MAINTAINER_MODE])
AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
MAINT=$MAINTAINER_MODE_TRUE
AC_SUBST(MAINT)dnl
]
)
# Never versions of autoconf add an underscore to these functions.
# Prevent future problems ...
ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))])
AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
# AC_PROG_CC
# Copyright (C) 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
# are probably using a cross compiler, which will not be able to fully
# link an executable. This should really be fixed in autoconf
# itself.
# serial 3
AC_DEFUN(LIB_AC_PROG_CC,
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
dnl Fool anybody using AC_PROG_CC.
AC_PROVIDE([AC_PROG_CC])
AC_CHECK_PROG(CC, gcc, gcc)
if test -z "$CC"; then
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
fi
AC_PROG_CC_GNU
if test $ac_cv_prog_gcc = yes; then
GCC=yes
dnl Check whether -g works, even if CFLAGS is set, in case the package
dnl plays around with CFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
AC_PROG_CC_G
if test "$ac_test_CFLAGS" = set; then
CFLAGS="$ac_save_CFLAGS"
elif test $ac_cv_prog_cc_g = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-O2"
fi
else
GCC=
test "${CFLAGS+set}" = set || CFLAGS="-g"
# AM_PROG_CC_C_O
# --------------
# Like AC_PROG_CC_C_O, but changed for automake.
AC_DEFUN([AM_PROG_CC_C_O],
[AC_REQUIRE([AC_PROG_CC_C_O])dnl
AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
# FIXME: we rely on the cache variable name because
# there is no other way.
set dummy $CC
ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
# Losing compiler, so override with the script.
# FIXME: It is wrong to rewrite CC.
# But if we don't then we get into trouble of one sort or another.
# A longer-term fix would be to have automake use am__CC in this case,
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
CC="$am_aux_dir/compile $CC"
fi
])
LIB_AC_PROG_CC
AC_CHECK_TOOL(AS, as)
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
AC_PROG_INSTALL
# We need AC_EXEEXT to keep automake happy in cygnus mode. However,
# at least currently, we never actually build a program, so we never
# need to use $(EXEEXT). Moreover, the test for EXEEXT normally
# fails, because we are probably configuring with a cross compiler
# which can't create executables. So we include AC_EXEEXT to keep
# automake happy, but we don't execute it, since we don't care about
# the result.
if false; then
# autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
# to nothing, so nothing would remain between `then' and `fi' if it
# were not for the `:' below.
:
AC_EXEEXT
fi
])
dnl
dnl GLIBCPP_EXPORT_INSTALL_INFO
dnl calculates gxx_install_dir
dnl exports glibcpp_toolexecdir
dnl exports glibcpp_toolexeclibdir
dnl exports glibcpp_prefixdir
dnl
dnl Assumes cross_compiling bits already done, and with_cross_host in
dnl particular
dnl
dnl GLIBCPP_EXPORT_INSTALL_INFO
AC_DEFUN(GLIBCPP_EXPORT_INSTALL_INFO, [
# Assumes glibcpp_builddir, glibcpp_srcdir are alreay set up and
# exported correctly in GLIBCPP_CONFIGURE.
glibcpp_toolexecdir=no
glibcpp_toolexeclibdir=no
glibcpp_prefixdir=${prefix}
AC_MSG_CHECKING([for interface version number])
libstdcxx_interface=$INTERFACE
AC_MSG_RESULT($libstdcxx_interface)
# Process the option "--enable-version-specific-runtime-libs"
AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
AC_ARG_ENABLE(version-specific-runtime-libs,
[ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
[case "$enableval" in
yes) version_specific_libs=yes ;;
no) version_specific_libs=no ;;
*) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
esac],
version_specific_libs=no)dnl
# Option set, now we can test it.
AC_MSG_RESULT($version_specific_libs)
gcc_version_trigger=${srcdir}/../gcc/version.c
gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/'`
gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
AC_SUBST(gcc_version)
AC_SUBST(gcc_version_trigger)
if test $version_specific_libs = yes; then
# Need the gcc compiler version to know where to install libraries
# and header files if --enable-version-specific-runtime-libs option
# is selected.
changequote(,)dnl
glibcpp_toolexecdir='$(libdir)/gcc/$(target_alias)'
glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
changequote([,])dnl
fi
# Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir
# Install a library built with a cross compiler in tooldir, not libdir.
if test x"$glibcpp_toolexecdir" = x"no"; then
if test -n "$with_cross_host" &&
test x"$with_cross_host" != x"no"; then
glibcpp_toolexecdir='$(exec_prefix)/$(target_alias)'
glibcpp_toolexeclibdir='$(toolexecdir)/lib'
else
glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
glibcpp_toolexeclibdir='$(libdir)'
fi
multi_os_directory=`$CC -print-multi-os-directory`
case $multi_os_directory in
.) ;; # Avoid trailing /.
*) glibcpp_toolexeclibdir=$glibcpp_toolexeclibdir/$multi_os_directory ;;
esac
fi
AC_SUBST(glibcpp_prefixdir)
AC_SUBST(glibcpp_toolexecdir)
AC_SUBST(glibcpp_toolexeclibdir)
])
sinclude(../libtool.m4)
dnl The lines below arrange for aclocal not to bring an installed
dnl libtool.m4 into aclocal.m4, while still arranging for automake to
dnl add a definition of LIBTOOL to Makefile.in.
ifelse(,,,[AC_SUBST(LIBTOOL)
AC_DEFUN([AM_PROG_LIBTOOL])
AC_DEFUN([AC_LIBTOOL_DLOPEN])
AC_DEFUN([AC_PROG_LD])
])
m4_include([../config/multi.m4])
m4_include([acinclude.m4])

View File

@ -1,5 +1,5 @@
/* GNU Objective C Runtime archiving
Copyright (C) 1993, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
Copyright (C) 1993, 1995, 1996, 1997, 2002, 2004 Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup
This file is part of GCC.
@ -15,8 +15,8 @@ details.
You should have received a copy of the GNU General Public License along with
GCC; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -25,9 +25,9 @@ Boston, MA 02111-1307, USA. */
covered by the GNU General Public License. */
#include "tconfig.h"
#include "runtime.h"
#include "typedstream.h"
#include "encoding.h"
#include "objc/runtime.h"
#include "objc/typedstream.h"
#include "objc/encoding.h"
#include <stdlib.h>
extern int fflush (FILE *);
@ -62,7 +62,7 @@ const char *objc_skip_type (const char *type);
static void __objc_finish_write_root_object (struct objc_typed_stream *);
static void __objc_finish_read_root_object (struct objc_typed_stream *);
static __inline__ int
static inline int
__objc_code_unsigned_char (unsigned char *buf, unsigned char val)
{
if ((val&_B_VALUE) == val)
@ -84,10 +84,10 @@ objc_write_unsigned_char (struct objc_typed_stream *stream,
{
unsigned char buf[sizeof (unsigned char) + 1];
int len = __objc_code_unsigned_char (buf, value);
return (*stream->write) (stream->physical, buf, len);
return (*stream->write) (stream->physical, (char*)buf, len);
}
static __inline__ int
static inline int
__objc_code_char (unsigned char *buf, signed char val)
{
if (val >= 0)
@ -105,10 +105,10 @@ objc_write_char (struct objc_typed_stream *stream, signed char value)
{
unsigned char buf[sizeof (char) + 1];
int len = __objc_code_char (buf, value);
return (*stream->write) (stream->physical, buf, len);
return (*stream->write) (stream->physical, (char*)buf, len);
}
static __inline__ int
static inline int
__objc_code_unsigned_short (unsigned char *buf, unsigned short val)
{
if ((val&_B_VALUE) == val)
@ -143,10 +143,10 @@ objc_write_unsigned_short (struct objc_typed_stream *stream,
{
unsigned char buf[sizeof (unsigned short) + 1];
int len = __objc_code_unsigned_short (buf, value);
return (*stream->write) (stream->physical, buf, len);
return (*stream->write) (stream->physical, (char*)buf, len);
}
static __inline__ int
static inline int
__objc_code_short (unsigned char *buf, short val)
{
int sign = (val < 0);
@ -161,11 +161,11 @@ objc_write_short (struct objc_typed_stream *stream, short value)
{
unsigned char buf[sizeof (short) + 1];
int len = __objc_code_short (buf, value);
return (*stream->write) (stream->physical, buf, len);
return (*stream->write) (stream->physical, (char*)buf, len);
}
static __inline__ int
static inline int
__objc_code_unsigned_int (unsigned char *buf, unsigned int val)
{
if ((val&_B_VALUE) == val)
@ -199,10 +199,10 @@ objc_write_unsigned_int (struct objc_typed_stream *stream, unsigned int value)
{
unsigned char buf[sizeof (unsigned int) + 1];
int len = __objc_code_unsigned_int (buf, value);
return (*stream->write) (stream->physical, buf, len);
return (*stream->write) (stream->physical, (char*)buf, len);
}
static __inline__ int
static inline int
__objc_code_int (unsigned char *buf, int val)
{
int sign = (val < 0);
@ -217,10 +217,10 @@ objc_write_int (struct objc_typed_stream *stream, int value)
{
unsigned char buf[sizeof (int) + 1];
int len = __objc_code_int (buf, value);
return (*stream->write) (stream->physical, buf, len);
return (*stream->write) (stream->physical, (char*)buf, len);
}
static __inline__ int
static inline int
__objc_code_unsigned_long (unsigned char *buf, unsigned long val)
{
if ((val&_B_VALUE) == val)
@ -255,10 +255,10 @@ objc_write_unsigned_long (struct objc_typed_stream *stream,
{
unsigned char buf[sizeof (unsigned long) + 1];
int len = __objc_code_unsigned_long (buf, value);
return (*stream->write) (stream->physical, buf, len);
return (*stream->write) (stream->physical, (char*)buf, len);
}
static __inline__ int
static inline int
__objc_code_long (unsigned char *buf, long val)
{
int sign = (val < 0);
@ -273,7 +273,7 @@ objc_write_long (struct objc_typed_stream *stream, long value)
{
unsigned char buf[sizeof (long) + 1];
int len = __objc_code_long (buf, value);
return (*stream->write) (stream->physical, buf, len);
return (*stream->write) (stream->physical, (char*)buf, len);
}
@ -290,8 +290,8 @@ objc_write_string (struct objc_typed_stream *stream,
else /* _B_NINT */
buf[0] = (buf[0]&_B_VALUE)|_B_NSTR;
if ((*stream->write) (stream->physical, buf, len) != 0)
return (*stream->write) (stream->physical, string, nbytes);
if ((*stream->write) (stream->physical, (char*)buf, len) != 0)
return (*stream->write) (stream->physical, (char*)string, nbytes);
else
return 0;
}
@ -301,12 +301,13 @@ objc_write_string_atomic (struct objc_typed_stream *stream,
unsigned char *string, unsigned int nbytes)
{
unsigned long key;
if ((key = PTR2LONG(hash_value_for_key (stream->stream_table, string))))
if ((key = PTR2LONG(objc_hash_value_for_key (stream->stream_table, string))))
return objc_write_use_common (stream, key);
else
{
int length;
hash_add (&stream->stream_table, LONG2PTR(key=PTR2LONG(string)), string);
objc_hash_add (&stream->stream_table,
LONG2PTR(key=PTR2LONG(string)), string);
if ((length = objc_write_register_common (stream, key)))
return objc_write_string (stream, string, nbytes);
return length;
@ -323,12 +324,12 @@ objc_write_register_common (struct objc_typed_stream *stream,
{
buf[0] = _B_RCOMM|0x01;
buf[1] &= _B_VALUE;
return (*stream->write) (stream->physical, buf, len + 1);
return (*stream->write) (stream->physical, (char*)buf, len + 1);
}
else
{
buf[1] = (buf[1]&_B_VALUE)|_B_RCOMM;
return (*stream->write) (stream->physical, buf + 1, len);
return (*stream->write) (stream->physical, (char*)buf + 1, len);
}
}
@ -341,22 +342,22 @@ objc_write_use_common (struct objc_typed_stream *stream, unsigned long key)
{
buf[0] = _B_UCOMM|0x01;
buf[1] &= _B_VALUE;
return (*stream->write) (stream->physical, buf, 2);
return (*stream->write) (stream->physical, (char*)buf, 2);
}
else
{
buf[1] = (buf[1]&_B_VALUE)|_B_UCOMM;
return (*stream->write) (stream->physical, buf + 1, len);
return (*stream->write) (stream->physical, (char*)buf + 1, len);
}
}
static __inline__ int
static inline int
__objc_write_extension (struct objc_typed_stream *stream, unsigned char code)
{
if (code <= _B_VALUE)
{
unsigned char buf = code|_B_EXT;
return (*stream->write) (stream->physical, &buf, 1);
return (*stream->write) (stream->physical, (char*)&buf, 1);
}
else
{
@ -366,7 +367,7 @@ __objc_write_extension (struct objc_typed_stream *stream, unsigned char code)
}
}
__inline__ int
inline int
__objc_write_object (struct objc_typed_stream *stream, id object)
{
unsigned char buf = '\0';
@ -376,7 +377,7 @@ __objc_write_object (struct objc_typed_stream *stream, id object)
__objc_write_extension (stream, _BX_OBJECT);
objc_write_class (stream, object->class_pointer);
(*objc_msg_lookup (object, write_sel)) (object, write_sel, stream);
return (*stream->write) (stream->physical, &buf, 1);
return (*stream->write) (stream->physical, (char*)&buf, 1);
}
else
return objc_write_use_common (stream, 0);
@ -386,7 +387,7 @@ int
objc_write_object_reference (struct objc_typed_stream *stream, id object)
{
unsigned long key;
if ((key = PTR2LONG(hash_value_for_key (stream->object_table, object))))
if ((key = PTR2LONG(objc_hash_value_for_key (stream->object_table, object))))
return objc_write_use_common (stream, key);
__objc_write_extension (stream, _BX_OBJREF);
@ -415,7 +416,7 @@ int
objc_write_object (struct objc_typed_stream *stream, id object)
{
unsigned long key;
if ((key = PTR2LONG(hash_value_for_key (stream->object_table, object))))
if ((key = PTR2LONG(objc_hash_value_for_key (stream->object_table, object))))
return objc_write_use_common (stream, key);
else if (object == nil)
@ -424,18 +425,19 @@ objc_write_object (struct objc_typed_stream *stream, id object)
else
{
int length;
hash_add (&stream->object_table, LONG2PTR(key=PTR2LONG(object)), object);
objc_hash_add (&stream->object_table,
LONG2PTR(key=PTR2LONG(object)), object);
if ((length = objc_write_register_common (stream, key)))
return __objc_write_object (stream, object);
return length;
}
}
__inline__ int
inline int
__objc_write_class (struct objc_typed_stream *stream, struct objc_class *class)
{
__objc_write_extension (stream, _BX_CLASS);
objc_write_string_atomic (stream, (char *) class->name,
objc_write_string_atomic (stream, (unsigned char *) class->name,
strlen ((char *) class->name));
return objc_write_unsigned_long (stream, class->version);
}
@ -446,12 +448,13 @@ objc_write_class (struct objc_typed_stream *stream,
struct objc_class *class)
{
unsigned long key;
if ((key = PTR2LONG(hash_value_for_key (stream->stream_table, class))))
if ((key = PTR2LONG(objc_hash_value_for_key (stream->stream_table, class))))
return objc_write_use_common (stream, key);
else
{
int length;
hash_add (&stream->stream_table, LONG2PTR(key = PTR2LONG(class)), class);
objc_hash_add (&stream->stream_table,
LONG2PTR(key = PTR2LONG(class)), class);
if ((length = objc_write_register_common (stream, key)))
return __objc_write_class (stream, class);
return length;
@ -459,16 +462,16 @@ objc_write_class (struct objc_typed_stream *stream,
}
__inline__ int
inline int
__objc_write_selector (struct objc_typed_stream *stream, SEL selector)
{
const char *sel_name;
__objc_write_extension (stream, _BX_SEL);
/* to handle NULL selectors */
if ((SEL)0 == selector)
return objc_write_string (stream, "", 0);
return objc_write_string (stream, (unsigned char*)"", 0);
sel_name = sel_get_name (selector);
return objc_write_string (stream, sel_name, strlen ((char*)sel_name));
return objc_write_string (stream, (unsigned char*)sel_name, strlen ((char*)sel_name));
}
int
@ -482,12 +485,13 @@ objc_write_selector (struct objc_typed_stream *stream, SEL selector)
return __objc_write_selector (stream, selector);
sel_name = sel_get_name (selector);
if ((key = PTR2LONG(hash_value_for_key (stream->stream_table, sel_name))))
if ((key = PTR2LONG(objc_hash_value_for_key (stream->stream_table,
sel_name))))
return objc_write_use_common (stream, key);
else
{
int length;
hash_add (&stream->stream_table,
objc_hash_add (&stream->stream_table,
LONG2PTR(key = PTR2LONG(sel_name)), (char *) sel_name);
if ((length = objc_write_register_common (stream, key)))
return __objc_write_selector (stream, selector);
@ -501,12 +505,12 @@ objc_write_selector (struct objc_typed_stream *stream, SEL selector)
** Read operations
*/
__inline__ int
inline int
objc_read_char (struct objc_typed_stream *stream, char *val)
{
unsigned char buf;
int len;
len = (*stream->read) (stream->physical, &buf, 1);
len = (*stream->read) (stream->physical, (char*)&buf, 1);
if (len != 0)
{
if ((buf & _B_CODE) == _B_SINT)
@ -528,18 +532,18 @@ objc_read_char (struct objc_typed_stream *stream, char *val)
}
__inline__ int
inline int
objc_read_unsigned_char (struct objc_typed_stream *stream, unsigned char *val)
{
unsigned char buf;
int len;
if ((len = (*stream->read) (stream->physical, &buf, 1)))
if ((len = (*stream->read) (stream->physical, (char*)&buf, 1)))
{
if ((buf & _B_CODE) == _B_SINT)
(*val) = (buf & _B_VALUE);
else if ((buf & _B_NUMBER) == 1)
len = (*stream->read) (stream->physical, val, 1);
len = (*stream->read) (stream->physical, (char*)val, 1);
else
objc_error (nil, OBJC_ERR_BAD_DATA,
@ -549,12 +553,12 @@ objc_read_unsigned_char (struct objc_typed_stream *stream, unsigned char *val)
return len;
}
__inline__ int
inline int
objc_read_short (struct objc_typed_stream *stream, short *value)
{
unsigned char buf[sizeof (short) + 1];
int len;
if ((len = (*stream->read) (stream->physical, buf, 1)))
if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
{
if ((buf[0] & _B_CODE) == _B_SINT)
(*value) = (buf[0] & _B_VALUE);
@ -566,7 +570,7 @@ objc_read_short (struct objc_typed_stream *stream, short *value)
if (nbytes > (int) sizeof (short))
objc_error (nil, OBJC_ERR_BAD_DATA,
"expected short, got bigger (%dbits)", nbytes*8);
len = (*stream->read) (stream->physical, buf + 1, nbytes);
len = (*stream->read) (stream->physical, (char*)buf + 1, nbytes);
(*value) = 0;
while (pos <= nbytes)
(*value) = ((*value)*0x100) + buf[pos++];
@ -577,13 +581,13 @@ objc_read_short (struct objc_typed_stream *stream, short *value)
return len;
}
__inline__ int
inline int
objc_read_unsigned_short (struct objc_typed_stream *stream,
unsigned short *value)
{
unsigned char buf[sizeof (unsigned short) + 1];
int len;
if ((len = (*stream->read) (stream->physical, buf, 1)))
if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
{
if ((buf[0] & _B_CODE) == _B_SINT)
(*value) = (buf[0] & _B_VALUE);
@ -595,7 +599,7 @@ objc_read_unsigned_short (struct objc_typed_stream *stream,
if (nbytes > (int) sizeof (short))
objc_error (nil, OBJC_ERR_BAD_DATA,
"expected short, got int or bigger");
len = (*stream->read) (stream->physical, buf + 1, nbytes);
len = (*stream->read) (stream->physical, (char*)buf + 1, nbytes);
(*value) = 0;
while (pos <= nbytes)
(*value) = ((*value)*0x100) + buf[pos++];
@ -605,12 +609,12 @@ objc_read_unsigned_short (struct objc_typed_stream *stream,
}
__inline__ int
inline int
objc_read_int (struct objc_typed_stream *stream, int *value)
{
unsigned char buf[sizeof (int) + 1];
int len;
if ((len = (*stream->read) (stream->physical, buf, 1)))
if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
{
if ((buf[0] & _B_CODE) == _B_SINT)
(*value) = (buf[0] & _B_VALUE);
@ -621,7 +625,7 @@ objc_read_int (struct objc_typed_stream *stream, int *value)
int nbytes = buf[0] & _B_NUMBER;
if (nbytes > (int) sizeof (int))
objc_error (nil, OBJC_ERR_BAD_DATA, "expected int, got bigger");
len = (*stream->read) (stream->physical, buf + 1, nbytes);
len = (*stream->read) (stream->physical, (char*)buf + 1, nbytes);
(*value) = 0;
while (pos <= nbytes)
(*value) = ((*value)*0x100) + buf[pos++];
@ -632,12 +636,12 @@ objc_read_int (struct objc_typed_stream *stream, int *value)
return len;
}
__inline__ int
inline int
objc_read_long (struct objc_typed_stream *stream, long *value)
{
unsigned char buf[sizeof (long) + 1];
int len;
if ((len = (*stream->read) (stream->physical, buf, 1)))
if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
{
if ((buf[0] & _B_CODE) == _B_SINT)
(*value) = (buf[0] & _B_VALUE);
@ -648,7 +652,7 @@ objc_read_long (struct objc_typed_stream *stream, long *value)
int nbytes = buf[0] & _B_NUMBER;
if (nbytes > (int) sizeof (long))
objc_error (nil, OBJC_ERR_BAD_DATA, "expected long, got bigger");
len = (*stream->read) (stream->physical, buf + 1, nbytes);
len = (*stream->read) (stream->physical, (char*)buf + 1, nbytes);
(*value) = 0;
while (pos <= nbytes)
(*value) = ((*value)*0x100) + buf[pos++];
@ -659,7 +663,7 @@ objc_read_long (struct objc_typed_stream *stream, long *value)
return len;
}
__inline__ int
inline int
__objc_read_nbyte_uint (struct objc_typed_stream *stream,
unsigned int nbytes, unsigned int *val)
{
@ -670,7 +674,7 @@ __objc_read_nbyte_uint (struct objc_typed_stream *stream,
if (nbytes > sizeof (int))
objc_error (nil, OBJC_ERR_BAD_DATA, "expected int, got bigger");
len = (*stream->read) (stream->physical, buf, nbytes);
len = (*stream->read) (stream->physical, (char*)buf, nbytes);
(*val) = 0;
while (pos < nbytes)
(*val) = ((*val)*0x100) + buf[pos++];
@ -678,13 +682,13 @@ __objc_read_nbyte_uint (struct objc_typed_stream *stream,
}
__inline__ int
inline int
objc_read_unsigned_int (struct objc_typed_stream *stream,
unsigned int *value)
{
unsigned char buf[sizeof (unsigned int) + 1];
int len;
if ((len = (*stream->read) (stream->physical, buf, 1)))
if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
{
if ((buf[0] & _B_CODE) == _B_SINT)
(*value) = (buf[0] & _B_VALUE);
@ -707,7 +711,7 @@ __objc_read_nbyte_ulong (struct objc_typed_stream *stream,
if (nbytes > sizeof (long))
objc_error (nil, OBJC_ERR_BAD_DATA, "expected long, got bigger");
len = (*stream->read) (stream->physical, buf, nbytes);
len = (*stream->read) (stream->physical, (char*)buf, nbytes);
(*val) = 0;
while (pos < nbytes)
(*val) = ((*val)*0x100) + buf[pos++];
@ -715,13 +719,13 @@ __objc_read_nbyte_ulong (struct objc_typed_stream *stream,
}
__inline__ int
inline int
objc_read_unsigned_long (struct objc_typed_stream *stream,
unsigned long *value)
{
unsigned char buf[sizeof (unsigned long) + 1];
int len;
if ((len = (*stream->read) (stream->physical, buf, 1)))
if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
{
if ((buf[0] & _B_CODE) == _B_SINT)
(*value) = (buf[0] & _B_VALUE);
@ -733,20 +737,20 @@ objc_read_unsigned_long (struct objc_typed_stream *stream,
return len;
}
__inline__ int
inline int
objc_read_string (struct objc_typed_stream *stream,
char **string)
{
unsigned char buf[sizeof (unsigned int) + 1];
int len;
if ((len = (*stream->read) (stream->physical, buf, 1)))
if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
{
unsigned long key = 0;
if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */
{
len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
len = (*stream->read) (stream->physical, buf, 1);
len = (*stream->read) (stream->physical, (char*)buf, 1);
}
switch (buf[0]&_B_CODE) {
@ -755,7 +759,7 @@ objc_read_string (struct objc_typed_stream *stream,
int length = buf[0]&_B_VALUE;
(*string) = (char*)objc_malloc (length + 1);
if (key)
hash_add (&stream->stream_table, LONG2PTR(key), *string);
objc_hash_add (&stream->stream_table, LONG2PTR(key), *string);
len = (*stream->read) (stream->physical, *string, length);
(*string)[length] = '\0';
}
@ -765,7 +769,7 @@ objc_read_string (struct objc_typed_stream *stream,
{
char *tmp;
len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
tmp = hash_value_for_key (stream->stream_table, LONG2PTR (key));
tmp = objc_hash_value_for_key (stream->stream_table, LONG2PTR (key));
*string = objc_malloc (strlen (tmp) + 1);
strcpy (*string, tmp);
}
@ -778,7 +782,7 @@ objc_read_string (struct objc_typed_stream *stream,
if (len) {
(*string) = (char*)objc_malloc (nbytes + 1);
if (key)
hash_add (&stream->stream_table, LONG2PTR(key), *string);
objc_hash_add (&stream->stream_table, LONG2PTR(key), *string);
len = (*stream->read) (stream->physical, *string, nbytes);
(*string)[nbytes] = '\0';
}
@ -800,7 +804,7 @@ objc_read_object (struct objc_typed_stream *stream, id *object)
{
unsigned char buf[sizeof (unsigned int)];
int len;
if ((len = (*stream->read) (stream->physical, buf, 1)))
if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
{
SEL read_sel = sel_get_any_uid ("read:");
unsigned long key = 0;
@ -808,7 +812,7 @@ objc_read_object (struct objc_typed_stream *stream, id *object)
if ((buf[0]&_B_CODE) == _B_RCOMM) /* register common */
{
len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
len = (*stream->read) (stream->physical, buf, 1);
len = (*stream->read) (stream->physical, (char*)buf, 1);
}
if (buf[0] == (_B_EXT | _BX_OBJECT))
@ -823,14 +827,14 @@ objc_read_object (struct objc_typed_stream *stream, id *object)
/* register? */
if (key)
hash_add (&stream->object_table, LONG2PTR(key), *object);
objc_hash_add (&stream->object_table, LONG2PTR(key), *object);
/* send -read: */
if (__objc_responds_to (*object, read_sel))
(*get_imp (class, read_sel)) (*object, read_sel, stream);
/* check null-byte */
len = (*stream->read) (stream->physical, buf, 1);
len = (*stream->read) (stream->physical, (char*)buf, 1);
if (buf[0] != '\0')
objc_error (nil, OBJC_ERR_BAD_DATA,
"expected null-byte, got opcode %c", buf[0]);
@ -841,17 +845,19 @@ objc_read_object (struct objc_typed_stream *stream, id *object)
if (key)
objc_error (nil, OBJC_ERR_BAD_KEY, "cannot register use upcode...");
len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
(*object) = hash_value_for_key (stream->object_table, LONG2PTR(key));
(*object) = objc_hash_value_for_key (stream->object_table,
LONG2PTR(key));
}
else if (buf[0] == (_B_EXT | _BX_OBJREF)) /* a forward reference */
{
struct objc_list *other;
len = objc_read_unsigned_long (stream, &key);
other = (struct objc_list *) hash_value_for_key (stream->object_refs,
other
= (struct objc_list *) objc_hash_value_for_key (stream->object_refs,
LONG2PTR(key));
hash_add (&stream->object_refs, LONG2PTR(key),
(void *)list_cons (object, other));
objc_hash_add (&stream->object_refs, LONG2PTR(key),
(void *)list_cons (object, other));
}
else if (buf[0] == (_B_EXT | _BX_OBJROOT)) /* a root object */
@ -875,19 +881,20 @@ objc_read_class (struct objc_typed_stream *stream, Class *class)
{
unsigned char buf[sizeof (unsigned int)];
int len;
if ((len = (*stream->read) (stream->physical, buf, 1)))
if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
{
unsigned long key = 0;
if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */
{
len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
len = (*stream->read) (stream->physical, buf, 1);
len = (*stream->read) (stream->physical, (char*)buf, 1);
}
if (buf[0] == (_B_EXT | _BX_CLASS))
{
char *class_name;
char temp[1] = "";
char *class_name = temp;
unsigned long version;
/* get class */
@ -897,10 +904,11 @@ objc_read_class (struct objc_typed_stream *stream, Class *class)
/* register */
if (key)
hash_add (&stream->stream_table, LONG2PTR(key), *class);
objc_hash_add (&stream->stream_table, LONG2PTR(key), *class);
objc_read_unsigned_long (stream, &version);
hash_add (&stream->class_table, (*class)->name, (void *)version);
objc_hash_add (&stream->class_table,
(*class)->name, (void *)version);
}
else if ((buf[0]&_B_CODE) == _B_UCOMM)
@ -908,7 +916,8 @@ 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 = objc_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);
@ -926,19 +935,20 @@ objc_read_selector (struct objc_typed_stream *stream, SEL* selector)
{
unsigned char buf[sizeof (unsigned int)];
int len;
if ((len = (*stream->read) (stream->physical, buf, 1)))
if ((len = (*stream->read) (stream->physical, (char*)buf, 1)))
{
unsigned long key = 0;
if ((buf[0]&_B_CODE) == _B_RCOMM) /* register following */
{
len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
len = (*stream->read) (stream->physical, buf, 1);
len = (*stream->read) (stream->physical, (char*)buf, 1);
}
if (buf[0] == (_B_EXT|_BX_SEL)) /* selector! */
{
char *selector_name;
char temp[1] = "";
char *selector_name = temp;
/* get selector */
len = objc_read_string (stream, &selector_name);
@ -954,7 +964,8 @@ objc_read_selector (struct objc_typed_stream *stream, SEL* selector)
/* register */
if (key)
hash_add (&stream->stream_table, LONG2PTR(key), (void *) *selector);
objc_hash_add (&stream->stream_table,
LONG2PTR(key), (void *) *selector);
}
else if ((buf[0]&_B_CODE) == _B_UCOMM)
@ -962,8 +973,8 @@ objc_read_selector (struct objc_typed_stream *stream, SEL* selector)
if (key)
objc_error (nil, OBJC_ERR_BAD_KEY, "cannot register use upcode...");
len = __objc_read_nbyte_ulong (stream, (buf[0] & _B_VALUE), &key);
(*selector) = hash_value_for_key (stream->stream_table,
LONG2PTR(key));
(*selector) = objc_hash_value_for_key (stream->stream_table,
LONG2PTR(key));
}
else
@ -1032,11 +1043,11 @@ objc_write_type (TypedStream *stream, const char *type, const void *data)
case _C_CHARPTR:
return objc_write_string (stream,
*(char **) data, strlen (*(char **) data));
*(unsigned char **) data, strlen (*(char **) data));
break;
case _C_ATOM:
return objc_write_string_atomic (stream, *(char **) data,
return objc_write_string_atomic (stream, *(unsigned char **) data,
strlen (*(char **) data));
break;
@ -1058,7 +1069,7 @@ objc_write_type (TypedStream *stream, const char *type, const void *data)
while (*type != _C_STRUCT_E)
{
align = objc_alignof_type (type); /* padd to alignment */
acc_size += ROUND (acc_size, align);
acc_size = ROUND (acc_size, align);
objc_write_type (stream, type, ((char *) data) + acc_size);
acc_size += objc_sizeof_type (type); /* add component size */
type = objc_skip_typespec (type); /* skip component */
@ -1154,7 +1165,7 @@ objc_read_type(TypedStream *stream, const char *type, void *data)
while (*type != _C_STRUCT_E)
{
align = objc_alignof_type (type); /* padd to alignment */
acc_size += ROUND (acc_size, align);
acc_size = ROUND (acc_size, align);
objc_read_type (stream, type, ((char*)data)+acc_size);
acc_size += objc_sizeof_type (type); /* add component size */
type = objc_skip_typespec (type); /* skip component */
@ -1241,15 +1252,15 @@ objc_write_types (TypedStream *stream, const char *type, ...)
case _C_CHARPTR:
{
char **str = va_arg (args, char **);
res = objc_write_string (stream, *str, strlen (*str));
unsigned char **str = va_arg (args, unsigned char **);
res = objc_write_string (stream, *str, strlen ((char*)*str));
}
break;
case _C_ATOM:
{
char **str = va_arg (args, char **);
res = objc_write_string_atomic (stream, *str, strlen (*str));
unsigned char **str = va_arg (args, unsigned char **);
res = objc_write_string_atomic (stream, *str, strlen ((char*)*str));
}
break;
@ -1473,54 +1484,54 @@ __objc_write_typed_stream_signature (TypedStream *stream)
static void __objc_finish_write_root_object(struct objc_typed_stream *stream)
{
hash_delete (stream->object_table);
stream->object_table = hash_new(64,
(hash_func_type)hash_ptr,
(compare_func_type)compare_ptrs);
objc_hash_delete (stream->object_table);
stream->object_table = objc_hash_new (64,
(hash_func_type) objc_hash_ptr,
(compare_func_type) objc_compare_ptrs);
}
static void __objc_finish_read_root_object(struct objc_typed_stream *stream)
{
node_ptr node;
SEL awake_sel = sel_get_any_uid ("awake");
cache_ptr free_list = hash_new (64,
(hash_func_type) hash_ptr,
(compare_func_type) compare_ptrs);
cache_ptr free_list = objc_hash_new (64,
(hash_func_type) objc_hash_ptr,
(compare_func_type) objc_compare_ptrs);
/* resolve object forward references */
for (node = hash_next (stream->object_refs, NULL); node;
node = hash_next (stream->object_refs, node))
for (node = objc_hash_next (stream->object_refs, NULL); node;
node = objc_hash_next (stream->object_refs, node))
{
struct objc_list *reflist = node->value;
const void *key = node->key;
id object = hash_value_for_key (stream->object_table, key);
id object = objc_hash_value_for_key (stream->object_table, key);
while (reflist)
{
*((id*) reflist->head) = object;
if (hash_value_for_key (free_list,reflist) == NULL)
hash_add (&free_list,reflist,reflist);
if (objc_hash_value_for_key (free_list,reflist) == NULL)
objc_hash_add (&free_list,reflist,reflist);
reflist = reflist->tail;
}
}
/* apply __objc_free to all objects stored in free_list */
for (node = hash_next (free_list, NULL); node;
node = hash_next (free_list, node))
for (node = objc_hash_next (free_list, NULL); node;
node = objc_hash_next (free_list, node))
objc_free ((void *) node->key);
hash_delete (free_list);
objc_hash_delete (free_list);
/* empty object reference table */
hash_delete (stream->object_refs);
stream->object_refs = hash_new(8, (hash_func_type)hash_ptr,
(compare_func_type)compare_ptrs);
objc_hash_delete (stream->object_refs);
stream->object_refs = objc_hash_new (8, (hash_func_type) objc_hash_ptr,
(compare_func_type) objc_compare_ptrs);
/* call -awake for all objects read */
if (awake_sel)
{
for (node = hash_next (stream->object_table, NULL); node;
node = hash_next (stream->object_table, node))
for (node = objc_hash_next (stream->object_table, NULL); node;
node = objc_hash_next (stream->object_table, node))
{
id object = node->value;
if (__objc_responds_to (object, awake_sel))
@ -1529,10 +1540,10 @@ static void __objc_finish_read_root_object(struct objc_typed_stream *stream)
}
/* empty object table */
hash_delete (stream->object_table);
stream->object_table = hash_new(64,
(hash_func_type)hash_ptr,
(compare_func_type)compare_ptrs);
objc_hash_delete (stream->object_table);
stream->object_table = objc_hash_new(64,
(hash_func_type)objc_hash_ptr,
(compare_func_type)objc_compare_ptrs);
}
/*
@ -1546,21 +1557,22 @@ objc_open_typed_stream (FILE *physical, int mode)
s->mode = mode;
s->physical = physical;
s->stream_table = hash_new (64,
(hash_func_type) hash_ptr,
(compare_func_type) compare_ptrs);
s->object_table = hash_new (64,
(hash_func_type) hash_ptr,
(compare_func_type) compare_ptrs);
s->stream_table = objc_hash_new (64,
(hash_func_type) objc_hash_ptr,
(compare_func_type) objc_compare_ptrs);
s->object_table = objc_hash_new (64,
(hash_func_type) objc_hash_ptr,
(compare_func_type) objc_compare_ptrs);
s->eof = (objc_typed_eof_func) __objc_feof;
s->flush = (objc_typed_flush_func) fflush;
s->writing_root_p = 0;
if (mode == OBJC_READONLY)
{
s->class_table = hash_new (8, (hash_func_type) hash_string,
(compare_func_type) compare_strings);
s->object_refs = hash_new (8, (hash_func_type) hash_ptr,
(compare_func_type) compare_ptrs);
s->class_table
= objc_hash_new (8, (hash_func_type) objc_hash_string,
(compare_func_type) objc_compare_strings);
s->object_refs = objc_hash_new (8, (hash_func_type) objc_hash_ptr,
(compare_func_type) objc_compare_ptrs);
s->read = (objc_typed_read_func) __objc_fread;
s->write = (objc_typed_write_func) __objc_no_write;
__objc_read_typed_stream_signature (s);
@ -1619,12 +1631,12 @@ objc_close_typed_stream (TypedStream *stream)
if (stream->mode == OBJC_READONLY)
{
__objc_finish_read_root_object (stream); /* Just in case... */
hash_delete (stream->class_table);
hash_delete (stream->object_refs);
objc_hash_delete (stream->class_table);
objc_hash_delete (stream->object_refs);
}
hash_delete (stream->stream_table);
hash_delete (stream->object_table);
objc_hash_delete (stream->stream_table);
objc_hash_delete (stream->object_table);
if (stream->type == (OBJC_MANAGED_STREAM | OBJC_FILE_STREAM))
fclose ((FILE *)stream->physical);
@ -1648,7 +1660,8 @@ long
objc_get_stream_class_version (TypedStream *stream, Class class)
{
if (stream->class_table)
return PTR2LONG(hash_value_for_key (stream->class_table, class->name));
return PTR2LONG(objc_hash_value_for_key (stream->class_table,
class->name));
else
return class_get_version (class);
}

View File

@ -19,7 +19,7 @@ details.
You should have received a copy of the GNU General Public License along with
GCC; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -88,12 +88,12 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
classes from the table - and the difficult thing with lock-free data
structures is freeing data when is removed from the structures. */
#include "runtime.h" /* the kitchen sink */
#include "sarray.h"
#include "objc/runtime.h" /* the kitchen sink */
#include "objc/sarray.h"
#include <objc/objc.h>
#include <objc/objc-api.h>
#include <objc/thr.h>
#include "objc/objc.h"
#include "objc/objc-api.h"
#include "objc/thr.h"
/* We use a table which maps a class name to the corresponding class
* pointer. The first part of this file defines this table, and

View File

@ -1,2 +1,58 @@
/* Define this if you have the <sched.h> header file */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define if the compiler has a thread header that is non single. */
#undef HAVE_GTHR_DEFAULT
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <sched.h> header file. */
#undef HAVE_SCHED_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define if the compiler is configured for setjmp/longjmp exceptions. */
#undef SJLJ_EXCEPTIONS
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,296 @@
# Process this file with autoconf to produce a configure script.
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004
# 2005, 2006 Free Software Foundation, Inc.
# Originally contributed by Dave Love (d.love@dl.ac.uk).
#
#This file is part of GCC.
#
#GCC is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2, or (at your option)
#any later version.
#
#GCC is distributed in the hope that it will be useful,
#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.
#
#You should have received a copy of the GNU General Public License
#along with GCC; see the file COPYING. If not, write to
#the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#02110-1301, USA.
AC_PREREQ(2.59)
AC_INIT(package-unused, version-unused,, libobjc)
AC_CONFIG_SRCDIR([objc/objc.h])
GCC_TOPLEV_SUBDIRS
# We need the following definitions because AC_PROG_LIBTOOL relies on them
PACKAGE=libobjc
# Version is pulled out to make it a bit easier to change using sed.
VERSION=2:0:0
AC_SUBST(VERSION)
# This works around the fact that libtool configuration may change LD
# for this particular configuration, but some shells, instead of
# keeping the changes in LD private, export them just because LD is
# exported.
ORIGINAL_LD_FOR_MULTILIBS=$LD
# -------
# Options
# -------
# We use these options to decide which functions to include.
AC_ARG_WITH(target-subdir,
[ --with-target-subdir=SUBDIR
configuring in a subdirectory])
AC_ARG_WITH(cross-host,
[ --with-cross-host=HOST configuring with a cross compiler])
AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
AC_ARG_ENABLE(version-specific-runtime-libs,
[ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
[case "$enableval" in
yes) version_specific_libs=yes ;;
no) version_specific_libs=no ;;
*) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
esac],
[version_specific_libs=no])
AC_MSG_RESULT($version_specific_libs)
AC_ARG_ENABLE(objc-gc,
[ --enable-objc-gc enable the use of Boehm's garbage collector with
the GNU Objective-C runtime.],
[case $enable_objc_gc in
no)
OBJC_BOEHM_GC=''
OBJC_BOEHM_GC_INCLUDES=''
;;
*)
OBJC_BOEHM_GC=libobjc_gc.la
OBJC_BOEHM_GC_INCLUDES='-I$(top_srcdir)/../boehm-gc/include -I../boehm-gc/include'
;;
esac],
[OBJC_BOEHM_GC=''; OBJC_BOEHM_GC_INCLUDES=''])
AC_SUBST(OBJC_BOEHM_GC)
AC_SUBST(OBJC_BOEHM_GC_INCLUDES)
# -----------
# Directories
# -----------
# Find the rest of the source tree framework.
AM_ENABLE_MULTILIB(, ..)
AC_CANONICAL_SYSTEM
ACX_NONCANONICAL_TARGET
# Export source directory.
# These need to be absolute paths, yet at the same time need to
# canonicalize only relative paths, because then amd will not unmount
# drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
case $srcdir in
[\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
*) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
esac
AC_SUBST(glibcpp_srcdir)
# Calculate toolexeclibdir
# Also toolexecdir, though it's only used in toolexeclibdir
case ${version_specific_libs} in
yes)
# Need the gcc compiler version to know where to install libraries
# and header files if --enable-version-specific-runtime-libs option
# is selected.
toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
;;
no)
if test -n "$with_cross_host" &&
test x"$with_cross_host" != x"no"; then
# Install a library built with a cross compiler in tooldir, not libdir.
toolexecdir='$(exec_prefix)/$(target_noncanonical)'
toolexeclibdir='$(toolexecdir)/lib'
else
toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
toolexeclibdir='$(libdir)'
fi
multi_os_directory=`$CC -print-multi-os-directory`
case $multi_os_directory in
.) ;; # Avoid trailing /.
*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
esac
;;
esac
AC_SUBST(toolexecdir)
AC_SUBST(toolexeclibdir)
# Figure out if we want to name the include directory and the
# library name changes differently.
includedirname=include
libext=
case "${host}" in
*-darwin*)
# Darwin is the only target so far that needs a different include directory.
includedirname=include-gnu-runtime
libext=-gnu
;;
esac
AC_SUBST(includedirname)
AC_SUBST(libext)
AC_CONFIG_HEADERS(config.h)
# --------
# Programs
# --------
GCC_NO_EXECUTABLES
# We must force CC to /not/ be a precious variable; otherwise
# the wrong, non-multilib-adjusted value will be used in multilibs.
# As a side effect, we have to subst CFLAGS ourselves.
m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
m4_define([_AC_ARG_VAR_PRECIOUS],[])
AC_PROG_CC
m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
# extra LD Flags which are required for targets
case "${host}" in
*-darwin*)
# Darwin needs -single_module when linking libobjc
extra_ldflags_libobjc=-Wl,-single_module
;;
esac
AC_SUBST(extra_ldflags_libobjc)
AC_SUBST(CFLAGS)
AC_CHECK_TOOL(AS, as)
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_PROG_INSTALL
AM_MAINTAINER_MODE
# Enable Win32 DLL on MS Windows - FIXME
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AM_PROG_CC_C_O
AC_PROG_MAKE_SET
# -------
# Headers
# -------
# Sanity check for the cross-compilation case:
AC_CHECK_HEADER(stdio.h,:,
[AC_MSG_ERROR([Can't find stdio.h.
You must have a usable C system for the target already installed, at least
including headers and, preferably, the library, before you can configure
the Objective C runtime system. If necessary, install gcc now with
\`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'.])])
AC_HEADER_STDC
AC_CHECK_HEADERS(sched.h)
# -----------
# Miscellanea
# -----------
AC_MSG_CHECKING([for thread model used by GCC])
target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
AC_MSG_RESULT([$target_thread_file])
if test $target_thread_file != single; then
AC_DEFINE(HAVE_GTHR_DEFAULT, 1,
[Define if the compiler has a thread header that is non single.])
fi
AC_MSG_CHECKING([for exception model to use])
AC_LANG_PUSH(C)
AC_ARG_ENABLE(sjlj-exceptions,
AS_HELP_STRING([--enable-sjlj-exceptions],
[force use of builtin_setjmp for exceptions]),
[:],
[dnl Botheration. Now we've got to detect the exception model.
dnl Link tests against libgcc.a are problematic since -- at least
dnl as of this writing -- we've not been given proper -L bits for
dnl single-tree newlib and libgloss.
dnl
dnl This is what AC_TRY_COMPILE would do if it didn't delete the
dnl conftest files before we got a change to grep them first.
cat > conftest.$ac_ext << EOF
[#]line __oline__ "configure"
@interface Frob
@end
@implementation Frob
@end
int proc();
int foo()
{
@try {
return proc();
}
@catch (Frob* ex) {
return 0;
}
}
EOF
old_CFLAGS="$CFLAGS"
dnl work around that we don't have Objective-C support in autoconf
CFLAGS="-x objective-c -fgnu-runtime -fobjc-exceptions -S"
if AC_TRY_EVAL(ac_compile); then
if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
enable_sjlj_exceptions=yes
elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
enable_sjlj_exceptions=no
fi
fi
CFLAGS="$old_CFLAGS"
rm -f conftest*])
if test x$enable_sjlj_exceptions = xyes; then
AC_DEFINE(SJLJ_EXCEPTIONS, 1,
[Define if the compiler is configured for setjmp/longjmp exceptions.])
ac_exception_model_name=sjlj
elif test x$enable_sjlj_exceptions = xno; then
ac_exception_model_name="call frame"
else
AC_MSG_ERROR([unable to detect exception model])
fi
AC_LANG_POP(C)
AC_MSG_RESULT($ac_exception_model_name)
# ------
# Output
# ------
AC_CONFIG_FILES([Makefile])
AC_CONFIG_COMMANDS([default],
[[if test -n "$CONFIG_FILES"; then
if test -n "${with_target_subdir}"; then
# FIXME: We shouldn't need to set ac_file
ac_file=Makefile
LD="${ORIGINAL_LD_FOR_MULTILIBS}"
. ${multi_basedir}/config-ml.in
fi
fi]],
[[srcdir=${srcdir}
host=${host}
target=${target}
with_target_subdir=${with_target_subdir}
with_multisubdir=${with_multisubdir}
ac_configure_args="--enable-multilib ${ac_configure_args}"
multi_basedir=${multi_basedir}
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
]])
AC_OUTPUT

View File

@ -1,5 +1,5 @@
/* Encoding of types for Objective C.
Copyright (C) 1993, 1995, 1996, 1997, 1998, 2000, 2002
Copyright (C) 1993, 1995, 1996, 1997, 1998, 2000, 2002, 2004
Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup
Bitfield support by Ovidiu Predescu
@ -18,8 +18,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files
compiled with GCC to produce an executable, this does not cause
@ -32,8 +32,8 @@ Boston, MA 02111-1307, USA. */
#include "tconfig.h"
#include "coretypes.h"
#include "tm.h"
#include "objc-api.h"
#include "encoding.h"
#include "objc/objc-api.h"
#include "objc/encoding.h"
#include <stdlib.h>
#undef MAX
@ -67,26 +67,45 @@ Boston, MA 02111-1307, USA. */
#define VECTOR_TYPE _C_VECTOR
#define TYPE_FIELDS(TYPE) objc_skip_typespec (TYPE)
#define TYPE_FIELDS(TYPE) ({const char *_field = (TYPE)+1; \
while (*_field != _C_STRUCT_E && *_field != _C_STRUCT_B \
&& *_field != _C_UNION_B && *_field++ != '=') \
/* do nothing */; \
_field;})
#define DECL_MODE(TYPE) *(TYPE)
#define TYPE_MODE(TYPE) *(TYPE)
#define DFmode _C_DBL
#define get_inner_array_type(TYPE) ((TYPE) + 1)
#define get_inner_array_type(TYPE) ({const char *_field = (TYPE); \
while (*_field == _C_ARY_B)\
{\
while (isdigit ((unsigned char)*++_field))\
;\
}\
_field;})
/* Some ports (eg ARM) allow the structure size boundary to be
selected at compile-time. We override the normal definition with
one that has a constant value for this compilation. */
#undef STRUCTURE_SIZE_BOUNDARY
#ifndef BITS_PER_UNIT
#define BITS_PER_UNIT 8
#endif
#undef STRUCTURE_SIZE_BOUNDARY
#define STRUCTURE_SIZE_BOUNDARY (BITS_PER_UNIT * sizeof (struct{char a;}))
/* Some ROUND_TYPE_ALIGN macros use TARGET_foo, and consequently
target_flags. Define a dummy entry here to so we don't die. */
/* ??? FIXME: As of 2002-06-21, the attribute `unused' doesn't seem to
eliminate the warning. */
static int __attribute__ ((__unused__)) target_flags = 0;
target_flags. Define a dummy entry here to so we don't die.
We have to rename it because target_flags may already have been
declared extern. */
#define target_flags not_target_flags
static int __attribute__ ((__unused__)) not_target_flags = 0;
/* Some ROUND_TYPE_ALIGN use ALTIVEC_VECTOR_MODE (rs6000 darwin).
Define a dummy ALTIVEC_VECTOR_MODE so it will not die. */
#undef ALTIVEC_VECTOR_MODE
#define ALTIVEC_VECTOR_MODE(MODE) (0)
/* FIXME: while this file has no business including tm.h, this
@ -94,10 +113,13 @@ static int __attribute__ ((__unused__)) target_flags = 0;
is only way around without really rewritting this file,
should look after the branch of 3.4 to fix this. */
#define rs6000_special_round_type_align(STRUCT, COMPUTED, SPECIFIED) \
((TYPE_FIELDS (STRUCT) != 0 \
&& DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode) \
({ const char *_fields = TYPE_FIELDS (STRUCT); \
((_fields != 0 \
&& TYPE_MODE (TREE_CODE (TREE_TYPE (_fields)) == ARRAY_TYPE \
? get_inner_array_type (_fields) \
: TREE_TYPE (_fields)) == DFmode) \
? MAX (MAX (COMPUTED, SPECIFIED), 64) \
: MAX (COMPUTED, SPECIFIED))
: MAX (COMPUTED, SPECIFIED));})
/*
return the size of an object specified by type
@ -114,6 +136,10 @@ objc_sizeof_type (const char *type)
}
switch (*type) {
case _C_BOOL:
return sizeof (_Bool);
break;
case _C_ID:
return sizeof (id);
break;
@ -209,6 +235,7 @@ objc_sizeof_type (const char *type)
return endByte - startByte;
}
case _C_UNION_B:
case _C_STRUCT_B:
{
struct objc_struct_layout layout;
@ -221,24 +248,67 @@ objc_sizeof_type (const char *type)
return size;
}
case _C_UNION_B:
case _C_COMPLEX:
{
int max_size = 0;
while (*type != _C_UNION_E && *type++ != '=')
/* do nothing */;
while (*type != _C_UNION_E)
{
/* Skip the variable name if any */
if (*type == '"')
{
for (type++; *type++ != '"';)
/* do nothing */;
}
max_size = MAX (max_size, objc_sizeof_type (type));
type = objc_skip_typespec (type);
type++; /* Skip after the 'j'. */
switch (*type)
{
case _C_CHR:
return sizeof (_Complex char);
break;
case _C_UCHR:
return sizeof (_Complex unsigned char);
break;
case _C_SHT:
return sizeof (_Complex short);
break;
case _C_USHT:
return sizeof (_Complex unsigned short);
break;
case _C_INT:
return sizeof (_Complex int);
break;
case _C_UINT:
return sizeof (_Complex unsigned int);
break;
case _C_LNG:
return sizeof (_Complex long);
break;
case _C_ULNG:
return sizeof (_Complex unsigned long);
break;
case _C_LNG_LNG:
return sizeof (_Complex long long);
break;
case _C_ULNG_LNG:
return sizeof (_Complex unsigned long long);
break;
case _C_FLT:
return sizeof (_Complex float);
break;
case _C_DBL:
return sizeof (_Complex double);
break;
default:
{
objc_error (nil, OBJC_ERR_BAD_TYPE, "unknown complex type %s\n",
type);
return 0;
}
}
return max_size;
}
default:
@ -264,6 +334,10 @@ objc_alignof_type (const char *type)
/* do nothing */;
}
switch (*type) {
case _C_BOOL:
return __alignof__ (_Bool);
break;
case _C_ID:
return __alignof__ (id);
break;
@ -336,6 +410,7 @@ objc_alignof_type (const char *type)
return objc_alignof_type (type);
case _C_STRUCT_B:
case _C_UNION_B:
{
struct objc_struct_layout layout;
unsigned int align;
@ -347,24 +422,68 @@ objc_alignof_type (const char *type)
return align;
}
case _C_UNION_B:
case _C_COMPLEX:
{
int maxalign = 0;
while (*type != _C_UNION_E && *type++ != '=')
/* do nothing */;
while (*type != _C_UNION_E)
{
/* Skip the variable name if any */
if (*type == '"')
{
for (type++; *type++ != '"';)
/* do nothing */;
}
maxalign = MAX (maxalign, objc_alignof_type (type));
type = objc_skip_typespec (type);
type++; /* Skip after the 'j'. */
switch (*type)
{
case _C_CHR:
return __alignof__ (_Complex char);
break;
case _C_UCHR:
return __alignof__ (_Complex unsigned char);
break;
case _C_SHT:
return __alignof__ (_Complex short);
break;
case _C_USHT:
return __alignof__ (_Complex unsigned short);
break;
case _C_INT:
return __alignof__ (_Complex int);
break;
case _C_UINT:
return __alignof__ (_Complex unsigned int);
break;
case _C_LNG:
return __alignof__ (_Complex long);
break;
case _C_ULNG:
return __alignof__ (_Complex unsigned long);
break;
case _C_LNG_LNG:
return __alignof__ (_Complex long long);
break;
case _C_ULNG_LNG:
return __alignof__ (_Complex unsigned long long);
break;
case _C_FLT:
return __alignof__ (_Complex float);
break;
case _C_DBL:
return __alignof__ (_Complex double);
break;
default:
{
objc_error (nil, OBJC_ERR_BAD_TYPE, "unknown complex type %s\n",
type);
return 0;
}
}
return maxalign;
}
default:
@ -487,6 +606,7 @@ objc_skip_typespec (const char *type)
case _C_INT:
case _C_UINT:
case _C_LNG:
case _C_BOOL:
case _C_ULNG:
case _C_LNG_LNG:
case _C_ULNG_LNG:
@ -496,6 +616,10 @@ objc_skip_typespec (const char *type)
case _C_UNDEF:
return ++type;
break;
case _C_COMPLEX:
return type + 2;
break;
case _C_ARY_B:
/* skip digits, typespec and closing ']' */
@ -744,13 +868,14 @@ objc_layout_structure (const char *type,
{
const char *ntype;
if (*type++ != _C_STRUCT_B)
if (*type != _C_UNION_B && *type != _C_STRUCT_B)
{
objc_error (nil, OBJC_ERR_BAD_TYPE,
"record type expected in objc_layout_structure, got %s\n",
"record (or union) type expected in objc_layout_structure, got %s\n",
type);
}
type ++;
layout->original_type = type;
/* Skip "<name>=" if any. Avoid embedded structures and unions. */
@ -783,13 +908,17 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
/* The current type without the type qualifiers */
const char *type;
BOOL unionp = layout->original_type[-1] == _C_UNION_B;
/* Add the size of the previous field to the size of the record. */
if (layout->prev_type)
{
type = objc_skip_type_qualifiers (layout->prev_type);
if (unionp)
layout->record_size = MAX (layout->record_size,
objc_sizeof_type (type) * BITS_PER_UNIT);
if (*type != _C_BFLD)
else if (*type != _C_BFLD)
layout->record_size += objc_sizeof_type (type) * BITS_PER_UNIT;
else {
/* Get the bitfield's type */
@ -805,7 +934,8 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
}
}
if (*layout->type == _C_STRUCT_E)
if ((unionp && *layout->type == _C_UNION_E)
|| (!unionp && *layout->type == _C_STRUCT_E))
return NO;
/* Skip the variable name if any */
@ -905,14 +1035,16 @@ void objc_layout_finish_structure (struct objc_struct_layout *layout,
unsigned int *size,
unsigned int *align)
{
if (layout->type && *layout->type == _C_STRUCT_E)
BOOL unionp = layout->original_type[-1] == _C_UNION_B;
if (layout->type
&& ((!unionp && *layout->type == _C_STRUCT_E)
|| (unionp && *layout->type == _C_UNION_E)))
{
/* Work out the alignment of the record as one expression and store
in the record type. Round it up to a multiple of the record's
alignment. */
#if defined (ROUND_TYPE_ALIGN) && ! defined (__sparc__)
layout->record_align = ROUND_TYPE_ALIGN (layout->original_type,
layout->record_align = ROUND_TYPE_ALIGN (layout->original_type-1,
1,
layout->record_align);
#else

376
contrib/libobjc/exception.c Normal file
View File

@ -0,0 +1,376 @@
/* The implementation of exception handling primitives for Objective-C.
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
GCC is distributed in the hope that it will be useful, 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.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled
with GCC to produce an executable, this does not cause the resulting
executable to be covered by the GNU General Public License. This
exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
#include <stdlib.h>
#include "config.h"
#include "objc/objc-api.h"
#include "unwind.h"
#include "unwind-pe.h"
/* This is the exception class we report -- "GNUCOBJC". */
#define __objc_exception_class \
((((((((_Unwind_Exception_Class) 'G' \
<< 8 | (_Unwind_Exception_Class) 'N') \
<< 8 | (_Unwind_Exception_Class) 'U') \
<< 8 | (_Unwind_Exception_Class) 'C') \
<< 8 | (_Unwind_Exception_Class) 'O') \
<< 8 | (_Unwind_Exception_Class) 'B') \
<< 8 | (_Unwind_Exception_Class) 'J') \
<< 8 | (_Unwind_Exception_Class) 'C')
/* This is the object that is passed around by the Objective C runtime
to represent the exception in flight. */
struct ObjcException
{
/* This bit is needed in order to interact with the unwind runtime. */
struct _Unwind_Exception base;
/* The actual object we want to throw. */
id value;
/* Cache some internal unwind data between phase 1 and phase 2. */
_Unwind_Ptr landingPad;
int handlerSwitchValue;
};
struct lsda_header_info
{
_Unwind_Ptr Start;
_Unwind_Ptr LPStart;
_Unwind_Ptr ttype_base;
const unsigned char *TType;
const unsigned char *action_table;
unsigned char ttype_encoding;
unsigned char call_site_encoding;
};
static const unsigned char *
parse_lsda_header (struct _Unwind_Context *context, const unsigned char *p,
struct lsda_header_info *info)
{
_Unwind_Word tmp;
unsigned char lpstart_encoding;
info->Start = (context ? _Unwind_GetRegionStart (context) : 0);
/* Find @LPStart, the base to which landing pad offsets are relative. */
lpstart_encoding = *p++;
if (lpstart_encoding != DW_EH_PE_omit)
p = read_encoded_value (context, lpstart_encoding, p, &info->LPStart);
else
info->LPStart = info->Start;
/* Find @TType, the base of the handler and exception spec type data. */
info->ttype_encoding = *p++;
if (info->ttype_encoding != DW_EH_PE_omit)
{
p = read_uleb128 (p, &tmp);
info->TType = p + tmp;
}
else
info->TType = 0;
/* The encoding and length of the call-site table; the action table
immediately follows. */
info->call_site_encoding = *p++;
p = read_uleb128 (p, &tmp);
info->action_table = p + tmp;
return p;
}
static Class
get_ttype_entry (struct lsda_header_info *info, _Unwind_Word i)
{
_Unwind_Ptr ptr;
i *= size_of_encoded_value (info->ttype_encoding);
read_encoded_value_with_base (info->ttype_encoding, info->ttype_base,
info->TType - i, &ptr);
/* NULL ptr means catch-all. */
if (ptr)
return objc_get_class ((const char *) ptr);
else
return 0;
}
/* Like unto the method of the same name on Object, but takes an id. */
/* ??? Does this bork the meta-type system? Can/should we look up an
isKindOf method on the id? */
static int
isKindOf (id value, Class target)
{
Class c;
/* NULL target is catch-all. */
if (target == 0)
return 1;
for (c = value->class_pointer; c; c = class_get_super_class (c))
if (c == target)
return 1;
return 0;
}
/* Using a different personality function name causes link failures
when trying to mix code using different exception handling models. */
#ifdef SJLJ_EXCEPTIONS
#define PERSONALITY_FUNCTION __gnu_objc_personality_sj0
#define __builtin_eh_return_data_regno(x) x
#else
#define PERSONALITY_FUNCTION __gnu_objc_personality_v0
#endif
_Unwind_Reason_Code
PERSONALITY_FUNCTION (int version,
_Unwind_Action actions,
_Unwind_Exception_Class exception_class,
struct _Unwind_Exception *ue_header,
struct _Unwind_Context *context)
{
struct ObjcException *xh = (struct ObjcException *) ue_header;
struct lsda_header_info info;
const unsigned char *language_specific_data;
const unsigned char *action_record;
const unsigned char *p;
_Unwind_Ptr landing_pad, ip;
int handler_switch_value;
int saw_cleanup = 0, saw_handler;
void *return_object;
/* Interface version check. */
if (version != 1)
return _URC_FATAL_PHASE1_ERROR;
/* Shortcut for phase 2 found handler for domestic exception. */
if (actions == (_UA_CLEANUP_PHASE | _UA_HANDLER_FRAME)
&& exception_class == __objc_exception_class)
{
handler_switch_value = xh->handlerSwitchValue;
landing_pad = xh->landingPad;
goto install_context;
}
language_specific_data = (const unsigned char *)
_Unwind_GetLanguageSpecificData (context);
/* If no LSDA, then there are no handlers or cleanups. */
if (! language_specific_data)
return _URC_CONTINUE_UNWIND;
/* Parse the LSDA header. */
p = parse_lsda_header (context, language_specific_data, &info);
info.ttype_base = base_of_encoded_value (info.ttype_encoding, context);
ip = _Unwind_GetIP (context) - 1;
landing_pad = 0;
action_record = 0;
handler_switch_value = 0;
#ifdef SJLJ_EXCEPTIONS
/* The given "IP" is an index into the call-site table, with two
exceptions -- -1 means no-action, and 0 means terminate. But
since we're using uleb128 values, we've not got random access
to the array. */
if ((int) ip < 0)
return _URC_CONTINUE_UNWIND;
else
{
_Unwind_Word cs_lp, cs_action;
do
{
p = read_uleb128 (p, &cs_lp);
p = read_uleb128 (p, &cs_action);
}
while (--ip);
/* Can never have null landing pad for sjlj -- that would have
been indicated by a -1 call site index. */
landing_pad = cs_lp + 1;
if (cs_action)
action_record = info.action_table + cs_action - 1;
goto found_something;
}
#else
/* Search the call-site table for the action associated with this IP. */
while (p < info.action_table)
{
_Unwind_Ptr cs_start, cs_len, cs_lp;
_Unwind_Word cs_action;
/* Note that all call-site encodings are "absolute" displacements. */
p = read_encoded_value (0, info.call_site_encoding, p, &cs_start);
p = read_encoded_value (0, info.call_site_encoding, p, &cs_len);
p = read_encoded_value (0, info.call_site_encoding, p, &cs_lp);
p = read_uleb128 (p, &cs_action);
/* The table is sorted, so if we've passed the ip, stop. */
if (ip < info.Start + cs_start)
p = info.action_table;
else if (ip < info.Start + cs_start + cs_len)
{
if (cs_lp)
landing_pad = info.LPStart + cs_lp;
if (cs_action)
action_record = info.action_table + cs_action - 1;
goto found_something;
}
}
#endif /* SJLJ_EXCEPTIONS */
/* If ip is not present in the table, C++ would call terminate. */
/* ??? As with Java, it's perhaps better to tweek the LSDA to
that no-action is mapped to no-entry. */
return _URC_CONTINUE_UNWIND;
found_something:
saw_cleanup = 0;
saw_handler = 0;
if (landing_pad == 0)
{
/* If ip is present, and has a null landing pad, there are
no cleanups or handlers to be run. */
}
else if (action_record == 0)
{
/* If ip is present, has a non-null landing pad, and a null
action table offset, then there are only cleanups present.
Cleanups use a zero switch value, as set above. */
saw_cleanup = 1;
}
else
{
/* Otherwise we have a catch handler. */
_Unwind_Sword ar_filter, ar_disp;
while (1)
{
p = action_record;
p = read_sleb128 (p, &ar_filter);
read_sleb128 (p, &ar_disp);
if (ar_filter == 0)
{
/* Zero filter values are cleanups. */
saw_cleanup = 1;
}
/* During forced unwinding, we only run cleanups. With a
foreign exception class, we have no class info to match. */
else if ((actions & _UA_FORCE_UNWIND)
|| exception_class != __objc_exception_class)
;
else if (ar_filter > 0)
{
/* Positive filter values are handlers. */
Class catch_type = get_ttype_entry (&info, ar_filter);
if (isKindOf (xh->value, catch_type))
{
handler_switch_value = ar_filter;
saw_handler = 1;
break;
}
}
else
{
/* Negative filter values are exception specifications,
which Objective-C does not use. */
abort ();
}
if (ar_disp == 0)
break;
action_record = p + ar_disp;
}
}
if (! saw_handler && ! saw_cleanup)
return _URC_CONTINUE_UNWIND;
if (actions & _UA_SEARCH_PHASE)
{
if (!saw_handler)
return _URC_CONTINUE_UNWIND;
/* For domestic exceptions, we cache data from phase 1 for phase 2. */
if (exception_class == __objc_exception_class)
{
xh->handlerSwitchValue = handler_switch_value;
xh->landingPad = landing_pad;
}
return _URC_HANDLER_FOUND;
}
install_context:
if (saw_cleanup == 0)
{
return_object = xh->value;
if (!(actions & _UA_SEARCH_PHASE))
_Unwind_DeleteException(&xh->base);
}
_Unwind_SetGR (context, __builtin_eh_return_data_regno (0),
__builtin_extend_pointer (saw_cleanup ? xh : return_object));
_Unwind_SetGR (context, __builtin_eh_return_data_regno (1),
handler_switch_value);
_Unwind_SetIP (context, landing_pad);
return _URC_INSTALL_CONTEXT;
}
static void
__objc_exception_cleanup (_Unwind_Reason_Code code __attribute__((unused)),
struct _Unwind_Exception *exc)
{
free (exc);
}
void
objc_exception_throw (id value)
{
struct ObjcException *header = calloc (1, sizeof (*header));
header->base.exception_class = __objc_exception_class;
header->base.exception_cleanup = __objc_exception_cleanup;
header->value = value;
#ifdef SJLJ_EXCEPTIONS
_Unwind_SjLj_RaiseException (&header->base);
#else
_Unwind_RaiseException (&header->base);
#endif
/* Some sort of unwinding error. */
abort ();
}

View File

@ -1,5 +1,5 @@
/* 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.
This file is part of GCC.
@ -16,8 +16,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files
compiled with GCC to produce an executable, this does not cause
@ -26,8 +26,8 @@ Boston, MA 02111-1307, USA. */
the executable file might be covered by the GNU General Public License. */
#include "tconfig.h"
#include "objc.h"
#include "encoding.h"
#include "objc/objc.h"
#include "objc/encoding.h"
#include <assert.h>
#include <string.h>
@ -250,7 +250,7 @@ __objc_class_structure_encoding (Class class, char **type, int *size,
if (! class)
{
strcat (*type, "{");
*current++;
(*current)++;
return;
}
@ -397,30 +397,34 @@ class_ivar_set_gcinvisible (Class class, const char *ivarname,
if (*type == _C_GCINVISIBLE)
{
char *new_type;
size_t len;
if (gc_invisible || ! __objc_ivar_pointer (type))
return; /* The type of the variable already matches the
requested gc_invisible type */
/* The variable is gc_invisible and we have to reverse it */
new_type = objc_atomic_malloc (strlen (ivar->ivar_type));
strncpy (new_type, ivar->ivar_type,
(size_t)(type - ivar->ivar_type));
/* 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;
strcat (new_type, type + 1);
ivar->ivar_type = new_type;
}
else
{
char *new_type;
size_t len;
if (! gc_invisible || ! __objc_ivar_pointer (type))
return; /* The type of the variable already matches the
requested gc_invisible type */
/* The variable is gc visible and we have to make it gc_invisible */
new_type = objc_malloc (strlen (ivar->ivar_type) + 2);
strncpy (new_type, ivar->ivar_type,
(size_t)(type - ivar->ivar_type));
/* 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;
strcat (new_type, "!");
strcat (new_type, type);
ivar->ivar_type = new_type;

View File

@ -1,5 +1,5 @@
/* Hash tables for Objective C internal structures
Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1993, 1996, 1997, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@ -15,8 +15,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files
compiled with GCC to produce an executable, this does not cause
@ -26,9 +26,9 @@ Boston, MA 02111-1307, USA. */
#include "assert.h"
#include "hash.h"
#include "objc/hash.h"
#include "runtime.h" /* for DEBUG_PRINTF */
#include "objc/runtime.h" /* for DEBUG_PRINTF */
/* These two macros determine when a hash table is full and
by how much it should be expanded respectively.
@ -40,8 +40,8 @@ Boston, MA 02111-1307, USA. */
((cache)->size * 2)
cache_ptr
hash_new (unsigned int size, hash_func_type hash_func,
compare_func_type compare_func)
objc_hash_new (unsigned int size, hash_func_type hash_func,
compare_func_type compare_func)
{
cache_ptr cache;
@ -77,7 +77,7 @@ hash_new (unsigned int size, hash_func_type hash_func,
void
hash_delete (cache_ptr cache)
objc_hash_delete (cache_ptr cache)
{
node_ptr node;
node_ptr next_node;
@ -85,17 +85,17 @@ hash_delete (cache_ptr cache)
/* Purge all key/value pairs from the table. */
/* Step through the nodes one by one and remove every node WITHOUT
using hash_next. this makes hash_delete much more efficient. */
using objc_hash_next. this makes objc_hash_delete much more efficient. */
for (i = 0;i < cache->size;i++) {
if ((node = cache->node_table[i])) {
/* an entry in the hash table has been found, now step through the
nodes next in the list and free them. */
while ((next_node = node->next)) {
hash_remove (cache,node->key);
objc_hash_remove (cache,node->key);
node = next_node;
}
hash_remove (cache,node->key);
objc_hash_remove (cache,node->key);
}
}
@ -106,7 +106,7 @@ hash_delete (cache_ptr cache)
void
hash_add (cache_ptr *cachep, const void *key, void *value)
objc_hash_add (cache_ptr *cachep, const void *key, void *value)
{
size_t indx = (*(*cachep)->hash_func)(*cachep, key);
node_ptr node = (node_ptr) objc_calloc (1, sizeof (struct cache_node));
@ -149,19 +149,19 @@ hash_add (cache_ptr *cachep, const void *key, void *value)
primitive functions thereby increasing its
correctness. */
node_ptr node1 = NULL;
cache_ptr new = hash_new (EXPANSION (*cachep),
(*cachep)->hash_func,
(*cachep)->compare_func);
cache_ptr new = objc_hash_new (EXPANSION (*cachep),
(*cachep)->hash_func,
(*cachep)->compare_func);
DEBUG_PRINTF ("Expanding cache %#x from %d to %d\n",
*cachep, (*cachep)->size, new->size);
(int) *cachep, (*cachep)->size, new->size);
/* Copy the nodes from the first hash table to the new one. */
while ((node1 = hash_next (*cachep, node1)))
hash_add (&new, node1->key, node1->value);
while ((node1 = objc_hash_next (*cachep, node1)))
objc_hash_add (&new, node1->key, node1->value);
/* Trash the old cache. */
hash_delete (*cachep);
objc_hash_delete (*cachep);
/* Return a pointer to the new hash table. */
*cachep = new;
@ -170,7 +170,7 @@ hash_add (cache_ptr *cachep, const void *key, void *value)
void
hash_remove (cache_ptr cache, const void *key)
objc_hash_remove (cache_ptr cache, const void *key)
{
size_t indx = (*cache->hash_func)(cache, key);
node_ptr node = cache->node_table[indx];
@ -206,7 +206,7 @@ hash_remove (cache_ptr cache, const void *key)
node_ptr
hash_next (cache_ptr cache, node_ptr node)
objc_hash_next (cache_ptr cache, node_ptr node)
{
/* If the scan is being started then reset the last node
visitied pointer and bucket index. */
@ -246,7 +246,7 @@ hash_next (cache_ptr cache, node_ptr node)
Return NULL if the KEY is not recorded. */
void *
hash_value_for_key (cache_ptr cache, const void *key)
objc_hash_value_for_key (cache_ptr cache, const void *key)
{
node_ptr node = cache->node_table[(*cache->hash_func)(cache, key)];
void *retval = NULL;
@ -267,7 +267,7 @@ hash_value_for_key (cache_ptr cache, const void *key)
Return NO if it does not */
BOOL
hash_is_key_in_hash (cache_ptr cache, const void *key)
objc_hash_is_key_in_hash (cache_ptr cache, const void *key)
{
node_ptr node = cache->node_table[(*cache->hash_func)(cache, key)];

View File

@ -16,7 +16,7 @@ details.
You should have received a copy of the GNU General Public License along with
GCC; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -24,7 +24,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include "runtime.h"
#include "objc/runtime.h"
/* The version number of this runtime. This must match the number
defined in gcc (objc-act.c). */
@ -363,10 +363,12 @@ __objc_send_message_in_list (MethodList_t method_list, Class class, SEL op)
Method_t mth = &method_list->method_list[i];
if (mth->method_name && sel_eq (mth->method_name, op)
&& ! hash_is_key_in_hash (__objc_load_methods, mth->method_imp))
&& ! objc_hash_is_key_in_hash (__objc_load_methods, mth->method_imp))
{
/* Add this method into the +load hash table */
hash_add (&__objc_load_methods, mth->method_imp, mth->method_imp);
objc_hash_add (&__objc_load_methods,
mth->method_imp,
mth->method_imp);
DEBUG_PRINTF ("sending +load in class: %s\n", class->name);
@ -538,8 +540,9 @@ __objc_exec_class (Module_t module)
__objc_init_class_tables ();
__objc_init_dispatch_tables ();
__objc_class_tree_list = list_cons (NULL, __objc_class_tree_list);
__objc_load_methods
= hash_new (128, (hash_func_type)hash_ptr, compare_ptrs);
__objc_load_methods = objc_hash_new (128,
(hash_func_type)objc_hash_ptr,
objc_compare_ptrs);
previous_constructors = 1;
}

View File

@ -15,13 +15,14 @@
;
; You should have received a copy of the GNU General Public License along with
; GCC; see the file COPYING. If not, write to the Free Software
; Foundation, 59 Temple Place - Suite 330,
; Boston, MA 02111-1307, USA.
; Foundation, 51 Franklin Street, Fifth Floor,
; Boston, MA 02110-1301, USA.
LIBRARY libobjc
EXPORTS
search_for_method_in_list
objc_get_uninstalled_dtable
objc_hash_is_key_in_hash
hash_is_key_in_hash
objc_verror
_objc_load_callback
@ -155,9 +156,15 @@ sarray_lazy_copy
sarray_new
sarray_realloc
sarray_remove_garbage
objc_hash_add
hash_add
objc_hash_delete
hash_delete
objc_hash_new
hash_new
objc_hash_next
hash_next
objc_hash_remove
hash_remove
objc_hash_value_for_key
hash_value_for_key

View File

@ -16,8 +16,8 @@ for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable

View File

@ -16,8 +16,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable

View File

@ -14,8 +14,8 @@
#
# You should have received a copy of the GNU General Public License along with
# GCC; see the file COPYING. If not, write to the Free Software
# Foundation, 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# Foundation, 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
# This Makefile is configured for GnuMAKE

View File

@ -17,8 +17,8 @@ for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -28,7 +28,7 @@ Boston, MA 02111-1307, USA. */
#define __USE_FIXED_PROTOTYPES__
#include <stdlib.h>
#include "runtime.h"
#include "objc/runtime.h"
/*
** Error handler function

View File

@ -15,8 +15,8 @@ details.
You should have received a copy of the GNU General Public License along with
GCC; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -27,7 +27,7 @@ Boston, MA 02111-1307, USA. */
/* This is the nil method, the function that is called when the receiver
of a method is nil */
#include "runtime.h"
#include "objc/runtime.h"
/* When the receiver of a method invocation is nil, the runtime
returns nil_method() as the method implementation. This function

View File

@ -1,5 +1,5 @@
/* Interface for the NXConstantString class for Objective-C.
Copyright (C) 1995 Free Software Foundation, Inc.
Copyright (C) 1995, 2004 Free Software Foundation, Inc.
Contributed by Pieter J. Schoenmakers <tiggr@es.ele.tue.nl>
This file is part of GCC.
@ -16,8 +16,8 @@ License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files
compiled with GCC to produce an executable, this does not cause
@ -28,7 +28,11 @@ Boston, MA 02111-1307, USA. */
#ifndef __nxconstantstring_INCLUDE_GNU
#define __nxconstantstring_INCLUDE_GNU
#include "objc/Object.h"
#include "Object.h"
#ifdef __cplusplus
extern "C" {
#endif
@interface NXConstantString: Object
{
@ -41,4 +45,8 @@ Boston, MA 02111-1307, USA. */
@end
#ifdef __cplusplus
}
#endif
#endif

View File

@ -15,8 +15,8 @@ License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled
with GCC to produce an executable, this does not cause the resulting
@ -27,8 +27,12 @@ Boston, MA 02111-1307, USA. */
#ifndef __object_INCLUDE_GNU
#define __object_INCLUDE_GNU
#include <objc/objc.h>
#include <objc/typedstream.h>
#include "objc.h"
#include "typedstream.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* All classes are derived from Object. As such,
@ -121,4 +125,8 @@ Boston, MA 02111-1307, USA. */
@end
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,5 +1,5 @@
/* Declare the class Protocol for Objective C programs.
Copyright (C) 1993 Free Software Foundation, Inc.
Copyright (C) 1993, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@ -15,8 +15,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files
compiled with GCC to produce an executable, this does not cause
@ -27,7 +27,11 @@ Boston, MA 02111-1307, USA. */
#ifndef __Protocol_INCLUDE_GNU
#define __Protocol_INCLUDE_GNU
#include "objc/Object.h"
#include "Object.h"
#ifdef __cplusplus
extern "C" {
#endif
@interface Protocol : Object
{
@ -52,7 +56,8 @@ Boston, MA 02111-1307, USA. */
@end
#ifdef __cplusplus
}
#endif
#endif /* not __Protocol_INCLUDE_GNU */

View File

@ -1,5 +1,5 @@
/* Encoding of types for Objective C.
Copyright (C) 1993, 1997, 2002 Free Software Foundation, Inc.
Copyright (C) 1993, 1997, 2002, 2004 Free Software Foundation, Inc.
Author: Kresten Krab Thorup
@ -17,8 +17,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files
compiled with GCC to produce an executable, this does not cause
@ -29,8 +29,12 @@ Boston, MA 02111-1307, USA. */
#ifndef __encoding_INCLUDE_GNU
#define __encoding_INCLUDE_GNU
#include "objc-api.h"
#include <ctype.h>
#include "objc/objc-api.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define _C_CONST 'r'
#define _C_IN 'n'
@ -96,4 +100,8 @@ void objc_layout_structure_get_info (struct objc_struct_layout *layout,
unsigned int *align,
const char **type);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __encoding_INCLUDE_GNU */

View File

@ -1,5 +1,5 @@
/* Hash tables for Objective C method dispatch.
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
Copyright (C) 1993, 1995, 1996, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@ -15,8 +15,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files
compiled with GCC to produce an executable, this does not cause
@ -30,7 +30,11 @@ Boston, MA 02111-1307, USA. */
#include <stddef.h>
#include <string.h>
#include <objc/objc.h>
#include "objc.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*
* This data structure is used to hold items
@ -58,7 +62,7 @@ typedef struct cache_node
*
* Unfortunately there is a mutual data structure reference problem with this
* typedef. Therefore, to remove compiler warnings the functions passed to
* hash_new will have to be casted to this type.
* objc_hash_new will have to be casted to this type.
*/
typedef unsigned int (*hash_func_type) (void *, const void *);
@ -107,25 +111,25 @@ extern cache_ptr module_hash_table, class_hash_table;
/* Allocate and initialize a hash table. */
cache_ptr hash_new (unsigned int size,
hash_func_type hash_func,
compare_func_type compare_func);
cache_ptr objc_hash_new (unsigned int size,
hash_func_type hash_func,
compare_func_type compare_func);
/* Deallocate all of the hash nodes and the cache itself. */
void hash_delete (cache_ptr cache);
void objc_hash_delete (cache_ptr cache);
/* Add the key/value pair to the hash table. If the
hash table reaches a level of fullness then it will be resized.
assert if the key is already in the hash. */
void hash_add (cache_ptr *cachep, const void *key, void *value);
void objc_hash_add (cache_ptr *cachep, const void *key, void *value);
/* Remove the key/value pair from the hash table.
assert if the key isn't in the table. */
void hash_remove (cache_ptr cache, const void *key);
void objc_hash_remove (cache_ptr cache, const void *key);
/* Used to index through the hash table. Start with NULL
to get the first entry.
@ -136,15 +140,15 @@ void hash_remove (cache_ptr cache, const void *key);
Cache nodes are returned such that key or value can
be extracted. */
node_ptr hash_next (cache_ptr cache, node_ptr node);
node_ptr objc_hash_next (cache_ptr cache, node_ptr node);
/* Used to return a value from a hash table using a given key. */
void *hash_value_for_key (cache_ptr cache, const void *key);
void *objc_hash_value_for_key (cache_ptr cache, const void *key);
/* Used to determine if the given key exists in the hash table */
BOOL hash_is_key_in_hash (cache_ptr cache, const void *key);
BOOL objc_hash_is_key_in_hash (cache_ptr cache, const void *key);
/************************************************
@ -159,7 +163,7 @@ BOOL hash_is_key_in_hash (cache_ptr cache, const void *key);
except for those likely to be 0 due to alignment.) */
static inline unsigned int
hash_ptr (cache_ptr cache, const void *key)
objc_hash_ptr (cache_ptr cache, const void *key)
{
return ((size_t)key / sizeof (void *)) & cache->mask;
}
@ -168,11 +172,11 @@ hash_ptr (cache_ptr cache, const void *key)
/* Calculate a hash code by iterating over a NULL
terminate string. */
static inline unsigned int
hash_string (cache_ptr cache, const void *key)
objc_hash_string (cache_ptr cache, const void *key)
{
unsigned int ret = 0;
unsigned int ctr = 0;
const char *ckey = key;
const char *ckey = (const char *) key;
while (*ckey) {
ret ^= *ckey++ << ctr;
@ -185,7 +189,7 @@ hash_string (cache_ptr cache, const void *key)
/* Compare two pointers for equality. */
static inline int
compare_ptrs (const void *k1, const void *k2)
objc_compare_ptrs (const void *k1, const void *k2)
{
return (k1 == k2);
}
@ -193,15 +197,20 @@ compare_ptrs (const void *k1, const void *k2)
/* Compare two strings. */
static inline int
compare_strings (const void *k1, const void *k2)
objc_compare_strings (const void *k1, const void *k2)
{
if (k1 == k2)
return 1;
else if (k1 == 0 || k2 == 0)
return 0;
else
return ! strcmp (k1, k2);
return ! strcmp ((const char *) k1, (const char *) k2);
}
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* not __hash_INCLUDE_GNU */

View File

@ -1,5 +1,5 @@
/* GNU Objective-C Runtime API.
Copyright (C) 1993, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
Copyright (C) 1993, 1995, 1996, 1997, 2002, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@ -15,8 +15,8 @@ License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled
with GCC to produce an executable, this does not cause the resulting
@ -27,12 +27,17 @@ Boston, MA 02111-1307, USA. */
#ifndef __objc_api_INCLUDE_GNU
#define __objc_api_INCLUDE_GNU
#include "objc/objc.h"
#include "objc/hash.h"
#include "objc/thr.h"
#include "objc.h"
#include "hash.h"
#include "thr.h"
#include "objc-decls.h"
#include <stdio.h>
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* For functions which return Method_t */
#define METHOD_NULL (Method_t)0
/* Boolean typedefs */
@ -64,6 +69,7 @@ struct objc_method_description
#define _C_FLT 'f'
#define _C_DBL 'd'
#define _C_BFLD 'b'
#define _C_BOOL 'B'
#define _C_VOID 'v'
#define _C_UNDEF '?'
#define _C_PTR '^'
@ -76,6 +82,7 @@ struct objc_method_description
#define _C_STRUCT_B '{'
#define _C_STRUCT_E '}'
#define _C_VECTOR '!'
#define _C_COMPLEX 'j'
/*
@ -100,7 +107,7 @@ struct objc_method_description
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);
typedef BOOL (*objc_error_handler)(id, int code, const char *fmt, va_list ap);
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
@ -146,7 +153,11 @@ extern BOOL objc_trace;
struct objc_static_instances
{
char *class_name;
#ifdef __cplusplus
id instances[1];
#else
id instances[0];
#endif
};
/*
@ -204,14 +215,7 @@ typedef struct objc_module {
** The compiler generates one of these structures for a class that has
** instance variables defined in its specification.
*/
typedef struct objc_ivar* Ivar_t;
typedef struct objc_ivar_list {
int ivar_count; /* Number of structures (Ivar)
contained in the list. One
structure per instance
variable defined in the
class. */
struct objc_ivar {
typedef struct objc_ivar {
const char* ivar_name; /* Name of the instance
variable as entered in the
class definition. */
@ -221,8 +225,15 @@ typedef struct objc_ivar_list {
int ivar_offset; /* Byte offset from the base
address of the instance
structure to the variable. */
} *Ivar_t;
} ivar_list[1]; /* Variable length
typedef struct objc_ivar_list {
int ivar_count; /* Number of structures (Ivar)
contained in the list. One
structure per instance
variable defined in the
class. */
struct objc_ivar ivar_list[1]; /* Variable length
structure. */
} IvarList, *IvarList_t;
@ -235,28 +246,28 @@ typedef struct objc_ivar_list {
** and categories can break them across modules. To handle this problem is a
** singly linked list of methods.
*/
typedef struct objc_method Method;
typedef Method* Method_t;
typedef struct objc_method {
SEL method_name; /* This variable is the method's
name. It is a char*.
The unique integer passed to
objc_msg_send is a char* too.
It is compared against
method_name using strcmp. */
const char* method_types; /* Description of the method's
parameter list. Useful for
debuggers. */
IMP method_imp; /* Address of the method in the
executable. */
} Method, *Method_t;
typedef struct objc_method_list {
struct objc_method_list* method_next; /* This variable is used to link
a method list to another. It
is a singly linked list. */
int method_count; /* Number of methods defined in
this structure. */
struct objc_method {
SEL method_name; /* This variable is the method's
name. It is a char*.
The unique integer passed to
objc_msg_send is a char* too.
It is compared against
method_name using strcmp. */
const char* method_types; /* Description of the method's
parameter list. Useful for
debuggers. */
IMP method_imp; /* Address of the method in the
executable. */
} method_list[1]; /* Variable length
structure. */
struct objc_method_list* method_next; /* This variable is used to link
a method list to another. It
is a singly linked list. */
int method_count; /* Number of methods defined in
this structure. */
Method method_list[1]; /* Variable length
structure. */
} MethodList, *MethodList_t;
struct objc_protocol_list {
@ -342,7 +353,11 @@ typedef struct objc_category {
typedef struct objc_super {
id self; /* Id of the object sending
the message. */
#ifdef __cplusplus
Class super_class;
#else
Class class; /* Object's super class. */
#endif
} Super, *Super_t;
IMP objc_msg_lookup_super(Super_t super, SEL sel);
@ -357,7 +372,7 @@ retval_t objc_msg_sendv(id, SEL, arglist_t);
** This may e.g. try to load in the class using dynamic loading.
** The function is guaranteed to be passed a non-NULL name string.
*/
extern Class (*_objc_lookup_class)(const char *name);
objc_EXPORT Class (*_objc_lookup_class)(const char *name);
/*
** This is a hook which is called by __objc_exec_class every time a class
@ -365,14 +380,14 @@ extern Class (*_objc_lookup_class)(const char *name);
** dynamic loader determine the classes that have been loaded when
** an object file is dynamically linked in.
*/
extern void (*_objc_load_callback)(Class class, Category* category);
objc_EXPORT void (*_objc_load_callback)(Class _class, Category* category);
/*
** Hook functions for allocating, copying and disposing of instances
*/
extern id (*_objc_object_alloc)(Class class);
extern id (*_objc_object_copy)(id object);
extern id (*_objc_object_dispose)(id object);
objc_EXPORT id (*_objc_object_alloc)(Class _class);
objc_EXPORT id (*_objc_object_copy)(id object);
objc_EXPORT id (*_objc_object_dispose)(id object);
/*
** Standard functions for memory allocation and disposal.
@ -408,23 +423,23 @@ objc_free(void *mem);
** Users should call the normal objc routines above for
** memory allocation and disposal within their programs.
*/
extern void *(*_objc_malloc)(size_t);
extern void *(*_objc_atomic_malloc)(size_t);
extern void *(*_objc_valloc)(size_t);
extern void *(*_objc_realloc)(void *, size_t);
extern void *(*_objc_calloc)(size_t, size_t);
extern void (*_objc_free)(void *);
objc_EXPORT void *(*_objc_malloc)(size_t);
objc_EXPORT void *(*_objc_atomic_malloc)(size_t);
objc_EXPORT void *(*_objc_valloc)(size_t);
objc_EXPORT void *(*_objc_realloc)(void *, size_t);
objc_EXPORT void *(*_objc_calloc)(size_t, size_t);
objc_EXPORT void (*_objc_free)(void *);
/*
** Hook for method forwarding. This makes it easy to substitute a
** library, such as ffcall, that implements closures, thereby avoiding
** gcc's __builtin_apply problems.
*/
extern IMP (*__objc_msg_forward)(SEL);
objc_EXPORT IMP (*__objc_msg_forward)(SEL);
Method_t class_get_class_method(MetaClass class, SEL aSel);
Method_t class_get_class_method(MetaClass _class, SEL aSel);
Method_t class_get_instance_method(Class class, SEL aSel);
Method_t class_get_instance_method(Class _class, SEL aSel);
Class class_pose_as(Class impostor, Class superclass);
@ -453,66 +468,66 @@ SEL sel_register_typed_name(const char *name, const char*type);
BOOL sel_is_mapped (SEL aSel);
extern id class_create_instance(Class class);
extern id class_create_instance(Class _class);
static inline const char *
class_get_class_name(Class class)
class_get_class_name(Class _class)
{
return CLS_ISCLASS(class)?class->name:((class==Nil)?"Nil":0);
return CLS_ISCLASS(_class)?_class->name:((_class==Nil)?"Nil":0);
}
static inline long
class_get_instance_size(Class class)
class_get_instance_size(Class _class)
{
return CLS_ISCLASS(class)?class->instance_size:0;
return CLS_ISCLASS(_class)?_class->instance_size:0;
}
static inline MetaClass
class_get_meta_class(Class class)
class_get_meta_class(Class _class)
{
return CLS_ISCLASS(class)?class->class_pointer:Nil;
return CLS_ISCLASS(_class)?_class->class_pointer:Nil;
}
static inline Class
class_get_super_class(Class class)
class_get_super_class(Class _class)
{
return CLS_ISCLASS(class)?class->super_class:Nil;
return CLS_ISCLASS(_class)?_class->super_class:Nil;
}
static inline int
class_get_version(Class class)
class_get_version(Class _class)
{
return CLS_ISCLASS(class)?class->version:-1;
return CLS_ISCLASS(_class)?_class->version:-1;
}
static inline BOOL
class_is_class(Class class)
class_is_class(Class _class)
{
return CLS_ISCLASS(class);
return CLS_ISCLASS(_class);
}
static inline BOOL
class_is_meta_class(Class class)
class_is_meta_class(Class _class)
{
return CLS_ISMETA(class);
return CLS_ISMETA(_class);
}
static inline void
class_set_version(Class class, long version)
class_set_version(Class _class, long version)
{
if (CLS_ISCLASS(class))
class->version = version;
if (CLS_ISCLASS(_class))
_class->version = version;
}
static inline void *
class_get_gc_object_type (Class class)
class_get_gc_object_type (Class _class)
{
return CLS_ISCLASS(class) ? class->gc_object_type : NULL;
return CLS_ISCLASS(_class) ? _class->gc_object_type : NULL;
}
/* Mark the instance variable as innaccessible to the garbage collector */
extern void class_ivar_set_gcinvisible (Class class,
extern void class_ivar_set_gcinvisible (Class _class,
const char* ivarname,
BOOL gcInvisible);
@ -522,7 +537,7 @@ method_get_imp(Method_t method)
return (method!=METHOD_NULL)?method->method_imp:(IMP)0;
}
IMP get_imp (Class class, SEL sel);
IMP get_imp (Class _class, SEL sel);
/* Redefine on NeXTSTEP so as not to conflict with system function */
#ifdef __NeXT__
@ -601,6 +616,10 @@ object_is_meta_class (id object)
struct sarray*
objc_get_uninstalled_dtable(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* not __objc_api_INCLUDE_GNU */

View File

@ -0,0 +1,47 @@
/* GNU Objective-C Extern helpers for Win32.
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
GCC is distributed in the hope that it will be useful, 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.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled
with GCC to produce an executable, this does not cause the resulting
executable to be covered by the GNU General Public License. This
exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
#ifndef __objc_decls_INCLUDE_GNU
#define __objc_decls_INCLUDE_GNU
#if defined (_WIN32) || defined (__WIN32__) || defined (WIN32)
# ifdef DLL_EXPORT /* defined by libtool (if required) */
# define objc_EXPORT __declspec(dllexport)
# define objc_DECLARE __declspec(dllexport)
#else
# define objc_EXPORT extern __declspec(dllimport)
# define objc_DECLARE extern __declspec(dllimport)
#endif
#else
# define objc_EXPORT extern
# define objc_DECLARE
#endif
#endif /* __objc_decls_INCLUDE_GNU */

View File

@ -16,8 +16,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -28,6 +28,10 @@ Boston, MA 02111-1307, USA. */
#ifndef __GNU_OBJC_LIST_H
#define __GNU_OBJC_LIST_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
struct objc_list {
void *head;
struct objc_list *tail;
@ -144,4 +148,9 @@ list_free(struct objc_list* list)
objc_free(list);
}
}
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* not __GNU_OBJC_LIST_H */

View File

@ -1,5 +1,5 @@
/* Basic data types for Objective C.
Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
Copyright (C) 1993, 1995, 1996, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@ -15,8 +15,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files
compiled with GCC to produce an executable, this does not cause
@ -150,7 +150,7 @@ typedef struct objc_protocol {
typedef void* retval_t; /* return value */
typedef void(*apply_t)(void); /* function pointer */
typedef union {
typedef union arglist {
char *arg_ptr;
char arg_regs[sizeof (char*)];
} *arglist_t; /* argument frame */

View File

@ -1,5 +1,5 @@
/* GNU Objective C Runtime internal declarations
Copyright (C) 1993, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
Copyright (C) 1993, 1995, 1996, 1997, 2002, 2004 Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup
This file is part of GCC.
@ -15,7 +15,7 @@ details.
You should have received a copy of the GNU General Public License along with
GCC; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -32,15 +32,19 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <ctype.h>
#include <stddef.h> /* so noone else will get system versions */
#include "assert.h"
#include <assert.h>
#include "objc/objc.h" /* core data types */
#include "objc/objc-api.h" /* runtime api functions */
#include "objc.h" /* core data types */
#include "objc-api.h" /* runtime api functions */
#include "objc/thr.h" /* thread and mutex support */
#include "thr.h" /* thread and mutex support */
#include "objc/hash.h" /* hash structures */
#include "objc/objc-list.h" /* linear lists */
#include "hash.h" /* hash structures */
#include "objc-list.h" /* linear lists */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
extern void __objc_add_class_to_hash(Class); /* (objc-class.c) */
extern void __objc_init_selector_tables(void); /* (objc-sel.c) */
@ -49,6 +53,7 @@ extern void __objc_init_dispatch_tables(void); /* (objc-dispatch.c) */
extern void __objc_install_premature_dtable(Class); /* (objc-dispatch.c) */
extern void __objc_resolve_class_links(void); /* (objc-class.c) */
extern void __objc_register_selectors_from_class(Class); /* (objc-sel.c) */
extern void __objc_register_selectors_from_list (MethodList_t); /* (selector.c) */
extern void __objc_update_dispatch_table_for_class (Class);/* (objc-msg.c) */
extern int __objc_init_thread_system(void); /* thread.c */
@ -84,6 +89,8 @@ SEL __sel_register_typed_name (const char*, const char*,
struct objc_selector*, BOOL is_const);
extern void __objc_generate_gc_type_description (Class);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* not __objc_runtime_INCLUDE_GNU */

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, 2004 Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup.
This file is part of GCC.
@ -16,8 +16,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files
compiled with GCC to produce an executable, this does not cause
@ -28,6 +28,8 @@ Boston, MA 02111-1307, USA. */
#ifndef __sarray_INCLUDE_GNU
#define __sarray_INCLUDE_GNU
#include "thr.h"
#define OBJC_SPARSE2 /* 2-level sparse array */
/* #define OBJC_SPARSE3 */ /* 3-level sparse array */
@ -40,16 +42,17 @@ extern const char* __objc_sparse3_id;
#endif
#include <stddef.h>
#include <assert.h>
#include "objc/thr.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
extern int nbuckets; /* for stats */
extern int nindices;
extern int narrays;
extern int idxsize;
#include <assert.h>
/* An unsigned integer of same size as a pointer */
#define SIZET_BITS (sizeof(size_t)*8)
@ -234,4 +237,8 @@ static inline void* sarray_get_safe(struct sarray* array, sidx indx)
return (array->empty_bucket->elems[0]);
}
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __sarray_INCLUDE_GNU */

View File

@ -1,5 +1,5 @@
/* Thread and mutex controls for Objective C.
Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
Copyright (C) 1996, 1997, 2002, 2004 Free Software Foundation, Inc.
Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
This file is part of GCC.
@ -25,8 +25,8 @@ details.
You should have received a copy of the GNU General Public License along with
GCC; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files
compiled with GCC to produce an executable, this does not cause
@ -38,7 +38,11 @@ Boston, MA 02111-1307, USA. */
#ifndef __thread_INCLUDE_GNU
#define __thread_INCLUDE_GNU
#include "objc/objc.h"
#include "objc.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*************************************************************************
* Universal static variables:
@ -142,4 +146,8 @@ objc_thread_t __objc_thread_id (void);
int __objc_thread_set_data (void *value);
void * __objc_thread_get_data (void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* not __thread_INCLUDE_GNU */

View File

@ -1,5 +1,5 @@
/* GNU Objective-C Typed Streams interface.
Copyright (C) 1993, 1995 Free Software Foundation, Inc.
Copyright (C) 1993, 1995, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@ -15,8 +15,8 @@ License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled
with GCC to produce an executable, this does not cause the resulting
@ -27,10 +27,15 @@ Boston, MA 02111-1307, USA. */
#ifndef __typedstream_INCLUDE_GNU
#define __typedstream_INCLUDE_GNU
#include "objc/objc.h"
#include "objc/hash.h"
#include "objc.h"
#include "hash.h"
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef int (*objc_typed_read_func)(void*, char*, int);
typedef int (*objc_typed_write_func)(void*, const char*, int);
typedef int (*objc_typed_flush_func)(void*);
@ -99,7 +104,7 @@ int objc_read_types (TypedStream* stream, const char* type, ...);
int objc_write_object_reference (TypedStream* stream, id object);
int objc_write_root_object (TypedStream* stream, id object);
long objc_get_stream_class_version (TypedStream* stream, Class class);
long objc_get_stream_class_version (TypedStream* stream, Class class_type);
/*
@ -129,4 +134,8 @@ void objc_close_typed_stream (TypedStream* stream);
BOOL objc_end_of_typed_stream (TypedStream* stream);
void objc_flush_typed_stream (TypedStream* stream);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* not __typedstream_INCLUDE_GNU */

View File

@ -15,8 +15,8 @@ details.
You should have received a copy of the GNU General Public License along with
GCC; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -25,8 +25,8 @@ Boston, MA 02111-1307, USA. */
covered by the GNU General Public License. */
#include "tconfig.h" /* include defs of bzero for target */
#include "objc.h"
#include "runtime.h" /* the kitchen sink */
#include "objc/objc.h"
#include "objc/runtime.h" /* the kitchen sink */
#if OBJC_WITH_GC
# include <gc.h>

View File

@ -1,5 +1,5 @@
/* Sparse Arrays for Objective C dispatch tables
Copyright (C) 1993, 1995, 1996, 2002 Free Software Foundation, Inc.
Copyright (C) 1993, 1995, 1996, 2002, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@ -15,8 +15,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files
compiled with GCC to produce an executable, this does not cause
@ -24,8 +24,8 @@ Boston, MA 02111-1307, USA. */
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
#include "sarray.h"
#include "runtime.h"
#include "objc/sarray.h"
#include "objc/runtime.h"
#include <stdio.h>
#include "assert.h"
@ -459,7 +459,9 @@ sarray_free (struct sarray *array) {
#endif
/* If this is a copy, go ahead and decrement/deallocate the original */
/* If this is a copy of another array, we free it (which might just
* decrement its reference count so it will be freed when no longer in use).
*/
if (array->is_copy_of)
sarray_free (array->is_copy_of);

View File

@ -1,5 +1,5 @@
/* GNU Objective C Runtime selector related functions
Copyright (C) 1993, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
Copyright (C) 1993, 1995, 1996, 1997, 2002, 2004 Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup
This file is part of GCC.
@ -15,7 +15,7 @@ details.
You should have received a copy of the GNU General Public License along with
GCC; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -23,9 +23,9 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include "runtime.h"
#include "sarray.h"
#include "encoding.h"
#include "objc/runtime.h"
#include "objc/sarray.h"
#include "objc/encoding.h"
/* Initial selector hash table size. Value doesn't matter much */
#define SELECTOR_HASH_SIZE 128
@ -35,19 +35,17 @@ static struct sarray *__objc_selector_array = 0; /* uid -> sel !T:MUTEX */
static struct sarray *__objc_selector_names = 0; /* uid -> name !T:MUTEX */
static cache_ptr __objc_selector_hash = 0; /* name -> uid !T:MUTEX */
static void register_selectors_from_list (MethodList_t);
/* Number of selectors stored in each of the above tables */
unsigned int __objc_selector_max_index = 0; /* !T:MUTEX */
void __objc_init_selector_tables ()
void __objc_init_selector_tables (void)
{
__objc_selector_array = sarray_new (SELECTOR_HASH_SIZE, 0);
__objc_selector_names = sarray_new (SELECTOR_HASH_SIZE, 0);
__objc_selector_hash
= hash_new (SELECTOR_HASH_SIZE,
(hash_func_type) hash_string,
(compare_func_type) compare_strings);
= objc_hash_new (SELECTOR_HASH_SIZE,
(hash_func_type) objc_hash_string,
(compare_func_type) objc_compare_strings);
}
/* This routine is given a class and records all of the methods in its class
@ -60,7 +58,7 @@ __objc_register_selectors_from_class (Class class)
method_list = class->methods;
while (method_list)
{
register_selectors_from_list (method_list);
__objc_register_selectors_from_list (method_list);
method_list = method_list->method_next;
}
}
@ -70,21 +68,27 @@ __objc_register_selectors_from_class (Class class)
the record table. This is the routine that does the actual recording
work.
This one is only called for Class objects. For categories,
class_add_method_list is called.
The name and type pointers in the method list must be permanent and
immutable.
*/
static void
register_selectors_from_list (MethodList_t method_list)
void
__objc_register_selectors_from_list (MethodList_t method_list)
{
int i = 0;
objc_mutex_lock (__objc_runtime_mutex);
while (i < method_list->method_count)
{
Method_t method = &method_list->method_list[i];
method->method_name
= sel_register_typed_name ((const char *) method->method_name,
method->method_types);
if (method->method_name)
{
method->method_name
= __sel_register_typed_name ((const char *) method->method_name,
method->method_types, 0, YES);
}
i += 1;
}
objc_mutex_unlock (__objc_runtime_mutex);
}
@ -191,7 +195,7 @@ sel_get_typed_uid (const char *name, const char *types)
objc_mutex_lock (__objc_runtime_mutex);
i = (sidx) hash_value_for_key (__objc_selector_hash, name);
i = (sidx) objc_hash_value_for_key (__objc_selector_hash, name);
if (i == 0)
{
objc_mutex_unlock (__objc_runtime_mutex);
@ -231,7 +235,7 @@ sel_get_any_typed_uid (const char *name)
objc_mutex_lock (__objc_runtime_mutex);
i = (sidx) hash_value_for_key (__objc_selector_hash, name);
i = (sidx) objc_hash_value_for_key (__objc_selector_hash, name);
if (i == 0)
{
objc_mutex_unlock (__objc_runtime_mutex);
@ -262,7 +266,7 @@ sel_get_any_uid (const char *name)
objc_mutex_lock (__objc_runtime_mutex);
i = (sidx) hash_value_for_key (__objc_selector_hash, name);
i = (sidx) objc_hash_value_for_key (__objc_selector_hash, name);
if (soffset_decode (i) == 0)
{
objc_mutex_unlock (__objc_runtime_mutex);
@ -320,6 +324,35 @@ const char *sel_get_type (SEL selector)
/* The uninstalled dispatch table */
extern struct sarray *__objc_uninstalled_dtable;
/* __sel_register_typed_name allocates lots of struct objc_selector:s
of 8 (16, if pointers are 64 bits) bytes at startup. To reduce the number
of malloc calls and memory lost to malloc overhead, we allocate
objc_selector:s in blocks here. This is only called from
__sel_register_typed_name, and __sel_register_typed_name may only be
called when __objc_runtime_mutex is locked.
Note that the objc_selector:s allocated from __sel_register_typed_name
are never freed.
62 because 62 * sizeof (struct objc_selector) = 496 (992). This should
let malloc add some overhead and use a nice, round 512 (1024) byte chunk.
*/
#define SELECTOR_POOL_SIZE 62
static struct objc_selector *selector_pool;
static int selector_pool_left;
static struct objc_selector *
pool_alloc_selector(void)
{
if (!selector_pool_left)
{
selector_pool = objc_malloc (sizeof (struct objc_selector)
* SELECTOR_POOL_SIZE);
selector_pool_left = SELECTOR_POOL_SIZE;
}
return &selector_pool[--selector_pool_left];
}
/* Store the passed selector name in the selector record and return its
selector value (value returned by sel_get_uid).
Assumes that the calling function has locked down __objc_runtime_mutex. */
@ -335,7 +368,7 @@ __sel_register_typed_name (const char *name, const char *types,
sidx i;
struct objc_list *l;
i = (sidx) hash_value_for_key (__objc_selector_hash, name);
i = (sidx) objc_hash_value_for_key (__objc_selector_hash, name);
if (soffset_decode (i) != 0)
{
for (l = (struct objc_list *) sarray_get_safe (__objc_selector_array, i);
@ -369,7 +402,7 @@ __sel_register_typed_name (const char *name, const char *types,
if (orig)
j = orig;
else
j = objc_malloc (sizeof (struct objc_selector));
j = pool_alloc_selector ();
j->sel_id = (void *) i;
/* Can we use the pointer or must copy types? Don't copy if NULL */
@ -388,7 +421,7 @@ __sel_register_typed_name (const char *name, const char *types,
if (orig)
j = orig;
else
j = objc_malloc (sizeof (struct objc_selector));
j = pool_alloc_selector ();
j->sel_id = (void *) i;
/* Can we use the pointer or must copy types? Don't copy if NULL */
@ -402,7 +435,7 @@ __sel_register_typed_name (const char *name, const char *types,
}
DEBUG_PRINTF ("Record selector %s[%s] as: %ld\n", name, types,
soffset_decode (i));
(long) soffset_decode (i));
{
int is_new = (l == 0);
@ -420,7 +453,7 @@ __sel_register_typed_name (const char *name, const char *types,
sarray_at_put_safe (__objc_selector_names, i, (void *) new_name);
sarray_at_put_safe (__objc_selector_array, i, (void *) l);
if (is_new)
hash_add (&__objc_selector_hash, (void *) new_name, (void *) i);
objc_hash_add (&__objc_selector_hash, (void *) new_name, (void *) i);
}
sarray_realloc (__objc_uninstalled_dtable, __objc_selector_max_index + 1);
@ -446,7 +479,7 @@ SEL
sel_register_typed_name (const char *name, const char *type)
{
SEL ret;
objc_mutex_lock (__objc_runtime_mutex);
/* Assume that name and type are not constant static memory and need to
be copied before put into a runtime structure. is_const == NO */

View File

@ -1,6 +1,6 @@
/* GNU Objective C Runtime message lookup
Copyright (C) 1993, 1995, 1996, 1997, 1998,
2001, 2002 Free Software Foundation, Inc.
2001, 2002, 2004 Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup
This file is part of GCC.
@ -16,8 +16,8 @@ details.
You should have received a copy of the GNU General Public License along with
GCC; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -26,16 +26,18 @@ Boston, MA 02111-1307, USA. */
covered by the GNU General Public License. */
/* FIXME: This file has no business including tm.h. */
/* FIXME: This should be using libffi instead of __builtin_apply
and friends. */
#include "tconfig.h"
#include "coretypes.h"
#include "tm.h"
#include "runtime.h"
#include "sarray.h"
#include "encoding.h"
#include "objc/runtime.h"
#include "objc/sarray.h"
#include "objc/encoding.h"
#include "runtime-info.h"
/* this is how we hack STRUCT_VALUE to be 1 or 0 */
/* This is how we hack STRUCT_VALUE to be 1 or 0. */
#define gen_rtx(args...) 1
#define gen_rtx_MEM(args...) 1
#define gen_rtx_REG(args...) 1
@ -83,7 +85,7 @@ Method_t search_for_method_in_list (MethodList_t list, SEL op);
id nil_method (id, SEL);
/* Given a selector, return the proper forwarding implementation. */
__inline__
inline
IMP
__objc_get_forward_imp (SEL sel)
{
@ -115,7 +117,7 @@ __objc_get_forward_imp (SEL sel)
}
/* Given a class and selector, return the selector's implementation. */
__inline__
inline
IMP
get_imp (Class class, SEL sel)
{
@ -176,7 +178,7 @@ get_imp (Class class, SEL sel)
/* Query if an object can respond to a selector, returns YES if the
object implements the selector otherwise NO. Does not check if the
method can be forwarded. */
__inline__
inline
BOOL
__objc_responds_to (id object, SEL sel)
{
@ -201,7 +203,7 @@ __objc_responds_to (id object, SEL sel)
/* This is the lookup function. All entries in the table are either a
valid method *or* zero. If zero then either the dispatch table
needs to be installed or it doesn't exist and forwarding is attempted. */
__inline__
inline
IMP
objc_msg_lookup (id receiver, SEL op)
{
@ -463,28 +465,14 @@ __objc_update_dispatch_table_for_class (Class class)
This one is only called for categories. Class objects have their
methods installed right away, and their selectors are made into
SEL's by the function __objc_register_selectors_from_class. */
SEL's by the function __objc_register_selectors_from_class. */
void
class_add_method_list (Class class, MethodList_t list)
{
int i;
/* Passing of a linked list is not allowed. Do multiple calls. */
assert (! list->method_next);
/* Check for duplicates. */
for (i = 0; i < list->method_count; ++i)
{
Method_t method = &list->method_list[i];
if (method->method_name) /* Sometimes these are NULL */
{
/* This is where selector names are transmogrified to SEL's */
method->method_name =
sel_register_typed_name ((const char *) method->method_name,
method->method_types);
}
}
__objc_register_selectors_from_list(list);
/* Add the methods to the class's method list. */
list->method_next = class->methods;
@ -705,7 +693,7 @@ __objc_print_dtable_stats ()
/* Returns the uninstalled dispatch table indicator.
If a class' dispatch table points to __objc_uninstalled_dtable
then that means it needs its dispatch table to be installed. */
__inline__
inline
struct sarray *
objc_get_uninstalled_dtable ()
{

View File

@ -15,8 +15,8 @@ details.
You should have received a copy of the GNU General Public License along with
GCC; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -25,8 +25,8 @@ Boston, MA 02111-1307, USA. */
covered by the GNU General Public License. */
#include <pthread.h>
#include <thr.h>
#include "runtime.h"
#include "objc/thr.h"
#include "objc/runtime.h"
/* Key structure for maintaining thread specific storage */
static pthread_key_t _objc_thread_storage;

View File

@ -15,8 +15,8 @@ details.
You should have received a copy of the GNU General Public License along with
GCC; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -25,8 +25,8 @@ Boston, MA 02111-1307, USA. */
covered by the GNU General Public License. */
#include <pthread.h>
#include <objc/thr.h>
#include "runtime.h"
#include "objc/thr.h"
#include "objc/runtime.h"
/* Key structure for maintaining thread specific storage */
static pthread_key_t _objc_thread_storage;

View File

@ -15,8 +15,8 @@ details.
You should have received a copy of the GNU General Public License along with
GCC; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -29,8 +29,8 @@ Boston, MA 02111-1307, USA. */
#include <sys/sysmp.h>
#include <sys/prctl.h>
#include <ulocks.h>
#include <objc/thr.h>
#include "runtime.h"
#include "objc/thr.h"
#include "objc/runtime.h"
/* Key structure for maintaining thread specific storage */
static void * __objc_shared_arena_handle = NULL;

View File

@ -17,8 +17,8 @@ details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -28,8 +28,8 @@ Boston, MA 02111-1307, USA. */
#include <mach/mach.h>
#include <mach/cthreads.h>
#include <objc/thr.h>
#include "runtime.h"
#include "objc/thr.h"
#include "objc/runtime.h"
/*
Obtain the maximum thread priority that can set for t. Under the

View File

@ -1,5 +1,6 @@
/* 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.
@ -14,8 +15,8 @@ details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -24,12 +25,20 @@ Boston, MA 02111-1307, USA. */
covered by the GNU General Public License. */
#define _LIBOBJC
/* The line below is needed for declarations of functions such as
pthread_mutexattr_settype, without which gthr-posix.h may fail to
compile within libobjc. Unfortunately, this breaks compilation on
Tru64 UNIX V4.0F, so disable it there. */
#ifndef __osf__
#define _XOPEN_SOURCE 500
#endif
#include "config.h"
#include "tconfig.h"
#include "coretypes.h"
#include "tm.h"
#include "defaults.h"
#include <objc/thr.h>
#include "runtime.h"
#include "objc/thr.h"
#include "objc/runtime.h"
#include <gthr.h>
/* Backend initialization functions */

View File

@ -15,8 +15,8 @@ details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -24,8 +24,8 @@ Boston, MA 02111-1307, USA. */
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include <objc/thr.h>
#include "runtime.h"
#include "objc/thr.h"
#include "objc/runtime.h"
#define INCL_DOSSEMAPHORES
#define INCL_DOSPROCESS

View File

@ -17,8 +17,8 @@ details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -26,8 +26,8 @@ Boston, MA 02111-1307, USA. */
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include <objc/thr.h>
#include "runtime.h"
#include "objc/thr.h"
#include "objc/runtime.h"
#include <pthread.h>
/* Key structure for maintaining thread specific storage */

View File

@ -16,8 +16,8 @@ details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -26,8 +26,8 @@ Boston, MA 02111-1307, USA. */
covered by the GNU General Public License. */
#include <pcthread.h>
#include <objc/thr.h>
#include "runtime.h"
#include "objc/thr.h"
#include "objc/runtime.h"
/* Key structure for maintaining thread specific storage */
static pthread_key_t _objc_thread_storage;

View File

@ -17,8 +17,8 @@ details.
You should have received a copy of the GNU General Public License along with
GCC; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -26,8 +26,8 @@ Boston, MA 02111-1307, USA. */
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include <objc/thr.h>
#include "runtime.h"
#include "objc/thr.h"
#include "objc/runtime.h"
/* Thread local storage for a single thread */
static void *thread_local_storage = NULL;

View File

@ -15,8 +15,8 @@ details.
You should have received a copy of the GNU General Public License along with
GCC; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -24,8 +24,8 @@ Boston, MA 02111-1307, USA. */
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include <objc/thr.h>
#include "runtime.h"
#include "objc/thr.h"
#include "objc/runtime.h"
/* Thread local storage for a single thread */
static void *thread_local_storage = NULL;

View File

@ -16,8 +16,8 @@ details.
You should have received a copy of the GNU General Public License along with
GCC; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -25,8 +25,8 @@ Boston, MA 02111-1307, USA. */
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include <objc/thr.h>
#include "runtime.h"
#include "objc/thr.h"
#include "objc/runtime.h"
#include <thread.h>
#include <synch.h>

View File

@ -15,8 +15,8 @@ details.
You should have received a copy of the GNU General Public License along with
GCC; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -24,8 +24,8 @@ Boston, MA 02111-1307, USA. */
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include <objc/thr.h>
#include "runtime.h"
#include "objc/thr.h"
#include "objc/runtime.h"
/* Thread local storage for a single thread */
static void *thread_local_storage = NULL;

View File

@ -15,8 +15,8 @@ details.
You should have received a copy of the GNU General Public License along with
GCC; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -24,8 +24,8 @@ Boston, MA 02111-1307, USA. */
however invalidate any other reasons why the executable file might be
covered by the GNU General Public License. */
#include <objc/thr.h>
#include "runtime.h"
#include "objc/thr.h"
#include "objc/runtime.h"
#ifndef __OBJC__
#define __OBJC__

View File

@ -15,8 +15,8 @@ details.
You should have received a copy of the GNU General Public License along with
GCC; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you link this library with files compiled with
GCC to produce an executable, this does not cause the resulting executable
@ -25,7 +25,7 @@ Boston, MA 02111-1307, USA. */
covered by the GNU General Public License. */
#include <stdlib.h>
#include "runtime.h"
#include "objc/runtime.h"
/* Global exit status. */
int __objc_thread_exit_status = 0;
@ -75,8 +75,8 @@ struct __objc_thread_start_state
id argument;
};
static volatile void
__objc_thread_detach_function (struct __objc_thread_start_state *istate)
static void __attribute__((noreturn))
__objc_thread_detach_function (struct __objc_thread_start_state *istate)
{
/* Valid state? */
if (istate) {