aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/desig-init-1.m
diff options
context:
space:
mode:
authorZiemowit Laski <zlaski@gcc.gnu.org>2004-10-25 22:55:25 +0000
committerZiemowit Laski <zlaski@gcc.gnu.org>2004-10-25 22:55:25 +0000
commit3a3589b4ba5e2d88874f8178f8808f784860fca5 (patch)
treeac249a647a7d1f72cb019c1e551cbb2d1a3eeda9 /gcc/testsuite/objc.dg/desig-init-1.m
parent5307127042d75e40e952bb986e6f15377dac75db (diff)
downloadgcc-3a3589b4ba5e2d88874f8178f8808f784860fca5.zip
gcc-3a3589b4ba5e2d88874f8178f8808f784860fca5.tar.gz
gcc-3a3589b4ba5e2d88874f8178f8808f784860fca5.tar.bz2
c-common.h: Remove RID_ID.
[gcc/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> * c-common.h: Remove RID_ID. * c-parse.in: Remove OBJECTNAME and references to RID_ID. (typespec_reserved_attr): Add rule for TYPENAME non_empty_protocolrefs. (yylexname): Remove special handling of RID_ID. [gcc/objc/ChangeLog] 2004-10-25 Ziemowit Laski <zlaski@apple.com> David Ayers <d.ayers@inode.at> * objc-act.c (objc_comptypes): Use IS_PROTOCOL_QUALIFIED_UNTYPED instead of IS_PROTOCOL_QUALIFIED_ID; add comparisons for: 'Class <Protocol> != id <Protocol>'; 'Class <Protocol> != <class> *'; 'Class <Protocol> == id' and 'Class <Protocol> == Class'. (objc_is_id): Add test for 'super'. (objc_finish_message_expr): Allow for messaging of 'Class <Proto>' receivers; if class methods are not found in protocol lists, search for instance methods therein and warn if one is found. Look in global hash tables for suitable method as a last resort when messaging 'id <Proto>', 'Class <Proto>' and invalid receiver types. (objc_add_method): Insert instance methods listed in protocols into the global class method hash table. * objc-act.h (IS_PROTOCOL_QUALIFIED_ID): Rename to IS_PROTOCOL_QUALIFIED_UNTYPED and allow for 'Class <Proto>' in addition to 'id <Proto>'. [gcc/testsuite/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> Ziemowit Laski <zlaski@apple.com> * objc.dg/call-super-2.m: Add messages to 'Class <Proto>'; update diagnostics when messaging 'id <Proto>'. * objc.dg/class-protocol-1.m: New test. * objc.dg/desig-init-1.m: Add message to an invalid receiver using a non-existent method signature. * objc.dg/method-5.m, objc.dg/method-6.m, objc.dg/proto-hier-1.m: Update diagnostics when messaging with non-existent method signature. * objc.dg/proto-hier-2.m: Adjust wording of diagnostic. * objc.dg/proto-lossage-1.m, objc.dg/proto-lossage-4.m: Messages to invalid receivers are now resolved as if messaging 'id'; remove extraneous diagnostics. From-SVN: r89562
Diffstat (limited to 'gcc/testsuite/objc.dg/desig-init-1.m')
-rw-r--r--gcc/testsuite/objc.dg/desig-init-1.m22
1 files changed, 14 insertions, 8 deletions
diff --git a/gcc/testsuite/objc.dg/desig-init-1.m b/gcc/testsuite/objc.dg/desig-init-1.m
index cd56324..6ef710b 100644
--- a/gcc/testsuite/objc.dg/desig-init-1.m
+++ b/gcc/testsuite/objc.dg/desig-init-1.m
@@ -4,7 +4,8 @@
/* { dg-options "-std=gnu99" } */
/* { dg-do run } */
-#include <stdio.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <objc/objc.h>
#include <objc/Object.h>
@@ -18,19 +19,20 @@
+ (int) meth1 { return 45; }
+ (int) meth2 { return 21; }
+ (void) doTests {
- int arr[6] = {
+ int arr[7] = {
0,
[Cls meth1],
[2 + 1] = 3,
- [2 * 2 ... 5] = (size_t)[0 meth2], /* { dg-warning "invalid receiver type" } */
- /* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 25 } */
- /* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 25 } */
- /* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 25 } */
- [2] [Cls meth2]
+ [2 * 2 ... 5] = (size_t)[0 meth4], /* { dg-warning "invalid receiver type" } */
+ /* { dg-warning "no .\\-meth4. method found" "" { target *-*-* } 26 } */
+ [2] [Cls meth2],
+ /* Since invalid receivers are treated as 'id' for purposes of message
+ lookup, we _should_ find a meth2 to call below. */
+ [6] = (int)[0 meth2] /* { dg-warning "invalid receiver type" } */
};
if (arr[0] != 0 || arr[1] != 45 || arr[2] != 21 || arr[3] != 3)
- abort (); /* { dg-warning "implicit declaration" } */
+ abort ();
printf ("%s\n", [super name]);
printf ("%d %d %d %d %d %d\n", arr[0], arr[1], arr[2], arr[3], arr[4], arr[5]);
@@ -41,3 +43,7 @@ int main(void) {
[Cls doTests];
return 0;
}
+
+/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */
+/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */
+/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */