diff --git a/ChangeLog b/ChangeLog index bf528e6..d1a0414 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,671 @@ +2006-01-20 Adam Fedor + + * Import from recent gcc repository 2006-01-03 with fixups (see + ChangeLog for more info). + * ChangeLog, GNUmakefile, Protocol.m, encoding.c, hash.c, init.c, + libobjc.def, linking.c, sarray.c, selector.c, sendmsg.c, thr-mach.c, + thr-objc.c, thr-posix.c, thr-win32.c, objc/hash.h, objc/objc-api.h, + objc/objc-decls.h, objc/runtime.h: Import and fixup. + + * README.GNUstep: Update. + +2005-12-14 Andrew Pinski + + 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 + + PR libobjc/14382 + * README (+load,+initialize): Fix documentation to reflect + intended and implemented semantics for +load and +initialize. + +2005-12-12 Andrew Pinski + + * 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-12-11 Andrew Pinski + + 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 + + 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 + + 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 + + PR other/4372 + * thr-objc.c (_XOPEN_SOURCE): Define. + +2005-10-07 Ulrich Weigand + + PR libobjc/23612 + * objc/objc-api.h (struct objc_ivar): Move definition to + global scope. + +2005-09-04 Andrew Pinski + Rasmus Hahn + + PR libobjc/23108 + * archive.c (objc_write_type): Correct the element offset. + (objc_read_type): Likewise. + +2005-08-17 Kelley Cook + + * All files: Update FSF address. + +2005-08-13 Marcin Koziej + Andrew Pinski + + PR libobjc/22492 + * exception.c (PERSONALITY_FUNCTION): Fix the PC with finally. + +2005-08-13 Andrew Pinski + + * 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 + + PR libobjc/22606 + * Makefile.in (ALL_CFLAGS): Add -fexceptions. + +2005-06-08 David Ayers + + * 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 + + * 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 + + * exception.c: Revert last change. + +2005-05-19 David Ayers + + * exception.c: Include tsystem.h for unwind.h. + +2005-05-09 Mike Stump + + * configure: Regenerate. + +2005-04-12 Mike Stump + + * configure: Regenerate. + +2005-03-21 Zack Weinberg + + * 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 + + * objc/hash.h (OBJC_IGNORE_DEPRECATED_API): Update deprecated + version reference. Correct typo. + +2005-03-02 David Ayers + + 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 + + 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 + + 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 + + PR libobjc/12035 + * gc.c: Remove definition of LOGWL, modWORDSZ, and divWORDSZ since + they are not used. + Include limits.h and stdlib.h. + Define BITS_PER_WORD. + +2004-12-12 Alexander Malmberg + + * selector.c (__objc_init_selector_tables): Add missing void to + definition. + +2004-12-02 Richard Sandiford + + * configure.ac: Use TL_AC_GCC_VERSION to set gcc_version. + * configure, aclocal.m4: Regenerate. + +2004-11-29 Kelley Cook + + * configure: Regenerate for libtool change. + +2004-11-25 Kelley Cook + + * configure: Regenerate for libtool reversion. + +2004-11-24 Kelley Cook + + * configure: Regenerate for libtool change. + +2004-11-24 Kelley Cook + + * aclocal.m4, config.h.in: Regenerate. + +2004-10-08 Mike Stump + Andrew Pinski + + * 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 + + * archive.c: Fix all the warnings about passing unsigned char* + to char* and the other way too. + +2004-09-16 Andrew Pinski + + 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 + + * encoding.c (ALTIVEC_VECTOR_MODE): Define a bogus macro. + +2004-08-28 Nathanael Nerode + + * configure.ac: Switch from _GCC_TOPLEV_NONCANONICAL_TARGET to + ACX_NONCANONICAL_TARGET. + * configure: Regenerate. + +2004-08-13 Ziemowit Laski + + * 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 + + * 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 + + * objc/NXConstStr.h: Update copyright date; bracket with + 'extern "C"' for C++ use; make include syntax consistent + by using <...> instead of "..."; hoist 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 + + * thr.c (__objc_thread_detach_function): Do not mark as volatile + but instead use the attribute noreturn. + +2004-06-28 Zack Weinberg + + * encoding.c: Rename target_flags with a #define to avoid + conflict with a prior declaration. + +2004-06-24 Andrew Pinski + + * 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 + + * encoding.c (BITS_PER_UNIT): Define if a definition is not + provided. + +2004-06-20 Alexander Malmberg + + * Makefile.in (exception.lo): Remove $(OBJC_GCFLAGS). + (exception_gc.lo): New. + (OBJS_GC): Add exception_gc.lo. + +2004-06-17 Richard Henderson + + * exception.c: New file. + * Makefile.in (exception.lo): New. + (OBJS): Add it. + +2004-06-14 Andrew Pinski + + * linking.m (_objcInit): New empty function + for Darwin only. + +2004-06-11 Andrew Pinski + + * 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 + + * 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 + + * Protocol.m ([-isEqual:]): Test the class of the argument. + +2004-05-25 Andrew Pinski + + * 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 + + * Makefile.in: Add .NOEXPORT. + +2004-05-25 Andrew Pinski + + Merge from the libobjc-branch + 2004-02-09 Andrew Pinski + + * Makefile.in (OBJC_H): Change objc-deps.h to objc-decls.h. + + 2004-02-03 Andrew Pinski + + * Makefile.in (OBJC_H): Add objc-deps.h. + + 2004-01-27 Nicola Pero + + * Protocol.m ([-conformsTo:]): If the argument is nil, return NO. + ([-hash], [-isEqual:]): New methods. + + 2004-01-27 Richard Frith-Macdonald + + * sarray.c (sarray_free): Add a better comment. + + 2004-01-27 Adam Fedor + + * hash.c (hash_add): Cast cachep to int. + * selector.c (__sel_register_typed_name): Cast + soffset_decode to int. + + 2004-01-27 Alexander Malmberg + + * 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 + Nicola Pero + Andrew Pinski + + * 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 + + * 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 + + * archive.c (objc_read_class): Initialize class_name. + (objc_read_selector): Initialize selector_name. + +2004-05-09 Richard Sandiford + + * Makefile.in (toolexecdir): Remove trailing space. + +2004-04-15 Nathanael Nerode + + PR libobjc/14948 + * configure.ac: De-precious CC so multilibs work. + * configure: Regenerate. + +2004-04-14 Nathanael Nerode + + * configure.ac: Restore toolexecdir. + * Makefile.in: Restore toolexecdir. + * configure: Regenerate. + +2004-04-09 Nathanael Nerode + + * 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 + + * Makefile.in, configure.in, configure: Update copyright years. + +2004-03-15 Manfred Hollstein + + * 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 + + * 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 + + * Makefile.in (ALL_CFLAGS): Add -fno-strict-aliasing. + +2004-02-06 Ziemowit Laski + + * objc/objc-api.h (objc_super): The 'class' field shall + be named 'super_class' #ifdef __cplusplus. + +2004-01-17 Andrew Pinski + + PR target/10781 + * encoding.c (rs6000_special_round_type_align): Define. + +2004-01-14 Adam Fedor + + PR libobjc/12155 + * selector.c (__objc_register_instance_methods_to_class): Free + new_list if not used. + +2004-01-09 Andrew Ruder + + PR libobjc/11904 + * sarray.c (sarray_free): Free array->is_copy_of latter. + +2003-12-01 Zack Weinberg + + PR 11433 + * Protocol.m (descriptionForInstanceMethod): Don't dereference + instance_methods if it's NULL. + (descriptionForClassMethod): Likewise for class_methods. + +2003-10-24 Rainer Orth + + * Makefile.in (runtime-info.h): Remove -Wp. + +2003-10-21 Rainer Orth + + * Makefile.in (CC1OBJ): Remove. + (runtime-info.h): Invoke $(CC) so all MULTIFLAGS are handled + correctly. + Use .m extension for temporary file. + Remove assembler temp file. + +2003-10-20 Joseph S. Myers + + * objc/hash.h (hash_string): Don't use a cast as an lvalue. + +2003-10-17 Rainer Orth + + * Makefile.in (runtime-info.h): Use MULTIFLAGS. + +2003-09-09 Alan Modra + + * configure: Regenerate. + +2003-08-27 Alexander Malmberg + + * Makefile.in, aclocal.m4: Update to $(libdir)/gcc/ instead of + (libdir)/gcc-lib/ when installing. + * configure: Regenerate. + +Thu Jul 10 10:27:43 2003 Nicola Pero + + libobjc/9969 + * sendmsg.c (get_imp): Fixed rare threading problem. + (__objc_responds_to): Similar fixes. + (objc_msg_lookup): Similar fixes. + (__objc_init_install_dtable): Lock the runtime before checking if the + table is installed. + +2003-05-23 Nathanael Nerode + + * hash.c, init.c, libobjc.def, libobjc_entry.c, linking.m, + makefile.dos, 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: Replace "GNU CC" with "GCC". + * Makefile.in, NXConstStr.m, Object.m, Protocol.m, archive.c, + class.c, encoding.c, gc.c, objc/NXConstStr.h, objc/Object.h, + objc/Protocol.h, objc/encoding.h, objc/hash.h, objc/objc-api.h, + objc/objc-list.h, objc/objc.h, ocjc/runtime.h, objc/sarray.h, + objc/thr.h, objc/typedstream.h: Replace "GNU CC" with "GCC". + +Tue May 13 14:56:03 2003 Richard Frith-Macdonald + Nicola Pero + + libobjc/10742 + * init.c (class_superclass_of_class): New function. + (create_tree_of_subclasses_inherited_from): Use it. + (__objc_tree_insert_class): Likewise. + (class_is_subclass_of_class): Likewise. + +2003-04-11 David Chad + Loren J. Rittle + + libobjc/8562 + * objc/hash.h (hash_string): Constify correctly. + (compare_ptrs): Use direct compare. + * objc/objc-list.h (list_nth): Rename index to indx to avoid shadow. + * objc/sarray.h: Global rename index to indx to avoid shadow. + +2003-03-12 Andreas Schwab + + * aclocal.m4 (GLIBCPP_EXPORT_INSTALL_INFO): Avoid trailing /. in + glibcpp_toolexeclibdir. + * configure: Rebuilt. + 2003-02-20 Alexandre Oliva * configure.in: Propagate ORIGINAL_LD_FOR_MULTILIBS to diff --git a/ChangeLog.GNUstep b/ChangeLog.GNUstep index 5d21344..b9d9aeb 100644 --- a/ChangeLog.GNUstep +++ b/ChangeLog.GNUstep @@ -1,3 +1,14 @@ +2006-01-20 Adam Fedor + + * Import from gcc repository 2006-01-03 with fixups (see + ChangeLog for more info). + * ChangeLog, GNUmakefile, Protocol.m, encoding.c, hash.c, init.c, + libobjc.def, linking.c, sarray.c, selector.c, sendmsg.c, thr-mach.c, + thr-objc.c, thr-posix.c, thr-win32.c, objc/hash.h, objc/objc-api.h, + objc/objc-decls.h, objc/runtime.h: Import and fixup. + + * README.GNUstep: Update. + 2005-08-15 Adam Fedor * Version 1.4.0 diff --git a/GNUmakefile b/GNUmakefile index 5b68217..07cf1a8 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -177,11 +177,10 @@ endif -include GNUmakefile.postamble -#ADDITIONAL_INCLUDE_DIRS += -Iobjc -I. -I../gcc -I../gcc/config ADDITIONAL_INCLUDE_DIRS += \ -Iconfig/$(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS) \ -Iconfig/$(GNUSTEP_TARGET_CPU)/generic \ - -Iobjc -I. + -I. before-all:: runtime-info.h @@ -218,11 +217,3 @@ after-clean:: after-distclean:: rm -f config.status config.log config.cache - - - - - - - - diff --git a/Protocol.m b/Protocol.m index d98861e..645e991 100644 --- a/Protocol.m +++ b/Protocol.m @@ -1,22 +1,22 @@ /* 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 GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify +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. -GNU CC is distributed in the hope that it will be useful, +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 GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +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 @@ -83,14 +83,12 @@ struct objc_method_description_list { const char* name = sel_get_name (aSel); struct objc_method_description *result; - if (instance_methods != 0) - { - for (i = 0; i < instance_methods->count; i++) - { - if (!strcmp ((char*)instance_methods->list[i].name, name)) - return &(instance_methods->list[i]); - } - } + if (instance_methods) + for (i = 0; i < instance_methods->count; i++) + { + if (!strcmp ((char*)instance_methods->list[i].name, name)) + return &(instance_methods->list[i]); + } for (proto_list = protocol_list; proto_list; proto_list = proto_list->next) { @@ -113,14 +111,12 @@ struct objc_method_description_list { const char* name = sel_get_name (aSel); struct objc_method_description *result; - if (class_methods != 0) - { - for (i = 0; i < class_methods->count; i++) - { - if (!strcmp ((char*)class_methods->list[i].name, name)) - return &(class_methods->list[i]); - } - } + if (class_methods) + for (i = 0; i < class_methods->count; i++) + { + if (!strcmp ((char*)class_methods->list[i].name, name)) + return &(class_methods->list[i]); + } for (proto_list = protocol_list; proto_list; proto_list = proto_list->next) { @@ -154,11 +150,33 @@ struct objc_method_description_list { 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 (strcmp (protocol_name, [obj name]) == 0) + if (obj == self) return YES; + if ([obj isKindOf: [Protocol class]]) + { + if (strcmp (protocol_name, ((Protocol *)obj)->protocol_name) == 0) + return YES; + } + return NO; } @end + diff --git a/README.GNUstep b/README.GNUstep index 3dd88d3..e5d5f94 100644 --- a/README.GNUstep +++ b/README.GNUstep @@ -1,11 +1,10 @@ -This is a snapshot of the GCC libobjc library, which includes -a patch that fixes dallocation of posix threads, ffi library support -and other things that are not in the gcc 2.95.2 release. +This is a snapshot of the GCC libobjc library, which includes some +patches that may not have made it into the gcc tree. -Note: You do not need this library if you are using gcc 3, which incorporates -all the changes here, UNLESS you are on a Windows machine. The libobjc from -gcc 3 still does not work with Windows. +Note: You do not need this library if you are using gcc 3 or greater, +UNLESS you are on a Windows machine (Windows with gcc > 4 may not need this +at al). In addition, a GNUmakefile file has been added so this library can be compiled stand-alone (i.e. without the rest of the gcc sources). However, you diff --git a/configure.in b/configure.in deleted file mode 100644 index b20671f..0000000 --- a/configure.in +++ /dev/null @@ -1,127 +0,0 @@ -# Process this file with autoconf to produce a configure script. -# Copyright (C) 1995, 1997, 1998, 1999, 2002, 2003 -# Free Software Foundation, Inc. -# Contributed by Dave Love (d.love@dl.ac.uk). -# -#This file is part of GNU Objective C. -# -#GNU Objective C 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. -# -#GNU Objective C 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 GNU Objective C; see the file COPYING. If not, write to -#the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -#02111-1307, USA. - -AC_PREREQ(2.13) -AC_INIT(objc/objc.h) -AC_CONFIG_HEADER(config.h) - -# 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 - -GLIBCPP_TOPREL_CONFIGURE - -AC_CANONICAL_SYSTEM -target_alias=${target_alias-$target} -AC_SUBST(target_alias) - -GLIBCPP_CONFIGURE(.) -GLIBCPP_EXPORT_INSTALL_INFO - -dnl Checks for programs. - -# Disable shared libs by default -AC_DISABLE_SHARED -# Enable Win32 DLL on MS Windows - FIXME -AC_LIBTOOL_WIN32_DLL - -AC_PROG_LIBTOOL - -dnl These should be inherited in the recursive make, but ensure they are -dnl defined: -test "$AR" || AR=ar -AC_SUBST(AR) -if test "$RANLIB"; then : - AC_SUBST(RANLIB) -else - AC_PROG_RANLIB -fi -AC_PROG_INSTALL -AC_PROG_MAKE_SET - -dnl Checks for header files. -# 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) - -# Determine CFLAGS for gthread. - -AC_CACHE_CHECK([for gthread cflags],objc_cv_gthread_flags, -[if test -f "$r"/gcc/Makefile -then - objc_cv_gthread_flags=`grep \^GTHREAD_FLAGS "$r"/gcc/Makefile | awk -F= '{ print $2 }'` -else - AC_MSG_ERROR([not found]) -fi]) -GTHREAD_FLAGS=$objc_cv_gthread_flags -AC_SUBST(GTHREAD_FLAGS) - -AC_ARG_ENABLE(objc-gc, -[ --enable-objc-gc enable the use of Boehm's garbage collector with - the GNU Objective-C runtime.], -if [[[ x$enable_objc_gc = xno ]]]; then - OBJC_BOEHM_GC='' -else - OBJC_BOEHM_GC=libobjc_gc.la -fi, -OBJC_BOEHM_GC='') -AC_SUBST(OBJC_BOEHM_GC) - - -# We need multilib support, but only if configuring for the target. -AC_OUTPUT(Makefile, - [test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h -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}" - . ${toplevel_srcdir}/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}" -toplevel_srcdir=${toplevel_srcdir} -CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} -ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}" -) - - -dnl Local Variables: -dnl comment-start: "dnl " -dnl comment-end: "" -dnl comment-start-skip: "\\bdnl\\b\\s *" -dnl End: diff --git a/encoding.c b/encoding.c index 1c982c6..94c2507 100644 --- a/encoding.c +++ b/encoding.c @@ -1,25 +1,25 @@ /* 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 -This file is part of GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify +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. -GNU CC is distributed in the hope that it will be useful, +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 GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +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 @@ -29,9 +29,11 @@ Boston, MA 02111-1307, USA. */ /* FIXME: This file has no business including tm.h. */ -#include "tconfig.h" -#include "objc-api.h" -#include "encoding.h" +//#include "tconfig.h" +//#include "coretypes.h" +//#include "tm.h" +#include "objc/objc-api.h" +#include "objc/encoding.h" #include #undef MAX @@ -65,26 +67,59 @@ 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 + definitely has no business defining this macro but it + 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) \ + ({ 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));}) /* return the size of an object specified by type @@ -101,6 +136,12 @@ objc_sizeof_type (const char *type) } switch (*type) { + case _C_BOOL: +#if __GNUC__ != 2 + return sizeof (_Bool); + break; +#endif + case _C_ID: return sizeof (id); break; @@ -196,6 +237,7 @@ objc_sizeof_type (const char *type) return endByte - startByte; } + case _C_UNION_B: case _C_STRUCT_B: { struct objc_struct_layout layout; @@ -208,25 +250,70 @@ objc_sizeof_type (const char *type) return size; } - - case _C_UNION_B: + +#if __GNUC__ != 2 + 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; } +#endif default: { @@ -251,6 +338,12 @@ objc_alignof_type (const char *type) /* do nothing */; } switch (*type) { +#if __GNUC__ != 2 + case _C_BOOL: + return __alignof__ (_Bool); + break; +#endif + case _C_ID: return __alignof__ (id); break; @@ -323,6 +416,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; @@ -334,25 +428,70 @@ objc_alignof_type (const char *type) return align; } - - case _C_UNION_B: + +#if __GNUC__ != 2 + 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; } +#endif default: { @@ -474,6 +613,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: @@ -483,6 +623,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 ']' */ @@ -731,13 +875,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 "=" if any. Avoid embedded structures and unions. */ @@ -770,13 +915,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 */ @@ -792,7 +941,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 */ @@ -892,14 +1042,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 diff --git a/hash.c b/hash.c index 3b487d5..969bd45 100644 --- a/hash.c +++ b/hash.c @@ -1,22 +1,22 @@ /* 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 GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify +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. -GNU CC is distributed in the hope that it will be useful, +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 GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +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 @@ -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", (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)]; diff --git a/init.c b/init.c index 847666b..91f4ae8 100644 --- a/init.c +++ b/init.c @@ -3,20 +3,20 @@ Contributed by Kresten Krab Thorup +load support contributed by Ovidiu Predescu -This file is part of GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify it under the +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. -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY +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 -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +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 @@ -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); @@ -458,8 +460,8 @@ objc_init_statics (void) haven't been here before. However, the comparison is to be reminded of taking into account class posing and to think about possible semantics... */ - else - { + else if (class != statics->instances[0]->class_pointer) + { id *inst; for (inst = &statics->instances[0]; *inst; inst++) @@ -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; } @@ -727,23 +730,12 @@ objc_send_load (void) return; } -#if 0 - /* Special check to allow creating and sending messages to constant strings - in +load methods. If these classes are not yet known, even if all the - other classes are known, delay sending of +load. */ - if (!objc_lookup_class ("NXConstantString") || - !objc_lookup_class ("Object")) -#else - /* - * The above check prevents +load being called at all if NXConstantString - * is never created (common on modern systems). However, completely - * removing it causes the runtime test in the GNUstep base library - * configure to fail (for some unknown reason), so we retain the check for - * the existence of the Object class. - */ - if (!objc_lookup_class ("Object")) + /* Special check to allow creating and sending messages to constant + strings in +load methods. If these classes are not yet known, + even if all the other classes are known, delay sending of +load. */ + if (! objc_lookup_class ("NXConstantString") || + ! objc_lookup_class ("Object")) return; -#endif /* Iterate over all modules in the __objc_module_list and call on them the __objc_create_classes_tree function. This function @@ -883,9 +875,6 @@ __objc_init_protocols (struct objc_protocol_list *protos) (int) ((char *) protos->list[i]->class_pointer - (char *) 0), PROTOCOL_VERSION); - } else { - /* even if the protocol is initialized, the super protos might not be */ - __objc_init_protocols (aProto->protocol_list); } } diff --git a/libobjc.def b/libobjc.def index cb6b687..028bdce 100644 --- a/libobjc.def +++ b/libobjc.def @@ -2,43 +2,36 @@ ; Copyright (C) 1997 Free Software Foundation, Inc. ; Contributed by Scott Christley ; -; This file is part of GNU CC. +; This file is part of GCC. ; -; GNU CC is free software; you can redistribute it and/or modify it under the +; 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. ; -; GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY +; 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 -; GNU CC; see the file COPYING. If not, write to the Free Software -; Foundation, 59 Temple Place - Suite 330, -; Boston, MA 02111-1307, USA. +; GCC; see the file COPYING. If not, write to the Free Software +; 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_lookup_class _objc_load_callback -__objc_msg_forward objc_malloc objc_atomic_malloc objc_valloc objc_realloc objc_calloc objc_free -_objc_malloc -_objc_atomic_malloc -_objc_valloc -_objc_realloc -_objc_calloc -_objc_free __objc_init_thread_system objc_mutex_allocate objc_mutex_deallocate @@ -58,24 +51,15 @@ objc_thread_remove __objc_class_name_Object __objc_class_name_Protocol objc_error -_objc_object_alloc -_objc_object_copy -_objc_object_dispose +__objc_object_alloc +__objc_object_copy +__objc_object_dispose class_create_instance object_copy object_dispose __objc_init_selector_tables __objc_register_selectors_from_class __sel_register_typed_name -__objc_runtime_mutex -__objc_is_multi_threaded -__objc_runtime_threads_alive -objc_set_thread_callback -objc_condition_allocate -objc_condition_deallocate -objc_condition_wait -objc_condition_broadcast -objc_condition_signal sel_get_any_typed_uid sel_get_any_uid sel_get_name @@ -94,10 +78,6 @@ method_get_sizeof_arguments objc_aligned_size objc_alignof_type objc_get_type_qualifiers -objc_layout_finish_structure -objc_layout_structure_get_info -objc_layout_structure -objc_layout_structure_next_member objc_promoted_size objc_sizeof_type objc_skip_argspec @@ -175,11 +155,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 -objc_set_error_handler -class_ivar_set_gcinvisible diff --git a/linking.m b/linking.m index ec019ab..cb2a57e 100644 --- a/linking.m +++ b/linking.m @@ -2,22 +2,22 @@ Copyright (C) 1997 Free Software Foundation, Inc. Contributed by Ovidiu Predescu (ovidiu@net-community.com). -This file is part of GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify +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. -GNU CC is distributed in the hope that it will be useful, +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 GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +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 diff --git a/objc/hash.h b/objc/hash.h index e695012..b1cdd0c 100644 --- a/objc/hash.h +++ b/objc/hash.h @@ -1,22 +1,22 @@ /* 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 GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify +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. -GNU CC is distributed in the hope that it will be useful, +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 GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +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 @@ -30,7 +30,11 @@ Boston, MA 02111-1307, USA. */ #include #include -#include +#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,14 +172,14 @@ 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 = (const char *) key; - - while (*(char *) key) { - ret ^= *(char *) key++ << ctr; + while (*ckey) { + ret ^= *ckey++ << ctr; ctr = (ctr + 1) % sizeof (void *); } @@ -185,23 +189,28 @@ 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); + return (k1 == 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 */ diff --git a/objc/objc-api.h b/objc/objc-api.h index e919b42..e0e49e2 100644 --- a/objc/objc-api.h +++ b/objc/objc-api.h @@ -1,22 +1,22 @@ /* 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 GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify it +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. -GNU CC is distributed in the hope that it will be useful, but WITHOUT +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 GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +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 @@ -27,13 +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/objc-decls.h" +#include "objc.h" +#include "hash.h" +#include "thr.h" +#include "objc-decls.h" #include #include +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* For functions which return Method_t */ #define METHOD_NULL (Method_t)0 /* Boolean typedefs */ @@ -65,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 '^' @@ -77,6 +82,7 @@ struct objc_method_description #define _C_STRUCT_B '{' #define _C_STRUCT_E '}' #define _C_VECTOR '!' +#define _C_COMPLEX 'j' /* @@ -147,7 +153,11 @@ extern BOOL objc_trace; struct objc_static_instances { char *class_name; +#ifdef __cplusplus + id instances[1]; +#else id instances[0]; +#endif }; /* @@ -205,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. */ @@ -222,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; @@ -236,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 { @@ -343,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); @@ -366,12 +380,12 @@ objc_EXPORT Class (*_objc_lookup_class)(const char *name); ** dynamic loader determine the classes that have been loaded when ** an object file is dynamically linked in. */ -objc_EXPORT 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 */ -objc_EXPORT id (*_objc_object_alloc)(Class class); +objc_EXPORT id (*_objc_object_alloc)(Class _class); objc_EXPORT id (*_objc_object_copy)(id object); objc_EXPORT id (*_objc_object_dispose)(id object); @@ -423,9 +437,9 @@ objc_EXPORT void (*_objc_free)(void *); */ 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); @@ -454,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); @@ -523,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__ @@ -602,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 */ diff --git a/objc/objc-decls.h b/objc/objc-decls.h index 4fd5178..52938a2 100644 --- a/objc/objc-decls.h +++ b/objc/objc-decls.h @@ -1,22 +1,37 @@ -// $Id$ +/* GNU Objective-C Extern helpers for Win32. + Copyright (C) 2004 Free Software Foundation, Inc. -#ifndef __objc_decls_H__ -#define __objc_decls_H__ +This file is part of GCC. -#ifdef GNUSTEP_WITH_DLL +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. -#if BUILD_libobjc_DLL -# -# if defined(__MINGW32__) - /* On Mingw, the compiler will export all symbols automatically, so - * __declspec(dllexport) is not needed. - */ -# define objc_EXPORT extern -# define objc_DECLARE -# else +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) -# endif #else # define objc_EXPORT extern __declspec(dllimport) # define objc_DECLARE extern __declspec(dllimport) @@ -29,4 +44,4 @@ #endif -#endif /* __objc_decls_H__ */ +#endif /* __objc_decls_INCLUDE_GNU */ diff --git a/objc/runtime.h b/objc/runtime.h index ef72f06..49c84af 100644 --- a/objc/runtime.h +++ b/objc/runtime.h @@ -1,21 +1,21 @@ /* 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 GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify it under the +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. -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY +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 -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +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 @@ -32,15 +32,19 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include /* so noone else will get system versions */ -#include "assert.h" +#include -#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); -#endif /* not __objc_runtime_INCLUDE_GNU */ - +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* not __objc_runtime_INCLUDE_GNU */ diff --git a/sarray.c b/sarray.c index 1421336..b35772b 100644 --- a/sarray.c +++ b/sarray.c @@ -1,22 +1,22 @@ /* 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 GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify +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. -GNU CC is distributed in the hope that it will be useful, +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 GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +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 @@ -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 #include "assert.h" @@ -402,7 +402,7 @@ sarray_free (struct sarray *array) { #else old_buckets = array->buckets; #endif - + /* Free all entries that do not point to empty_bucket */ for (counter = 0; counter <= old_max_index; counter++ ) { #ifdef OBJC_SPARSE3 diff --git a/selector.c b/selector.c index ed71f61..223c710 100644 --- a/selector.c +++ b/selector.c @@ -1,21 +1,21 @@ /* 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 GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify it under the +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. -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY +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 -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +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 @@ -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 */ @@ -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 */ diff --git a/sendmsg.c b/sendmsg.c index ea22356..6e0e436 100644 --- a/sendmsg.c +++ b/sendmsg.c @@ -1,23 +1,23 @@ /* 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 GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify it under the +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. -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY +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 -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +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 @@ -26,14 +26,18 @@ Boston, MA 02111-1307, USA. */ covered by the GNU General Public License. */ /* FIXME: This file has no business including tm.h. */ - -#include "tconfig.h" -#include "runtime.h" -#include "sarray.h" -#include "encoding.h" +/* FIXME: This should be using libffi instead of __builtin_apply + and friends. */ + +//#include "tconfig.h" +//#include "coretypes.h" +//#include "tm.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 @@ -81,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) { @@ -113,10 +117,18 @@ __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) { + /* In a vanilla implementation we would first check if the dispatch + table is installed. Here instead, to get more speed in the + standard case (that the dispatch table is installed) we first try + to get the imp using brute force. Only if that fails, we do what + we should have been doing from the very beginning, that is, check + if the dispatch table needs to be installed, install it if it's + not installed, and retrieve the imp from the table if it's + installed. */ void *res = sarray_get_safe (class->dtable, (size_t) sel->sel_id); if (res == 0) { @@ -125,7 +137,16 @@ get_imp (Class class, SEL sel) { /* The dispatch table needs to be installed. */ objc_mutex_lock (__objc_runtime_mutex); - __objc_install_dispatch_table_for_class (class); + + /* Double-checked locking pattern: Check + __objc_uninstalled_dtable again in case another thread + installed the dtable while we were waiting for the lock + to be released. */ + if (class->dtable == __objc_uninstalled_dtable) + { + __objc_install_dispatch_table_for_class (class); + } + objc_mutex_unlock (__objc_runtime_mutex); /* Call ourselves with the installed dispatch table and get the real method */ @@ -133,10 +154,22 @@ get_imp (Class class, SEL sel) } else { - /* The dispatch table has been installed so the - method just doesn't exist for the class. - Return the forwarding implementation. */ - res = __objc_get_forward_imp (sel); + /* The dispatch table has been installed. */ + + /* Get the method from the dispatch table (we try to get it + again in case another thread has installed the dtable just + after we invoked sarray_get_safe, but before we checked + class->dtable == __objc_uninstalled_dtable). + */ + res = sarray_get_safe (class->dtable, (size_t) sel->sel_id); + if (res == 0) + { + /* The dispatch table has been installed, and the method + is not in the dispatch table. So the method just + doesn't exist for the class. Return the forwarding + implementation. */ + res = __objc_get_forward_imp (sel); + } } } return res; @@ -145,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) { @@ -155,7 +188,10 @@ __objc_responds_to (id object, SEL sel) if (object->class_pointer->dtable == __objc_uninstalled_dtable) { objc_mutex_lock (__objc_runtime_mutex); - __objc_install_dispatch_table_for_class (object->class_pointer); + if (object->class_pointer->dtable == __objc_uninstalled_dtable) + { + __objc_install_dispatch_table_for_class (object->class_pointer); + } objc_mutex_unlock (__objc_runtime_mutex); } @@ -167,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) { @@ -190,10 +226,19 @@ objc_msg_lookup (id receiver, SEL op) } else { - /* The dispatch table has been installed so the - method just doesn't exist for the class. - Attempt to forward the method. */ - result = __objc_get_forward_imp (op); + /* The dispatch table has been installed. Check again + if the method exists (just in case the dispatch table + has been installed by another thread after we did the + previous check that the method exists). + */ + result = sarray_get_safe (receiver->class_pointer->dtable, + (sidx)op->sel_id); + if (result == 0) + { + /* If the method still just doesn't exist for the + class, attempt to forward the method. */ + result = __objc_get_forward_imp (op); + } } } return result; @@ -237,13 +282,16 @@ __objc_init_dispatch_tables () static void __objc_init_install_dtable (id receiver, SEL op __attribute__ ((__unused__))) { + objc_mutex_lock (__objc_runtime_mutex); + /* This may happen, if the programmer has taken the address of a method before the dtable was initialized... too bad for him! */ if (receiver->class_pointer->dtable != __objc_uninstalled_dtable) - return; - - objc_mutex_lock (__objc_runtime_mutex); - + { + objc_mutex_unlock (__objc_runtime_mutex); + return; + } + if (CLS_ISCLASS (receiver->class_pointer)) { /* receiver is an ordinary object */ @@ -417,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; @@ -659,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 () { diff --git a/thr-mach.c b/thr-mach.c index 2491cb7..76167b4 100644 --- a/thr-mach.c +++ b/thr-mach.c @@ -4,21 +4,21 @@ Modified for Mach threads by Bill Bumgarner Condition functions added by Mircea Oancea -This file is part of GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify it under the +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. -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY +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 GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +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 @@ -27,9 +27,9 @@ Boston, MA 02111-1307, USA. */ covered by the GNU General Public License. */ #include -#include -#include -#include "runtime.h" +#include +#include "objc/thr.h" +#include "objc/runtime.h" /* Obtain the maximum thread priority that can set for t. Under the diff --git a/thr-objc.c b/thr-objc.c index a859e1e..0289fd6 100644 --- a/thr-objc.c +++ b/thr-objc.c @@ -31,7 +31,7 @@ Boston, MA 02110-1301, USA. */ #include "config.h" #include "tconfig.h" #include "coretypes.h" -#include "tm.h" +//#include "tm.h" #include "defaults.h" #include "objc/thr.h" #include "objc/runtime.h" diff --git a/thr-posix.c b/thr-posix.c index 2ce34eb..5007d6e 100644 --- a/thr-posix.c +++ b/thr-posix.c @@ -4,21 +4,21 @@ Modified for Linux/Pthreads by Kai-Uwe Sattler (kus@iti.cs.uni-magdeburg.de) Modified for posix compliance by Chris Ball (cball@fmco.com) -This file is part of GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify it under the +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. -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY +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 GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +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 @@ -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 -#include "runtime.h" +#include "objc/thr.h" +#include "objc/runtime.h" #include #ifdef MISSING_SCHED_PARAM_STRUCT diff --git a/thr-win32.c b/thr-win32.c index d145c40..8de2e92 100644 --- a/thr-win32.c +++ b/thr-win32.c @@ -2,21 +2,21 @@ Copyright (C) 1996, 1997 Free Software Foundation, Inc. Contributed by Galen C. Hunt (gchunt@cs.rochester.edu) -This file is part of GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify it under the +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. -GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY +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 -GNU CC; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +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 @@ -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 -#include "runtime.h" +#include "objc/thr.h" +#include "objc/runtime.h" #ifndef __OBJC__ #define __OBJC__