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 (start_class): When a class is reimplemented, generate an error and avoid adding the class to the list of implemented classes again, but do not return error_mark_node. In gcc/testsuite/: 2010-11-29 Nicola Pero <nicola.pero@meta-innovation.com> * objc.dg/duplicate-class-1.m: New. * obj-c++.dg/duplicate-class-1.mm: New. From-SVN: r167270
This commit is contained in:
parent
d402edc15d
commit
98cf223ca9
|
@ -1,3 +1,9 @@
|
||||||
|
2010-11-29 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||||
|
|
||||||
|
* objc-act.c (start_class): When a class is reimplemented,
|
||||||
|
generate an error and avoid adding the class to the list of
|
||||||
|
implemented classes again, but do not return error_mark_node.
|
||||||
|
|
||||||
2010-11-29 Nicola Pero <nicola.pero@meta-innovation.com>
|
2010-11-29 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||||
|
|
||||||
* objc-act.c (objc_maybe_build_component_ref): Removed TODO.
|
* objc-act.c (objc_maybe_build_component_ref): Removed TODO.
|
||||||
|
|
|
@ -9537,8 +9537,11 @@ start_class (enum tree_code code, tree class_name, tree super_name,
|
||||||
{
|
{
|
||||||
error ("reimplementation of class %qE",
|
error ("reimplementation of class %qE",
|
||||||
class_name);
|
class_name);
|
||||||
return error_mark_node;
|
/* TODO: error message saying where it was previously
|
||||||
|
implemented. */
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
if (chain == NULL_TREE)
|
||||||
implemented_classes = tree_cons (NULL_TREE, class_name,
|
implemented_classes = tree_cons (NULL_TREE, class_name,
|
||||||
implemented_classes);
|
implemented_classes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2010-11-29 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||||
|
|
||||||
|
* objc.dg/duplicate-class-1.m: New.
|
||||||
|
* obj-c++.dg/duplicate-class-1.mm: New.
|
||||||
|
|
||||||
2010-11-29 Nicola Pero <nicola.pero@meta-innovation.com>
|
2010-11-29 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||||
|
|
||||||
* objc.dg/property/dotsyntax-21.m
|
* objc.dg/property/dotsyntax-21.m
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */
|
||||||
|
/* { dg-do compile } */
|
||||||
|
|
||||||
|
/* Test that a duplicated @implementation for the same class does not
|
||||||
|
crash the compiler. */
|
||||||
|
|
||||||
|
@interface Test
|
||||||
|
{
|
||||||
|
Class isa;
|
||||||
|
}
|
||||||
|
- (int) test;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation Test
|
||||||
|
- (int) test
|
||||||
|
{
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
/* The most likely cause is that the programmer meant this to be a
|
||||||
|
category, so check what happens if we have some different methods
|
||||||
|
in there. */
|
||||||
|
@implementation Test /* { dg-error "reimplementation of class .Test." } */
|
||||||
|
- (int) test2
|
||||||
|
{
|
||||||
|
return [self test];
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
/* { dg-warning "incomplete implementation" "" { target *-*-* } 29 } */
|
||||||
|
/* { dg-warning "not found" "" { target *-*-* } 29 } */
|
|
@ -0,0 +1,31 @@
|
||||||
|
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */
|
||||||
|
/* { dg-do compile } */
|
||||||
|
|
||||||
|
/* Test that a duplicated @implementation for the same class does not
|
||||||
|
crash the compiler. */
|
||||||
|
|
||||||
|
@interface Test
|
||||||
|
{
|
||||||
|
Class isa;
|
||||||
|
}
|
||||||
|
- (int) test;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation Test
|
||||||
|
- (int) test
|
||||||
|
{
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
/* The most likely cause is that the programmer meant this to be a
|
||||||
|
category, so check what happens if we have some different methods
|
||||||
|
in there. */
|
||||||
|
@implementation Test
|
||||||
|
- (int) test2 /* { dg-error "reimplementation of class .Test." } */
|
||||||
|
{
|
||||||
|
return [self test];
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
/* { dg-warning "incomplete implementation" "" { target *-*-* } 29 } */
|
||||||
|
/* { dg-warning "not found" "" { target *-*-* } 29 } */
|
Loading…
Reference in New Issue