Author: rfm
Date: Sat Mar 26 06:10:00 2016
New Revision: 39611
URL: http://svn.gna.org/viewcvs/gnustep?rev=39611&view=rev
Log:
More GC removal updates
Modified:
libs/base/trunk/Documentation/coding-standards.texi
libs/base/trunk/Headers/GNUstepBase/GNUstep.h
libs/base/trunk/Source/NSSocketPort.m
libs/base/trunk/Tools/AGSHtml.m
libs/base/trunk/Tools/GNUmakefile
Modified: libs/base/trunk/Documentation/coding-standards.texi
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Documentation/coding-standards.texi?rev=39611&r1=39610&r2=39611&view=diff
==============================================================================
--- libs/base/trunk/Documentation/coding-standards.texi (original)
+++ libs/base/trunk/Documentation/coding-standards.texi Sat Mar 26 06:10:00 2016
@@ -317,7 +317,8 @@
We encourage the use of the following macros to ease retain and release
and as a convenience for managing code which should work in both a
-garbage collecting and a retain counting environment.
+conventional retain counting environment and one with automatic reference
+counting (ARC)
@itemize @bullet
@item
ASSIGN(object,value) to assign an object variable, performing the appropriate
retain/release as necessary.
@@ -326,10 +327,8 @@
@item
DESTROY(object) to release an object variable and set it to nil.
@item
-CREATE_AUTORELEASE_POOL(name) to create an autorelease pool with the
-specified name.
-@item IF_NO_GC(X) compile the code 'X' only if GarbageCollection is not
-in use.
+ENTER_POOL and LEAVE_POOL to bracket statements which should be performed
+inside their own auutorlease context.
@end itemize
@c ******************************************************************
Modified: libs/base/trunk/Headers/GNUstepBase/GNUstep.h
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Headers/GNUstepBase/GNUstep.h?rev=39611&r1=39610&r2=39611&view=diff
==============================================================================
--- libs/base/trunk/Headers/GNUstepBase/GNUstep.h (original)
+++ libs/base/trunk/Headers/GNUstepBase/GNUstep.h Sat Mar 26 06:10:00 2016
@@ -47,17 +47,17 @@
#if __has_feature(objc_arc)
#ifndef RETAIN
-#define RETAIN(object) (object)
+#define RETAIN(object) (object)
#endif
#ifndef RELEASE
#define RELEASE(object)
#endif
#ifndef AUTORELEASE
-#define AUTORELEASE(object) (object)
+#define AUTORELEASE(object) (object)
#endif
#ifndef TEST_RETAIN
-#define TEST_RETAIN(object) (object)
+#define TEST_RETAIN(object) (object)
#endif
#ifndef TEST_RELEASE
#define TEST_RELEASE(object)
@@ -67,16 +67,28 @@
#endif
#ifndef ASSIGN
-#define ASSIGN(object,value) object = (value)
+#define ASSIGN(object,value) object = (value)
#endif
#ifndef ASSIGNCOPY
#define ASSIGNCOPY(object,value) object = [(value) copy]
#endif
#ifndef DESTROY
-#define DESTROY(object) object = nil
+#define DESTROY(object) object = nil
#endif
#define IF_NO_GC(X)
+
+#ifndef ENTER_POOL
+#define ENTER_POOL @autoreleasepool{do{
+#endif
+
+#ifndef LEAVE_POOL
+#define LEAVE_POOL }while(0);}
+#endif
+
+#ifndef DEALLOC
+#define DEALLOC
+#endif
#else
@@ -183,17 +195,45 @@
#define IF_NO_GC(X) X
+#ifndef ENTER_POOL
+/**
+ * ENTER_POOL creates an autorelease pool and places subsequent code
+ * in a do/while loop (executed only once) which can be broken out of
+ * to reach the point when the pool is drained.<br />
+ * The block must be terminated with a corresponding LEAVE_POOL.<br />
+ * You should not return from such a block of code (to do so could
+ * leak an autorelease pool and give objects a longer lifetime than
+ * they ought to have. If you wish to leave the block of code early,
+ * you may do so using a 'break' statement.
+ */
+#define ENTER_POOL {NSAutoreleasePool *_lARP=[NSAutoreleasePool new];do{
+#endif
+
+#ifndef LEAVE_POOL
+/**
+ * LEAVE_POOL terminates a block of code started with ENTER_POOL.
+ */
+#define LEAVE_POOL }while(0);[_lARP drain];}
+#endif
+
+#ifndef DEALLOC
+/**
+ * DEALLOC calls the superclass implementation of dealloc, unless
+ * ARC is in use (in which case it does nothing).
+ */
+#define DEALLOC [super dealloc];
+#endif
#endif
#ifndef CREATE_AUTORELEASE_POOL
-/** DEPRECATED ... use NSAutoreleasePool *X = [NSAutoreleasePool new]
+/** DEPRECATED ... use ENTER_POOL and LEAVE_POOL
*/
#define CREATE_AUTORELEASE_POOL(X) \
NSAutoreleasePool *X = [NSAutoreleasePool new]
#endif
#ifndef RECREATE_AUTORELEASE_POOL
-/** DEPRECATED ... use [X release]; X = [NSAutoreleasePool new]
+/** DEPRECATED ... use ENTER_POOL and LEAVE_POOL
*/
#define RECREATE_AUTORELEASE_POOL(X) \
DESTROY(X);\
Modified: libs/base/trunk/Source/NSSocketPort.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSSocketPort.m?rev=39611&r1=39610&r2=39611&view=diff
==============================================================================
--- libs/base/trunk/Source/NSSocketPort.m (original)
+++ libs/base/trunk/Source/NSSocketPort.m Sat Mar 26 06:10:00 2016
@@ -1766,7 +1766,7 @@
}
else
{
- handle->recvPort = GS_GC_HIDE(self);
+ handle->recvPort = self;
}
NSMapInsert(handles, (void*)(uintptr_t)[handle descriptor], (void*)handle);
#if defined(_WIN32)
Modified: libs/base/trunk/Tools/AGSHtml.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Tools/AGSHtml.m?rev=39611&r1=39610&r2=39611&view=diff
==============================================================================
--- libs/base/trunk/Tools/AGSHtml.m (original)
+++ libs/base/trunk/Tools/AGSHtml.m Sat Mar 26 06:10:00 2016
@@ -108,7 +108,7 @@
RELEASE(localRefs);
RELEASE(projectRefs);
RELEASE(indent);
- [super dealloc];
+ DEALLOC
}
- (void) decIndent
@@ -593,7 +593,7 @@
- (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
{
- CREATE_AUTORELEASE_POOL(arp);
+ ENTER_POOL
GSXMLNode *children = [node firstChild];
if ([node type] == XML_ELEMENT_NODE)
@@ -1091,7 +1091,7 @@
if (base == nil)
{
NSLog(@"No 'base' document name supplied in gsdoc element");
- return;
+ break;
}
nextFile = [prop objectForKey: @"next"];
nextFile = [nextFile stringByAppendingPathExtension: @"html"];
@@ -1961,7 +1961,7 @@
}
}
}
- [arp drain];
+ LEAVE_POOL
}
/**
Modified: libs/base/trunk/Tools/GNUmakefile
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Tools/GNUmakefile?rev=39611&r1=39610&r2=39611&view=diff
==============================================================================
--- libs/base/trunk/Tools/GNUmakefile (original)
+++ libs/base/trunk/Tools/GNUmakefile Sat Mar 26 06:10:00 2016
@@ -103,6 +103,10 @@
xmlparse_OBJC_FILES = xmlparse.m
HTMLLinker_OBJC_FILES = HTMLLinker.m
+ifeq ($(OBJC_RUNTIME_LIB), ng)
+AGSHtml.m_FILE_FLAGS+= -fobjc-arc
+endif
+
# Reset this variable (defined in config.mak) to avoid useless linkage
# against the libraries gnustep-base uses.
CONFIG_SYSTEM_LIBS :=
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs