diff options
author | nicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-12-30 08:59:29 +0000 |
---|---|---|
committer | nicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-12-30 08:59:29 +0000 |
commit | e488ff217f90d3f862b82be452e5dbcb841b68ad (patch) | |
tree | 4d9b2cd60bffdd427dbbe13e6d69e05e66c25ae2 /gcc/testsuite/obj-c++.dg | |
parent | b7d908318bfe68c3ac9ce30a8cbb2990b24b5d55 (diff) | |
download | gcc-e488ff217f90d3f862b82be452e5dbcb841b68ad.tar.gz |
In gcc/objc/:
2010-12-30 Nicola Pero <nicola@nicola.brainstorm.co.uk>
* objc-act.c (start_class): Warn when a class attribute is
ignored.
(objc_declare_protocols): Warn when a protocol attribute in a
protocol forward-declaration is ignored.
(start_protocol): Warn when a protocol attribute is ignored.
In gcc/testsuite/:
2010-12-30 Nicola Pero <nicola.pero@meta-innovation.com>
* objc.dg/attributes/class-attribute-3.m: New.
* objc.dg/attributes/proto-attribute-4.m: New.
* obj-c++.dg/attributes/class-attribute-3.mm: New.
* obj-c++.dg/attributes/proto-attribute-4.mm: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168337 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/obj-c++.dg')
-rw-r--r-- | gcc/testsuite/obj-c++.dg/attributes/class-attribute-3.mm | 14 | ||||
-rw-r--r-- | gcc/testsuite/obj-c++.dg/attributes/proto-attribute-4.mm | 31 |
2 files changed, 45 insertions, 0 deletions
diff --git a/gcc/testsuite/obj-c++.dg/attributes/class-attribute-3.mm b/gcc/testsuite/obj-c++.dg/attributes/class-attribute-3.mm new file mode 100644 index 00000000000..f96500de4dc --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/attributes/class-attribute-3.mm @@ -0,0 +1,14 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010. */ +/* { dg-do compile } */ + +/* Test that you get a warning when an unknown class attribute is ignored. */ + +#include <objc/objc.h> + +__attribute__ ((unknown_attribute)) +@interface MyClass /* { dg-warning "ignored" } */ +{ + Class isa; +} ++ (id) new; +@end diff --git a/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-4.mm b/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-4.mm new file mode 100644 index 00000000000..d2e5f28a1b4 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-4.mm @@ -0,0 +1,31 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010. */ +/* { dg-do compile } */ + +/* Test that you get a warning when an unknown protocol attribute is ignored. */ + +#include <objc/objc.h> + +__attribute__ ((unknown_attribute)) +@protocol MyProtocol /* { dg-warning "ignored" } */ +- (id) new; +@end + +__attribute__ ((unknown_attribute)) +@protocol MyProtocol2; /* { dg-warning "ignored" } */ + +/* Use the protocols to double-check that no more warnings are + generated. */ + +@interface MyClass <MyProtocol> +@end + +int test (id <MyProtocol2> x) +{ + if (@protocol (MyProtocol) == @protocol (MyProtocol2)) + return 1; + + if (x) + return 2; + + return 3; +} |