aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c18
1 files changed, 11 insertions, 7 deletions
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. */