From 0dc33c3c14650fa55f60b08fdfe4aaeba5c0c9bc Mon Sep 17 00:00:00 2001 From: Nicola Pero Date: Fri, 15 Apr 2011 18:15:35 +0000 Subject: In gcc/c-family/: 2011-04-15 Nicola Pero In gcc/c-family/: 2011-04-15 Nicola Pero * c-objc.h (objc_get_interface_ivars): Removed. (objc_detect_field_duplicates): New. * stub-objc.c: Likewise. In gcc/: 2011-04-15 Nicola Pero * c-decl.c (detect_field_duplicates): Call objc_detect_field_duplicates instead of objc_get_interface_ivars. In gcc/objc/: 2011-04-15 Nicola Pero * objc-act.c (objc_get_interface_ivars): Removed. (objc_detect_field_duplicates): New. (hash_instance_variable): New. (eq_instance_variable): New. In gcc/objcp/: 2011-04-15 Nicola Pero * objcp-decl.c (objcp_finish_struct): Use objc_detect_field_duplicates instead of having a local implementation. In gcc/testsuite/: 2011-04-15 Nicola Pero * objc.dg/naming-4.m: Updated. * objc.dg/naming-5.m: Updated. * objc.dg/naming-6.m: New. * objc.dg/naming-7.m: New. * obj-c++.dg/naming-1.mm: Updated. * obj-c++.dg/naming-2.mm: Updated. * obj-c++.dg/naming-3.mm: New. * obj-c++.dg/naming-4.mm: New. From-SVN: r172511 --- gcc/c-decl.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 3436278..ce6fd2a 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6829,15 +6829,19 @@ detect_field_duplicates (tree fieldlist) int timeout = 10; /* If the struct is the list of instance variables of an Objective-C - class, then we need to add all the instance variables of - superclasses before checking for duplicates (since you can't have + class, then we need to check all the instance variables of + superclasses when checking for duplicates (since you can't have an instance variable in a subclass with the same name as an - instance variable in a superclass). objc_get_interface_ivars() - leaves fieldlist unchanged if we are not in this case, so in that - case nothing changes compared to C. - */ + instance variable in a superclass). We pass on this job to the + Objective-C compiler. objc_detect_field_duplicates() will return + false if we are not checking the list of instance variables and + the C frontend should proceed with the standard field duplicate + checks. If we are checking the list of instance variables, the + ObjC frontend will do the check, emit the errors if needed, and + then return true. */ if (c_dialect_objc ()) - fieldlist = objc_get_interface_ivars (fieldlist); + if (objc_detect_field_duplicates (false)) + return; /* First, see if there are more than "a few" fields. This is trivially true if there are zero or one fields. */ -- cgit v1.1