Commit graph

298 commits

Author SHA1 Message Date
Richard Frith-MacDonald
594a654252 NSZombie fixups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32051 72102866-910b-0410-8b05-ffd578937521
2011-02-11 10:00:00 +00:00
David Chisnall
0239c9b9a5 Use NSClassFromString() to look up NSZombie class. This has two advantages:
1) Doesn't rely on Apple-incompatible behaviour in the GCC runtime that introduces fun heisenbugs.
2) Doesn't require constructing the dtable for NSZombie if we're not actually using it.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32039 72102866-910b-0410-8b05-ffd578937521
2011-02-10 18:53:48 +00:00
David Chisnall
0d28d838fd Revert last commit. The actual Apple behaviour is what libobjc2 used to do, not what it does now. It's incredibly ugly, and should not have been allowed: It makes NSObject the superclass of NSObject's metaclass, but does NOT do the same transform for any other classes.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32038 72102866-910b-0410-8b05-ffd578937521
2011-02-10 18:40:18 +00:00
David Chisnall
a8cd2e588c Make [NSObject -class] return self if self is a class. This is needed for a weird bit of the ObjC spec relating to metaclasses of root classes. The GNUstep runtime behaviour mimics the Apple behaviour, while the GCC runtime mimics the StepStone behaviour, so we get some somewhat irritating differences.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32037 72102866-910b-0410-8b05-ffd578937521
2011-02-10 18:33:26 +00:00
Richard Frith-MacDonald
bc34d0505f Minor cleanups.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32031 72102866-910b-0410-8b05-ffd578937521
2011-02-10 10:52:54 +00:00
Richard Frith-MacDonald
e1dbeb420e minor OSX compatibility tweak
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31847 72102866-910b-0410-8b05-ffd578937521
2011-01-07 09:52:20 +00:00
Fred Kiefer
a4a57e144f * Source/NSObject.m (GSAtomicIncrement, GSAtomicDecrement):
MIPS64 specific adjustment of atomic functions for mips.
Patch by Sebastian Reitenbach <sebastia@l00-bugdead-prods.de>.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31841 72102866-910b-0410-8b05-ffd578937521
2011-01-06 12:48:29 +00:00
Nicola Pero
0a0a147ae9 Updated for GCC 4.6
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31771 72102866-910b-0410-8b05-ffd578937521
2010-12-24 17:19:40 +00:00
Nicola Pero
ba3fac5d5b Fixed [NSObject +conformsToProtocol:] and [NSObject -conformsToProtocol:]
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31769 72102866-910b-0410-8b05-ffd578937521
2010-12-24 15:37:06 +00:00
Nicola Pero
30f098f9f8 Updated code to compile with GCC 4.6 and the new GNU Objective-C runtime
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31765 72102866-910b-0410-8b05-ffd578937521
2010-12-23 02:23:05 +00:00
David Chisnall
e9b0540890 Fix -methodSignatureForSelector: fast path with libobjc2.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31371 72102866-910b-0410-8b05-ffd578937521
2010-09-18 15:09:58 +00:00
Wolfgang Lux
fb76b96247 Fix bug were NSObject -methodSignatureForSelector: would return an
incorrect result or even crash when asking a class object for the
signature of one of its class methods.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31365 72102866-910b-0410-8b05-ffd578937521
2010-09-17 20:07:50 +00:00
Eric Wasylishen
d7a7393a0b Minor build fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31271 72102866-910b-0410-8b05-ffd578937521
2010-09-09 17:02:19 +00:00
David Chisnall
4488708e84 Fix a load of warnings from implicit function declarations. A lot were caused by ctype.h and string.h stuff being used everywhere in GNUstep but not included anywhere - they're now included in common.h (at least string.h should also be in Foundation.h - on OS X it is implicitly included via some chain of things from Foundation.h).
All of the sel_* stuff is now replaced with the newer APIs.  As a side-effect, a blob of code that was copied-and-pasted all over GNUstep has now been moved into ObjectiveC2 and just called.

Class posing with libobjc2 will now throw an exception, rather than just aborting.  



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31268 72102866-910b-0410-8b05-ffd578937521
2010-09-09 16:30:10 +00:00
David Chisnall
7a80adeb9b A huge blob of changes to make -base build with libobjc2, without using the old libobjc2 headers.
Most of these changes involve simply removing direct manipulation of any runtime structures and replacing them with runtime function calls.  For example class->name becomes class_getName(class) and so on.

libobjc2, like the Apple runtime, the NeXT runtime, and every version of the Objective-C spec, calls the class pointer in id isa.  A few files now have #define class_pointer isa at the top.  This line replaces class_pointer in the old GNU libobjc headers with isa so either class_pointer or isa can be used for accessing the class of an object.  Note: object_getClass() should be used in most cases because, in some future version of the runtime, this will skip things like lock classes and other hidden classes (e.g. KVO classes).

