mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-25 22:01:33 +00:00
bdd3870d2f
I have gotten tired of chasing memory leaks caused by me forgetting to add [super dealloc] to my dealloc methods, so getting qfcc to chew me out when I do seems to be a good idea (having such a warning would have saved me many hours, just as missing return warnings have).
36 lines
716 B
R
36 lines
716 B
R
@interface Object
|
|
{
|
|
Class isa;
|
|
}
|
|
-(void)dealloc;
|
|
@end
|
|
|
|
@interface derived : Object
|
|
@end
|
|
|
|
@implementation Object
|
|
-(void) dealloc
|
|
{
|
|
// this is the root of the hierarchy, so no super to call, thus
|
|
// must not check for [super dealloc]
|
|
}
|
|
@end
|
|
|
|
void __obj_exec_class (struct obj_module *msg) = #0;
|
|
id obj_msgSend_super (Super *class, SEL op, ...) = #0;
|
|
|
|
@implementation derived
|
|
-(void) dealloc
|
|
{
|
|
// as this is a derived class, failure to call [super dealloc] will
|
|
// result in a memory leak (yes, there could be special allocators
|
|
// involved, in which case something will be needed to inform the
|
|
// compiler)
|
|
[super dealloc];
|
|
}
|
|
@end
|
|
|
|
int main ()
|
|
{
|
|
return 0; // test passes if compile succeeds (with -Werror)
|
|
}
|