diff options
author | Nicola Pero <nicola.pero@meta-innovation.com> | 2010-09-21 18:51:34 +0000 |
---|---|---|
committer | Nicola Pero <nicola@gcc.gnu.org> | 2010-09-21 18:51:34 +0000 |
commit | c0c24aa47091e72b753c922c01f071a72e531eee (patch) | |
tree | 897f0bbb69ee50c5f581e4a8d83c36076bdc3738 /gcc/c-decl.c | |
parent | f997b875dd00aaa75f85bbefa2e90ebfba7b6808 (diff) | |
download | gcc-c0c24aa47091e72b753c922c01f071a72e531eee.zip gcc-c0c24aa47091e72b753c922c01f071a72e531eee.tar.gz gcc-c0c24aa47091e72b753c922c01f071a72e531eee.tar.bz2 |
re PR objc/25965 (Allows duplicate member names in objc subclasses)
PR objc/25965
In gcc/objc/:
* objc-act.c (objc_get_interface_ivars): New function.
(objc_collecting_ivars): New variable.
(continue_class): Set and reset objc_collecting_ivars for context.
In gcc/:
* c-decl.c (detect_field_duplicates): If compiling Objective-C,
call objc_get_interface_ivars ().
* c-family/c-common.h (objc_get_interface_ivars): New declaration.
* c-family/stub-objc.c (objc_get_interface_ivars): New stub.
In gcc/objcp/:
* objcp-decl.c (objcp_finish_struct): Call
objc_get_interface_ivars() and check for duplicate ivars.
In gcc/testsuite/:
Merge from 'apple/trunk' branch on FSF servers.
2005-10-11 Fariborz Jahanian <fjahanian@apple.com>
Radar 4291785
objc.dg/naming-4.m: New
objc.dg/naming-5.m: New
obj-c++.dg/naming-1.mm: New
obj-c++.dg/naming-2.mm: New
From-SVN: r164491
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 6c65b27..f8be06b 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6718,6 +6718,17 @@ detect_field_duplicates (tree fieldlist) tree x, y; 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 + 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. + */ + if (c_dialect_objc ()) + fieldlist = objc_get_interface_ivars (fieldlist); + /* First, see if there are more than "a few" fields. This is trivially true if there are zero or one fields. */ if (!fieldlist) |