2 * Contributed by Nicola Pero <nicola@brainstorm.co.uk>
3 * Wed Feb 28 12:27:03 CET 2001
7 * This test contains some no-op code which is needed to keep it
8 * compile on broken gcc 3.x. Anyway, the no-op code does not
9 * interfere with what we are testing, which is that the `bycopy'
10 * keyword generates the _F_BYCOPY qualifier for the return type. */
12 #include "../../objc-obj-c++-shared/next-mapping.h"
13 #include "../../objc-obj-c++-shared/Protocol1.h"
15 #ifndef __NEXT_RUNTIME__
16 #include <objc/encoding.h>
20 + (bycopy id<MyProtocol>) bycopyMethod;
23 /* This no-op class to keep it compile under broken gcc 3.x */
24 @interface MyObject : Object <MyProtocol>
27 @implementation MyObject
28 + (bycopy id<MyProtocol>) bycopyMethod
30 return [MyObject alloc];
36 struct objc_method_description *method;
37 const char *method_types;
40 /* This no-op command is needed to keep the test compile on broken
42 MyObject *object = [MyObject bycopyMethod];
44 /* Get the protocol object */
45 protocol = @protocol (MyProtocol);
47 /* Ask to the protocol for the description of the method bycopyMethod */
48 method = [protocol descriptionForClassMethod: @selector (bycopyMethod)];
51 printf ("Could not find method bycopyMethod in protocol!\n");
55 /* Get the method types for the method - which encode return type,
57 method_types = method->types;
59 /* Get the qualifiers for the return type */
60 qualifiers = objc_get_type_qualifiers (method_types);
62 /* If _F_BYCOPY is not there, the compiler is broken */
63 if (! (qualifiers & _F_BYCOPY))
65 printf ("Failed - selector does not contain _F_BYCOPY qualifier!\n");