aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorStan Shebs <shebs@apple.com>2001-06-08 22:16:58 +0000
committerStan Shebs <shebs@gcc.gnu.org>2001-06-08 22:16:58 +0000
commit43fd108f69a0a0da4e929372f2809e5ad273850b (patch)
tree4660a2b6f6b997fd02b65812daafa03a7781f4f7 /gcc
parentfdf448f76bd08212cd2a78425251331099e98847 (diff)
downloadgcc-43fd108f69a0a0da4e929372f2809e5ad273850b.zip
gcc-43fd108f69a0a0da4e929372f2809e5ad273850b.tar.gz
gcc-43fd108f69a0a0da4e929372f2809e5ad273850b.tar.bz2
load-2.m: New test.
* objc/execute/load-2.m: New test. From Nicola Pero <n.pero@mi.flashnet.it>. From-SVN: r43051
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/objc/execute/load-2.m46
2 files changed, 51 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1bc218d..0ae6268 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2001-06-08 Stan Shebs <shebs@apple.com>
+
+ * objc/execute/load-2.m: New test. From Nicola Pero
+ <n.pero@mi.flashnet.it>.
+
2001-06-08 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/execute/20010605-2.c: New test.
diff --git a/gcc/testsuite/objc/execute/load-2.m b/gcc/testsuite/objc/execute/load-2.m
new file mode 100644
index 0000000..eb90658
--- /dev/null
+++ b/gcc/testsuite/objc/execute/load-2.m
@@ -0,0 +1,46 @@
+/* Contributed by Nicola Pero - Wed Jun 6 14:34:23 CEST 2001 */
+#include <objc/objc.h>
+
+/* Test that +load is automatically called before main is run;
+ on two different classes. */
+
+static int static_variable1 = 0;
+static int static_variable2 = 0;
+
+@interface TestClass1
+{
+ Class isa;
+}
++ (void) load;
+@end
+
+@implementation TestClass1
++ (void) load
+{
+ static_variable1 = 1;
+}
+@end
+
+@interface TestClass2
+{
+ Class isa;
+}
++ (void) load;
+@end
+
+@implementation TestClass2
++ (void) load
+{
+ static_variable2 = 1;
+}
+@end
+
+int main (void)
+{
+ if (static_variable1 != 1 || static_variable2 != 1)
+ {
+ abort ();
+ }
+
+ return 0;
+}