From 98cf223ca9c9d0536d56aa16c198b3ecb3951509 Mon Sep 17 00:00:00 2001 From: Nicola Pero Date: Mon, 29 Nov 2010 20:45:49 +0000 Subject: In gcc/objc/: 2010-11-29 Nicola Pero In gcc/objc/: 2010-11-29 Nicola Pero * 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 * objc.dg/duplicate-class-1.m: New. * obj-c++.dg/duplicate-class-1.mm: New. From-SVN: r167270 --- gcc/objc/ChangeLog | 6 ++++++ gcc/objc/objc-act.c | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'gcc/objc') diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 636bf85de1b..47c896a7073 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,9 @@ +2010-11-29 Nicola Pero + + * 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 * objc-act.c (objc_maybe_build_component_ref): Removed TODO. diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 2382da4fd4d..8de8e255e24 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -9537,10 +9537,13 @@ start_class (enum tree_code code, tree class_name, tree super_name, { error ("reimplementation of class %qE", class_name); - return error_mark_node; + /* TODO: error message saying where it was previously + implemented. */ + break; } - implemented_classes = tree_cons (NULL_TREE, class_name, - implemented_classes); + if (chain == NULL_TREE) + implemented_classes = tree_cons (NULL_TREE, class_name, + implemented_classes); } /* Reset for multiple classes per file. */ -- cgit v1.2.1