In gcc/objc/: 2010-11-29 Nicola Pero <nicola.pero@meta-innovation.com>

In gcc/objc/:
2010-11-29  Nicola Pero  <nicola.pero@meta-innovation.com>

	* objc-act.c (objc_maybe_build_component_ref): Removed TODO.

In gcc/testsuite/:
2010-11-29  Nicola Pero  <nicola.pero@meta-innovation.com>

	* objc.dg/property/dotsyntax-21.m
	* obj-c++.dg/property/dotsyntax-21.mm

From-SVN: r167269
This commit is contained in:
Nicola Pero 2010-11-29 20:43:35 +00:00 committed by Nicola Pero
parent 0e160b34c6
commit d402edc15d
5 changed files with 237 additions and 5 deletions

View file

@ -1,3 +1,7 @@
2010-11-29 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (objc_maybe_build_component_ref): Removed TODO.
2010-11-29 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (objc_eh_runtime_type): Avoid ICE if error_mark_node

View file

@ -1539,11 +1539,8 @@ objc_maybe_build_component_ref (tree object, tree property_ident)
|| TREE_CODE (t) == COMPONENT_REF)
t = TREE_OPERAND (t, 0);
if (t == UOBJC_SUPER_decl)
{
/* TODO: Check if this is correct also for 'super' in categories. */
interface_type = lookup_interface (CLASS_SUPER_NAME (implementation_template));
}
if (t == UOBJC_SUPER_decl)
interface_type = lookup_interface (CLASS_SUPER_NAME (implementation_template));
else if (t == self_decl)
interface_type = lookup_interface (CLASS_NAME (implementation_template));

View file

@ -1,3 +1,8 @@
2010-11-29 Nicola Pero <nicola.pero@meta-innovation.com>
* objc.dg/property/dotsyntax-21.m
* obj-c++.dg/property/dotsyntax-21.mm
2010-11-29 Alexandre Oliva <aoliva@redhat.com>
PR debug/46338

View file

@ -0,0 +1,113 @@
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */
/* { dg-do run } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
/* Test dot-syntax with super in a category. */
#include <stdlib.h>
#include <objc/objc.h>
#include <objc/runtime.h>
@interface MyRootClass
{
Class isa;
int a;
}
+ (id) initialize;
+ (id) alloc;
- (id) init;
- (int) count;
- (void) setCount: (int)count;
@end
@implementation MyRootClass
+ (id) initialize { return self; }
+ (id) alloc { return class_createInstance (self, 0); }
- (id) init { return self; }
- (int) count
{
return a;
}
- (void) setCount: (int)count
{
a = count;
}
@end
/* First, test 'super' in the main implementation of a subclass. */
@interface MySubClass : MyRootClass
- (int) superCount;
- (void) setSuperCount: (int)count;
@end
@implementation MySubClass
- (int) superCount
{
return super.count;
}
- (void) setSuperCount: (int)count
{
super.count = count;
}
@end
/* Now, test 'super' in a category of a subclass. */
@interface MySubClass (Category)
- (int) superCount2;
- (void) setSuperCount2: (int)count;
- (int) test: (int)x;
@end
@implementation MySubClass (Category)
- (int) superCount2
{
return super.count;
}
- (void) setSuperCount2: (int)count
{
super.count = count;
}
- (int) test: (int)x
{
/* For positive x, the following will leave super.count
unchanged. */
super.count++;
--super.count;
super.count = (x < 0 ? x : super.count);
if ((x = super.count))
super.count += 1;
if ((x = super.count))
super.count -= 1;
/* Finally, also put a bit of self.count in the mix. */
self.count++;
super.count--;
return super.count;
}
@end
int main (void)
{
MySubClass *object = [[MySubClass alloc] init];
object.count = 10;
if (object.count != 10)
abort ();
object.superCount = 11;
if (object.superCount != 11)
abort ();
object.superCount2 = 12;
if (object.superCount2 != 12)
abort ();
if ([object test: 45] != 12)
abort ();
return 0;
}

View file

@ -0,0 +1,113 @@
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */
/* { dg-do run } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
/* Test dot-syntax with super in a category. */
#include <stdlib.h>
#include <objc/objc.h>
#include <objc/runtime.h>
@interface MyRootClass
{
Class isa;
int a;
}
+ (id) initialize;
+ (id) alloc;
- (id) init;
- (int) count;
- (void) setCount: (int)count;
@end
@implementation MyRootClass
+ (id) initialize { return self; }
+ (id) alloc { return class_createInstance (self, 0); }
- (id) init { return self; }
- (int) count
{
return a;
}
- (void) setCount: (int)count
{
a = count;
}
@end
/* First, test 'super' in the main implementation of a subclass. */
@interface MySubClass : MyRootClass
- (int) superCount;
- (void) setSuperCount: (int)count;
@end
@implementation MySubClass
- (int) superCount
{
return super.count;
}
- (void) setSuperCount: (int)count
{
super.count = count;
}
@end
/* Now, test 'super' in a category of a subclass. */
@interface MySubClass (Category)
- (int) superCount2;
- (void) setSuperCount2: (int)count;
- (int) test: (int)x;
@end
@implementation MySubClass (Category)
- (int) superCount2
{
return super.count;
}
- (void) setSuperCount2: (int)count
{
super.count = count;
}
- (int) test: (int)x
{
/* For positive x, the following will leave super.count
unchanged. */
super.count++;
--super.count;
super.count = (x < 0 ? x : super.count);
if ((x = super.count))
super.count += 1;
if ((x = super.count))
super.count -= 1;
/* Finally, also put a bit of self.count in the mix. */
self.count++;
super.count--;
return super.count;
}
@end
int main (void)
{
MySubClass *object = [[MySubClass alloc] init];
object.count = 10;
if (object.count != 10)
abort ();
object.superCount = 11;
if (object.superCount != 11)
abort ();
object.superCount2 = 12;
if (object.superCount2 != 12)
abort ();
if ([object test: 45] != 12)
abort ();
return 0;
}