Commit d632dee9 by Ziemowit Laski Committed by Ziemowit Laski

objc-act.c (get_super_receiver): If inside a class method of a category...

[gcc]
2002-08-26  Ziemowit Laski <zlaski@apple.com>

        * objc/objc-act.c (get_super_receiver): If inside a class method
        of a category, cast the receiver to 'id' before accessing the 'isa'
        field so that <objc/objc-class.h> is not needed.  For NeXT runtime.

[gcc/testsuite]
2002-08-26  Ziemowit Laski  <zlaski@apple.com>

        * objc.dg/super-class-2.m: New test.

From-SVN: r56587
parent c3cc6b78
2002-08-26 Ziemowit Laski <zlaski@apple.com>
* objc/objc-act.c (get_super_receiver): If inside a class method
of a category, cast the receiver to 'id' before accessing the 'isa'
field so that <objc/objc-class.h> is not needed. For NeXT runtime.
2002-08-26 Ulrich Weigand <uweigand@de.ibm.com> 2002-08-26 Ulrich Weigand <uweigand@de.ibm.com>
* config/s390/s390-protos.h (s390_function_prologue, * config/s390/s390-protos.h (s390_function_prologue,
......
...@@ -7042,8 +7042,12 @@ get_super_receiver () ...@@ -7042,8 +7042,12 @@ get_super_receiver ()
{ {
super_class = get_class_reference (super_name); super_class = get_class_reference (super_name);
if (TREE_CODE (objc_method_context) == CLASS_METHOD_DECL) if (TREE_CODE (objc_method_context) == CLASS_METHOD_DECL)
/* Cast the super class to 'id', since the user may not have
included <objc/objc-class.h>, leaving 'struct objc_class'
an incomplete type. */
super_class super_class
= build_component_ref (build_indirect_ref (super_class, "->"), = build_component_ref (build_indirect_ref
(build_c_cast (id_type, super_class), "->"),
get_identifier ("isa")); get_identifier ("isa"));
} }
else else
......
2002-08-26 Ziemowit Laski <zlaski@apple.com>
* objc.dg/super-class-2.m: New test.
2002-08-24 Matt Austern <austern@apple.com> 2002-08-24 Matt Austern <austern@apple.com>
* g++.dg/ext/lvaddr.C: New test. * g++.dg/ext/lvaddr.C: New test.
......
/* Test calling super from within a category class method. */
/* Author: Ziemowit Laski <zlaski@apple.com> */
/* { dg-do compile } */
/* { dg-options "-fnext-runtime" } */
typedef struct objc_object { struct objc_class *isa; } *id;
@interface NSObject
+ (int) test_func0;
@end
@interface NSMenuItem: NSObject
+ (int) test_func0;
@end
@implementation NSObject
+ (int) test_func0
{}
@end
@implementation NSMenuItem
+ (int) test_func0
{
return [super test_func0];
}
@end
@interface NSObject (Test)
+ (int) test_func;
@end
@implementation NSObject (Test)
+ (int) test_func
{}
@end
@interface NSMenuItem (Test)
+ (int) test_func;
@end
@implementation NSMenuItem (Test)
+ (int) test_func
{
return [super test_func]; /* { dg-bogus "dereferencing pointer to incomplete type" } */
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment