diff options
author | Nicola Pero <nicola.pero@meta-innovation.com> | 2010-11-13 15:53:32 +0000 |
---|---|---|
committer | Nicola Pero <nicola@gcc.gnu.org> | 2010-11-13 15:53:32 +0000 |
commit | 5a2a6eb0503f631694426849a94ccb8355c7aad9 (patch) | |
tree | c667cb4ec1103e130eeb2173f6ac0768f8048e8c /gcc/objc | |
parent | 4286fd7aec2b44e77d2ca271c6a5aecf6bc753bb (diff) | |
download | gcc-5a2a6eb0503f631694426849a94ccb8355c7aad9.zip gcc-5a2a6eb0503f631694426849a94ccb8355c7aad9.tar.gz gcc-5a2a6eb0503f631694426849a94ccb8355c7aad9.tar.bz2 |
In gcc/objc/: 2010-11-13 Nicola Pero <nicola.pero@meta-innovation.com>
In gcc/objc/:
2010-11-13 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (objc_get_protocol_qualified_type): detect cases
where we are asked to attach a protocol to something which is not
an Objective-C object type, and produce an error.
In gcc/testsuite/:
2010-11-13 Nicola Pero <nicola.pero@meta-innovation.com>
* objc/compile/20060406-1.m: Fixed testcase not to try to qualify
a pointer to an arbitrary C struct with an Objective-C protocol.
Test various valid uses of typedef with Objective-C objects and
protocols instead.
* objc.dg/invalid-type-1.m: New.
* obj-c++.dg/invalid-type-1.m: New.
From-SVN: r166709
Diffstat (limited to 'gcc/objc')
-rw-r--r-- | gcc/objc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/objc/objc-act.c | 17 |
2 files changed, 22 insertions, 1 deletions
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index f2f2a6a..41bc796 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,9 @@ +2010-11-13 Nicola Pero <nicola.pero@meta-innovation.com> + + * objc-act.c (objc_get_protocol_qualified_type): detect cases + where we are asked to attach a protocol to something which is not + an Objective-C object type, and produce an error. + 2010-11-11 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c (objc_add_property_declaration): Check that the type diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 715623f..48b04ac 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -2530,7 +2530,22 @@ objc_get_protocol_qualified_type (tree interface, tree protocols) : xref_tag (RECORD_TYPE, type)); } else - return interface; + { + /* This case happens when we are given an 'interface' which + is not a valid class name. For example if a typedef was + used, and 'interface' really is the identifier of the + typedef, but when you resolve it you don't get an + Objective-C class, but something else, such as 'int'. + This is an error; protocols make no sense unless you use + them with Objective-C objects. */ + error_at (input_location, "only Objective-C object types can be qualified with a protocol"); + + /* Try to recover. Ignore the invalid class name, and treat + the object as an 'id' to silence further warnings about + the class. */ + type = objc_object_type; + is_ptr = true; + } } if (protocols) |