summaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorzlaski <zlaski@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-08 18:48:56 +0000
committerzlaski <zlaski@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-08 18:48:56 +0000
commit73bd5b7dd5e2eb4f27ac35d26be2480cd38f4683 (patch)
tree0c5565d9ae431cbdfdb18491b49e823a7e3e57dc /gcc/testsuite
parent13f08ee73a09f0fed0c11095b6d7dd1ba887fc15 (diff)
downloadgcc-73bd5b7dd5e2eb4f27ac35d26be2480cd38f4683.tar.gz
[gcc/testsuite/ChangeLog]
2004-09-08 Ziemowit Laski <zlaski@apple.com> * objc.dg/bitfield-2.m: Make 'id' definition a typedef. * obj.dg/bitfield-4.m: Allow 'unsigned' in addition to 'unsigned int' in error message. * objc.dg/id-1.m: Attempt to define 'id' in an incompatible fashion. * objc.dg/method-6.m: Allow 'unsigned' in addition to 'unsigned int' in error message. * objc.dg/proto-qual-1.m: Protocol qualifiers now appear before the types they qualify. * objc.dg/type-size-2.m: Fix wording in comment. * objc.dg/va-meth-1.m: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87196 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog13
-rw-r--r--gcc/testsuite/objc.dg/bitfield-2.m2
-rw-r--r--gcc/testsuite/objc.dg/bitfield-4.m5
-rw-r--r--gcc/testsuite/objc.dg/id-1.m7
-rw-r--r--gcc/testsuite/objc.dg/method-6.m2
-rw-r--r--gcc/testsuite/objc.dg/proto-qual-1.m4
-rw-r--r--gcc/testsuite/objc.dg/type-size-2.m2
-rw-r--r--gcc/testsuite/objc.dg/va-meth-1.m69
8 files changed, 93 insertions, 11 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 46b655fb15b..05dfa724e99 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,16 @@
+2004-09-08 Ziemowit Laski <zlaski@apple.com>
+
+ * objc.dg/bitfield-2.m: Make 'id' definition a typedef.
+ * obj.dg/bitfield-4.m: Allow 'unsigned' in addition to 'unsigned int'
+ in error message.
+ * objc.dg/id-1.m: Attempt to define 'id' in an incompatible fashion.
+ * objc.dg/method-6.m: Allow 'unsigned' in addition to 'unsigned int'
+ in error message.
+ * objc.dg/proto-qual-1.m: Protocol qualifiers now appear before the
+ types they qualify.
+ * objc.dg/type-size-2.m: Fix wording in comment.
+ * objc.dg/va-meth-1.m: New test case.
+
2004-09-06 H.J. Lu <hongjiu.lu@intel.com>
PR c/16633:
diff --git a/gcc/testsuite/objc.dg/bitfield-2.m b/gcc/testsuite/objc.dg/bitfield-2.m
index 83b31748371..6875c6c4d87 100644
--- a/gcc/testsuite/objc.dg/bitfield-2.m
+++ b/gcc/testsuite/objc.dg/bitfield-2.m
@@ -4,7 +4,7 @@
/* { dg-options "-fnext-runtime -fsigned-char" } */
/* { dg-do run { target *-*-darwin* } } */
-struct objc_object { struct objc_class *class_pointer; } *id;
+typedef struct objc_object { struct objc_class *class_pointer; } *id;
extern void abort(void);
extern int strcmp(const char *, const char *);
diff --git a/gcc/testsuite/objc.dg/bitfield-4.m b/gcc/testsuite/objc.dg/bitfield-4.m
index 858bac2b003..4883497e8bb 100644
--- a/gcc/testsuite/objc.dg/bitfield-4.m
+++ b/gcc/testsuite/objc.dg/bitfield-4.m
@@ -19,11 +19,10 @@
@implementation WithBitfields {
char *isa; /* { dg-error "conflicting instance variable type .char \\*isa." } */
/* { dg-error "previous declaration of .void \\*isa." "" { target *-*-* } 12 } */
- unsigned a: 5; /* { dg-error "conflicting instance variable type .unsigned a: 5." } */
- /* { dg-error "previous declaration of .unsigned a: 3." "" { target *-*-* } 13 } */
+ unsigned a: 5; /* { dg-error "conflicting instance variable type .unsigned( int)? a: 5." } */
+ /* { dg-error "previous declaration of .unsigned( int)? a: 3." "" { target *-*-* } 13 } */
signed b: 4; /* This one is fine. */
int c: 3; /* { dg-error "conflicting instance variable type .int c: 3." } */
/* { dg-error "previous declaration of .int c: 5." "" { target *-*-* } 15 } */
}
@end
-
diff --git a/gcc/testsuite/objc.dg/id-1.m b/gcc/testsuite/objc.dg/id-1.m
index abc17bc67cc..ceb4d898131 100644
--- a/gcc/testsuite/objc.dg/id-1.m
+++ b/gcc/testsuite/objc.dg/id-1.m
@@ -1,6 +1,7 @@
-/* Test the id type warning. */
+/* Test attempt to redefine 'id' in an incompatible fashion. */
/* { dg-do compile } */
-typedef int id;
+typedef int id; /* { dg-error "conflicting types for .id." } */
+/* { dg-error "previous declaration of .id. was here" "" { target *-*-* } 0 } */
-id b; /* { dg-warning "nexpected type for `id'" } */
+id b;
diff --git a/gcc/testsuite/objc.dg/method-6.m b/gcc/testsuite/objc.dg/method-6.m
index a4ca787b7f6..8bed64bee1a 100644
--- a/gcc/testsuite/objc.dg/method-6.m
+++ b/gcc/testsuite/objc.dg/method-6.m
@@ -19,7 +19,7 @@ void foo(void) {
Class receiver;
[receiver port]; /* { dg-warning "multiple methods named .\\+port. found" } */
- /* { dg-warning "using .\\-\\(unsigned\\)port." "" { target *-*-* } 9 } */
+ /* { dg-warning "using .\\-\\(unsigned( int)?\\)port." "" { target *-*-* } 9 } */
/* { dg-warning "also found .\\+\\(Protocol \\*\\)port." "" { target *-*-* } 14 } */
[receiver starboard]; /* { dg-warning ".Class. may not respond to .\\+starboard." } */
diff --git a/gcc/testsuite/objc.dg/proto-qual-1.m b/gcc/testsuite/objc.dg/proto-qual-1.m
index 0f1c3102d27..126bae76e89 100644
--- a/gcc/testsuite/objc.dg/proto-qual-1.m
+++ b/gcc/testsuite/objc.dg/proto-qual-1.m
@@ -43,10 +43,10 @@ static void scan_initial(const char *pattern) {
int main(void) {
meth = [proto descriptionForInstanceMethod: @selector(address:with:)];
- scan_initial("O@%u@%u:%uNR@%uo^^S%u");
+ scan_initial("O@%u@%u:%uRN@%uo^^S%u");
CHECK_IF(offs3 == offs2 + aligned_sizeof(id) && totsize == offs3 + aligned_sizeof(unsigned));
meth = [proto descriptionForClassMethod: @selector(retainArgument:with:)];
- scan_initial("Vv%u@%u:%uOo@%un^*%u");
+ scan_initial("Vv%u@%u:%uoO@%un^*%u");
CHECK_IF(offs3 == offs2 + aligned_sizeof(id) && totsize == offs3 + aligned_sizeof(char **));
return 0;
}
diff --git a/gcc/testsuite/objc.dg/type-size-2.m b/gcc/testsuite/objc.dg/type-size-2.m
index 446de48345a..da6bdb8f9fb 100644
--- a/gcc/testsuite/objc.dg/type-size-2.m
+++ b/gcc/testsuite/objc.dg/type-size-2.m
@@ -1,6 +1,6 @@
/* Make sure that array arguments to methods are given the size of pointers. */
/* As in the case of ivars, arrays without size (e.g., 'int []') are
- encoded as pointers as well. */
+ encoded as pointers. */
/* Contributed by Ziemowit Laski <zlaski@apple.com>. */
/* { dg-do run } */
diff --git a/gcc/testsuite/objc.dg/va-meth-1.m b/gcc/testsuite/objc.dg/va-meth-1.m
new file mode 100644
index 00000000000..751b6484545
--- /dev/null
+++ b/gcc/testsuite/objc.dg/va-meth-1.m
@@ -0,0 +1,69 @@
+/* Based on objc/execute/va_method.m, by Nicola Pero */
+/* { dg-do run } */
+
+#include <objc/Object.h>
+#include <stdarg.h>
+#include <stdlib.h>
+
+/* Test methods with "C-style" trailing arguments, with or without ellipsis. */
+
+@interface MathClass: Object
+/* sum positive numbers; -1 ends the list */
++ (int) sum: (int)firstNumber, int secondNumber, ...;
++ (int) prod: (int) firstNumber, int secondNumber, int thirdNumber;
++ (int) minimum: (int) firstNumber, ...;
+@end
+
+@implementation MathClass
++ (int) sum: (int)firstNumber, int secondNumber, ...
+{
+ va_list ap;
+ int sum = 0, number = 0;
+
+ va_start (ap, secondNumber);
+ number = firstNumber + secondNumber;
+
+ while (number >= 0)
+ {
+ sum += number;
+ number = va_arg (ap, int);
+ }
+
+ va_end (ap);
+
+ return sum;
+}
++ (int) prod: (int) firstNumber, int secondNumber, int thirdNumber {
+ return firstNumber * secondNumber * thirdNumber;
+}
++ (int) minimum: (int)firstNumber, ...
+{
+ va_list ap;
+ int minimum = 999, number = 0;
+
+ va_start (ap, firstNumber);
+ number = firstNumber;
+
+ while (number >= 0)
+ {
+ minimum = (minimum < number ? minimum: number);
+ number = va_arg (ap, int);
+ }
+
+ va_end (ap);
+
+ return minimum;
+}
+@end
+
+int main (void)
+{
+ if ([MathClass sum: 1, 2, 3, 4, 5, -1] != 15)
+ abort ();
+ if ([MathClass prod: 4, 5, 6] != 120)
+ abort ();
+ if ([MathClass minimum: 17, 9, 133, 84, 35, -1] != 9)
+ abort ();
+
+ return 0;
+}