On 2 Jun 2017, at 04:20, Stefan Bidigaray <stefanb...@gmail.com> wrote: > > CoreBase officially supports both GNUstep and GNU runtimes, so it is > important that we do not break that. Additionally, clang/llvm and GCC are > supported. A configure test will be required for > objc_release/_retain/_autoreleaseReturnValue, and we need to make sure GCC > and the GNU runtime are still working. Ideally, we also need tests added to > the test suite.
The correct solution here would probably be to implement the ARC functions in ObjectiveC2.framework, which provides compat for the GCC runtime. A working implementation would simply call the relevant -retain, -release, and -autorelease methods (similarly, the push and pop autorelease pool functions should create an autorelease pool and drain the top autorelease pool. The weak ones are a bit harder to implement, and are probably not worth the bother. > Are these two functions only supposed to work when ARC is available? Or can > they be used with GCC/GNU-runtime and manual ref. counting? If they have to > work with GCC and manual ref. count, I assume CFBridgingRelease would be a > no-op when the object is a CF-type and a ref. decrement when it is a objc > object. Does that sound about right? Yes, they’re just functions. You can use them in Objective-C++ with a pre-ARC compiler to implement ARC via some templates, for example. There’s a pretty noticeable code-size win from calling objc_retain / objc_release rather than -retain / -release too (as well as a performance win if you’re using the GNUstep runtime). I vaguely remember changing the GNUstep RETAIN and RELEASE macros to use these calls if they’re available, but I don’t remember if I committed it. David _______________________________________________ Gnustep-dev mailing list Gnustep-dev@gnu.org https://lists.gnu.org/mailman/listinfo/gnustep-dev