mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-26 02:33:31 +08:00
b3b965fb91
When running gdb.objc/objcdecode.exp we get: ... objcdecode.m: In function '-[Decode multipleDef]': objcdecode.m:14:3: warning: incompatible implicit declaration of built-in \ function 'printf' printf("method multipleDef\n"); ^~~~~~ objcdecode.m:14:3: note: include '<stdio.h>' or provide a declaration of \ 'printf' ... Fix this in the three gdb.objc/*.m test-cases by including stdio.h. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-07-24 Tom de Vries <tdevries@suse.de> PR testsuite/24807 * gdb.objc/basicclass.m: Include stdio.h. * gdb.objc/nondebug.m: Same. * gdb.objc/objcdecode.m: Same.
83 lines
1.1 KiB
Objective-C
83 lines
1.1 KiB
Objective-C
#include <stdio.h>
|
|
#include <objc/Object.h>
|
|
|
|
@interface BasicClass: Object
|
|
{
|
|
id object;
|
|
}
|
|
+ newWithArg: arg;
|
|
- doIt;
|
|
- takeArg: arg;
|
|
- printHi;
|
|
- (int) printNumber: (int)number;
|
|
- (const char *) myDescription;
|
|
@end
|
|
|
|
@interface BasicClass (Private)
|
|
- hiddenMethod;
|
|
@end
|
|
|
|
@implementation BasicClass
|
|
+ newWithArg: arg
|
|
{
|
|
id obj = [self new];
|
|
[obj takeArg: arg];
|
|
return obj;
|
|
}
|
|
|
|
- doIt
|
|
{
|
|
return self;
|
|
}
|
|
|
|
- takeArg: arg
|
|
{
|
|
object = arg;
|
|
[self hiddenMethod];
|
|
return self;
|
|
}
|
|
|
|
- printHi
|
|
{
|
|
printf("Hi\n");
|
|
return self;
|
|
}
|
|
|
|
- (int) printNumber: (int)number
|
|
{
|
|
printf("%d\n", number);
|
|
return number+1;
|
|
}
|
|
|
|
- (const char *) myDescription
|
|
{
|
|
return "BasicClass gdb test object";
|
|
}
|
|
|
|
@end
|
|
|
|
@implementation BasicClass (Private)
|
|
- hiddenMethod
|
|
{
|
|
return self;
|
|
}
|
|
@end
|
|
|
|
int main (int argc, const char *argv[])
|
|
{
|
|
id obj;
|
|
obj = [BasicClass new];
|
|
[obj takeArg: obj];
|
|
return 0;
|
|
}
|
|
|
|
const char *_NSPrintForDebugger(id object)
|
|
{
|
|
/* This is not really what _NSPrintForDebugger should do, but it
|
|
is a simple test if gdb can call this function */
|
|
if (object && [object respondsTo: @selector(myDescription)])
|
|
return [object myDescription];
|
|
|
|
return NULL;
|
|
}
|