aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorZiemowit Laski <zlaski@apple.com>2004-10-26 18:39:01 +0000
committerZiemowit Laski <zlaski@gcc.gnu.org>2004-10-26 18:39:01 +0000
commit38285932eaf2c4188d348bffbed500389bcc1c34 (patch)
treefece3da7ba60683adc5c4817394fddabf4291c66 /gcc/testsuite
parentc5e1045b30758f8ccec2c5b11d606fd761458b0e (diff)
downloadgcc-38285932eaf2c4188d348bffbed500389bcc1c34.zip
gcc-38285932eaf2c4188d348bffbed500389bcc1c34.tar.gz
gcc-38285932eaf2c4188d348bffbed500389bcc1c34.tar.bz2
objc-act.c (finish_class): Do not synthesize bogus 'extern objc_object *_Foo;' declarations for @interface Foo.
[gcc/objc/ChangeLog] 2004-10-26 Ziemowit Laski <zlaski@apple.com> * objc-act.c (finish_class): Do not synthesize bogus 'extern objc_object *_Foo;' declarations for @interface Foo. [gcc/testsuite/ChangeLog] 2004-10-26 Ziemowit Laski <zlaski@apple.com> * objc.dg/super-class-3.m: New test. From-SVN: r89601
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/objc.dg/super-class-3.m43
2 files changed, 47 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e8a8ec6..4496f97 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2004-10-26 Ziemowit Laski <zlaski@apple.com>
+
+ * objc.dg/super-class-3.m: New test.
+
2004-10-26 Nathan Sidwell <nathan@codesourcery.com>
* gcc.dg/cpp/direct2.c: Adjust expected errors, robustify parser
diff --git a/gcc/testsuite/objc.dg/super-class-3.m b/gcc/testsuite/objc.dg/super-class-3.m
new file mode 100644
index 0000000..85396c2
--- /dev/null
+++ b/gcc/testsuite/objc.dg/super-class-3.m
@@ -0,0 +1,43 @@
+/* Ensure that the compiler does not emit spurious extern declarations named '_Foo', where 'Foo'
+ is an ObjC class name. */
+/* Contributed by Ziemowit Laski <zlaski@apple.com>. */
+/* { dg-do run } */
+
+#include <objc/Object.h>
+#include <stdlib.h>
+#define CHECK_IF(expr) if(!(expr)) abort()
+
+@interface _Child: Object
++ (int) flashCache;
+@end
+
+@interface Child: _Child
++ (int) flushCache1;
+@end
+
+@interface Child (Categ)
++ (int) flushCache2;
+@end
+
+int _Object = 23; /* Should not conflict with @interface Object. */
+
+@implementation _Child
++ (int) flashCache { return 12 + _Object; }
+@end
+
+@implementation Child
++ (int) flushCache1 { return 7 + [super flashCache]; }
+@end
+
+@implementation Child (Categ)
++ (int) flushCache2 { return 9 + [super flashCache]; }
+@end
+
+int main(void) {
+ CHECK_IF([_Child flashCache] == 35);
+ CHECK_IF([Child flushCache1] == 42);
+ CHECK_IF([Child flushCache2] == 44);
+
+ return 0;
+}
+