mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-05 14:11:00 +00:00
* Source/NSXMLDTD.m: * Source/NSXMLNode.m: * Source/NSXMLDTDNode.m: * Source/NSXMLElement.m: Remove compiler warnings for clang reported by David Chisnall. * Tests/base/NSAutoreleasePool/basic.m: Get to compile again without -C99. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35043 72102866-910b-0410-8b05-ffd578937521
36 lines
842 B
Objective-C
36 lines
842 B
Objective-C
#import "ObjectTesting.h"
|
|
#import <Foundation/NSAutoreleasePool.h>
|
|
#import <Foundation/NSObject.h>
|
|
|
|
static BOOL freed;
|
|
@interface Test : NSObject @end
|
|
@implementation Test
|
|
- (void)dealloc
|
|
{
|
|
freed = YES;
|
|
[super dealloc];
|
|
}
|
|
@end
|
|
|
|
int main()
|
|
{
|
|
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
|
NSObject *o = [NSObject new];
|
|
unsigned i;
|
|
|
|
for (i = 0; i < 1000; i++)
|
|
{
|
|
[[o retain] autorelease];
|
|
}
|
|
NSUInteger totalCount = [arp autoreleaseCount];
|
|
PASS(totalCount == 1000, "Autorelease count is correct");
|
|
PASS([NSAutoreleasePool autoreleaseCountForObject: o] == 1000,
|
|
"Autorelease count for object is correct");
|
|
PASS(freed == NO, "Object not prematurely freed");
|
|
[arp release];
|
|
arp = [NSAutoreleasePool new];
|
|
[o release];
|
|
PASS(freed == NO, "Object freed by autoreleasing");
|
|
[arp release];
|
|
return 0;
|
|
}
|