All of the old forwarding stuff has been removed.  Most of this stuff followed convoluted code paths that ended with an exception.  A few simply broke in exciting ways.  Hopefully no one has used them for the last ten years or so, but we can bring them back with some #ifndef stuff if they're really needed by anyone.

There is currently a bug in configure, which prevents dladdr() from being detected, so you need to manually tweak config.h to build - I have not fixed the fall-back code in objc-load.m to work with libobjc2, I just added a new version that uses the loader's functionality directly.  

Although -base now builds, it builds with a lot of warnings.  <string.h> is missing from a lot of files, so memcpy() and strlen() generate implicit function declaration warnings.  

Additionally, libobjc2 does still provide the sel_{get,register}_*() functions, but they're wrappers around the newer API ones.  These are deprecated and are not exposed in the headers.  Although they work, we should be replacing them with the libobjc2 versions as soon as possible.

This incorporates a patch by Eric.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31265 72102866-910b-0410-8b05-ffd578937521
2010-09-09 15:06:09 +00:00
Richard Frith-MacDonald
3564932935 remove obsolete typed stream inclusion
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31248 72102866-910b-0410-8b05-ffd578937521
2010-09-08 09:00:15 +00:00
David Chisnall
e58ea125de Improve the efficiency of NSObject's methodSignatureForSelector by:
- Moving the linear search over all of the method lists in the class hierarchy to the end.  If we found the type info in the protocol list, we were throwing this info away.  Doing something expensive and then discarding the result is generally not a good idea.

- Replacing the linear search of the method lists with a dtable lookup on libobjc2.  The type info for methods is part of the slot, so we only need to do the expensive search at all on the old runtime.  With libobjc2, type info lookup costs as little as IMP lookup, so doing things the slow way is not required.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31231 72102866-910b-0410-8b05-ffd578937521
2010-09-02 15:17:46 +00:00
Richard Frith-MacDonald
821a21b54d better cope with null selectors.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31178 72102866-910b-0410-8b05-ffd578937521
2010-08-17 18:36:46 +00:00
Richard Frith-MacDonald
3a856711c1 Remove backward compatibility code
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30866 72102866-910b-0410-8b05-ffd578937521
2010-06-26 14:23:07 +00:00
Richard Frith-MacDonald
b417e6bf8c Workaround for runitme bug.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30864 72102866-910b-0410-8b05-ffd578937521
2010-06-26 14:04:09 +00:00
David Chisnall
0409dd3080 Some cleanup of NSObject. Call runtime functions, rather than duplicate their implementation, and only conditionally call some non-portable functions.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30597 72102866-910b-0410-8b05-ffd578937521
2010-06-07 02:50:40 +00:00
Richard Frith-MacDonald
2edc03af19 OpenBSD fix
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30489 72102866-910b-0410-8b05-ffd578937521
2010-05-30 16:06:04 +00:00
Wolfgang Lux
2057a4b58f Use local labels in PowerPC assembler code of GSAtomic{In,De}crement
to avoid a compile error when this code is inlined more than once. In
addition, use the optimized assembler definitions also on PowerPC
machines running Darwin/Mac OS X.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30239 72102866-910b-0410-8b05-ffd578937521
2010-04-26 21:32:22 +00:00
Richard Frith-MacDonald
d365d287cf improve documentation ... really runtime features but we don't have dos for that
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30125 72102866-910b-0410-8b05-ffd578937521
2010-04-12 11:19:08 +00:00
Riccardo Mottola
cb4c554422 Atomic increment and decrement functions for mips
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30020 72102866-910b-0410-8b05-ffd578937521
2010-03-23 00:03:21 +00:00
Richard Frith-MacDonald
f784646663 generalize define from __MINGW32__ to __MINGW__
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30001 72102866-910b-0410-8b05-ffd578937521
2010-03-19 12:10:11 +00:00
Richard Frith-MacDonald
42db2fdf50 Improve debug
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29874 72102866-910b-0410-8b05-ffd578937521
2010-03-08 09:27:48 +00:00
Richard Frith-MacDonald
39fc4419b0 further cleanup ... always use -zone method to get an object's zone ...
so people can safely write subclasses using different allocation schemes.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29847 72102866-910b-0410-8b05-ffd578937521
2010-03-05 09:30:18 +00:00
Richard Frith-MacDonald
a0a018b4c5 remove bogus consistency check
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29784 72102866-910b-0410-8b05-ffd578937521
2010-02-27 06:33:39 +00:00
Richard Frith-MacDonald
14b91c9052 fixups for libobjc2
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29753 72102866-910b-0410-8b05-ffd578937521
2010-02-25 18:49:31 +00:00
Richard Frith-MacDonald
c07dc48eb3 more header reorganisation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29731 72102866-910b-0410-8b05-ffd578937521
2010-02-25 08:36:34 +00:00
Richard Frith-MacDonald
3968c44cec Cleanup some deprecated code
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29730 72102866-910b-0410-8b05-ffd578937521
2010-02-25 08:19:52 +00:00
Richard Frith-MacDonald
b1e904b3ae move GNUstep.h into common.h
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29727 72102866-910b-0410-8b05-ffd578937521
2010-02-25 05:26:57 +00:00
Richard Frith-MacDonald
4497ba7bdd Build with non-fragile ivars.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29715 72102866-910b-0410-8b05-ffd578937521
2010-02-24 10:23:47 +00:00
Richard Frith-MacDonald
8769dd8b6f deprecates some gnustep runtime wrappers
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29697 72102866-910b-0410-8b05-ffd578937521
2010-02-22 10:13:20 +00:00
Richard Frith-MacDonald
dd42cc24ba Move includes to NSObjCRuntime.h to match OSX
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29692 72102866-910b-0410-8b05-ffd578937521
2010-02-20 18:32:07 +00:00
Richard Frith-MacDonald
7cc69dfaae Simplify header inclusion
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29669 72102866-910b-0410-8b05-ffd578937521
2010-02-19 08:12:46 +00:00
Richard Frith-MacDonald
c8a6832349 cosmetic tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29657 72102866-910b-0410-8b05-ffd578937521
2010-02-17 11:47:06 +00:00
Richard Frith-MacDonald
21d597e740 merge back reorganisation branch
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29615 72102866-910b-0410-8b05-ffd578937521
2010-02-14 10:48:10 +00:00
David Chisnall
6bf6ec959b Made NSAllocateObject() and NSDeallocateObject() use / take id instead of NSObject*. This matches Apple's definition and gets rid of 'assignment / initialization from distinct Objective-C type' warnings when you use NSAllocateObject() to create an instance without an explicit cast.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29611 72102866-910b-0410-8b05-ffd578937521
2010-02-13 17:33:23 +00:00
Richard Frith-MacDonald
6c84f23ae1 Coimplete operation queue implementation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29508 72102866-910b-0410-8b05-ffd578937521
2010-02-08 10:34:27 +00:00
Richard Frith-MacDonald
93b94d87b2 Fix error in class for zombie
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29259 72102866-910b-0410-8b05-ffd578937521
2010-01-11 11:29:44 +00:00
Richard Frith-MacDonald
b1976d23bb avoid compiler warnings
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29258 72102866-910b-0410-8b05-ffd578937521
2010-01-11 11:23:03 +00:00
Gregory John Casamento
6797a06652 Conditionally compile weak attribute.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29159 72102866-910b-0410-8b05-ffd578937521
2009-12-22 22:12:56 +00:00
David Chisnall
c19a717b67 Added call to objc_create_block_classes_as_subclasses_of() in NSObject's +load method. This is called as soon as NSObject is loaded and creates the _NSBlock family of classes, which are statically allocated in the runtime but not statically initialised. If you create blocks without linking GNUstep-base, the isa pointer in the block will point to a class that has all of its fields set to 0.
Any blocks will have their isa pointer set to the two classes statically allocated in libobjc, but these classes can't be used for message lookup (or introspection) until after the call.  This means that you can't send messages to blocks until after NSObject's +load method has been called.  This shouldn't be a problem in most code, but if you use __attribute__((constructor)) instead of a +load method then be careful about sending messages to blocks (you can still call them as normal). 



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29144 72102866-910b-0410-8b05-ffd578937521
2009-12-20 16:59:41 +00:00
Richard Frith-MacDonald
5a6ce46276 tidy
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29049 72102866-910b-0410-8b05-ffd578937521
2009-11-23 18:07:25 +00:00
David Chisnall
9eb8d1d49b Added fall-back line for forwarding. Now -forwardingProxyForSelector: should work on all runtimes, with all ABIs, it will just be painfully slow on the GCC runtime and the legacy ABI.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29048 72102866-910b-0410-8b05-ffd578937521
2009-11-23 16:43:08 +00:00
Richard Frith-MacDonald
19796a1465 Documentation generation improvments
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29047 72102866-910b-0410-8b05-ffd578937521
2009-11-23 09:42:18 +00:00
Wolfgang Lux
acb28bb1c2 Prevent potential deadlock in multithreaded programs due to an
allocation lock that was never unlocked.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28859 72102866-910b-0410-8b05-ffd578937521
2009-10-20 05:25:04 +00:00
Richard Frith-MacDonald
640ae938c6 Cleanups and minor bugfixes for new code.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28665 72102866-910b-0410-8b05-ffd578937521
2009-09-12 07:37:00 +00:00