From patchwork Mon Oct 18 23:32:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Pero X-Patchwork-Id: 68252 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 7ABDFB70D0 for ; Tue, 19 Oct 2010 10:32:28 +1100 (EST) Received: (qmail 31319 invoked by alias); 18 Oct 2010 23:32:26 -0000 Received: (qmail 31308 invoked by uid 22791); 18 Oct 2010 23:32:26 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL, BAYES_00, TW_BJ, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (140.186.70.10) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 18 Oct 2010 23:32:21 +0000 Received: from eggs.gnu.org ([140.186.70.92]:51640) by fencepost.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1P7zBi-0008LQ-T9 for gcc-patches@gnu.org; Mon, 18 Oct 2010 19:32:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P7zBh-0000Z7-KD for gcc-patches@gnu.org; Mon, 18 Oct 2010 19:32:18 -0400 Received: from smtp141.iad.emailsrvr.com ([207.97.245.141]:47717) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P7zBh-0000Z2-Gb for gcc-patches@gnu.org; Mon, 18 Oct 2010 19:32:17 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp44.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id 06BD9128650 for ; Mon, 18 Oct 2010 19:32:17 -0400 (EDT) X-Orig-To: gcc-patches@gnu.org Received: from dynamic1.wm-web.iad.mlsrvr.com (dynamic1.wm-web.iad1a.rsapps.net [192.168.2.150]) by smtp44.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id E18F812819A for ; Mon, 18 Oct 2010 19:32:16 -0400 (EDT) Received: from meta-innovation.com (localhost [127.0.0.1]) by dynamic1.wm-web.iad.mlsrvr.com (Postfix) with ESMTP id D04D1C98070 for ; Mon, 18 Oct 2010 19:32:16 -0400 (EDT) Received: by www2.webmail.us (Authenticated sender: nicola.pero@meta-innovation.com, from: nicola.pero@meta-innovation.com) with HTTP; Tue, 19 Oct 2010 01:32:16 +0200 (CEST) Date: Tue, 19 Oct 2010 01:32:16 +0200 (CEST) Subject: ObjC/ObjC++ - testcase merge From: "Nicola Pero" To: "gcc-patches@gnu.org" MIME-Version: 1.0 X-Type: plain Message-ID: <1287444736.85096991@192.168.2.229> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch merges two testcases from the FSF apple/trunk. They already seem to work fine, but it's good to have them. :-) Committed to trunk (preapproved by Mike). Thanks Index: ChangeLog =================================================================== --- ChangeLog (revision 165657) +++ ChangeLog (working copy) @@ -2,6 +2,16 @@ Merge from 'apple/trunk' branch on FSF servers. + 2006-03-16 Fariborz Jahanian + + Radar 4293709 + * objc.dg/proto-init-mimatch-1.m: New. + * obj-c++.dg/proto-init-mimatch-1.mm: New. + +2010-10-18 Nicola Pero + + Merge from 'apple/trunk' branch on FSF servers. + 2006-01-17 Fariborz Jahanian Radar 4407151 Index: objc.dg/proto-init-mimatch-1.m =================================================================== --- objc.dg/proto-init-mimatch-1.m (revision 0) +++ objc.dg/proto-init-mimatch-1.m (revision 0) @@ -0,0 +1,35 @@ +/* Test to warn on protocol mismatch in a variety of initializations. */ + +/* { dg-do compile } */ + +typedef struct objc_class *Class; + +typedef struct objc_object { + Class isa; +} *id; + +@protocol NSObject +@end + +@interface NSObject +@end + +@protocol NSCopying +- (void)copyWithZone; +@end + +@interface Foo:NSObject +@end + + +extern id NSCopyObject(); + +@implementation Foo +- (void)copyWithZone { + Foo *copy = NSCopyObject(); /* { dg-warning "type \\'id \\' does not conform to the \\'NSCopying\\' protocol" } */ + + Foo *g = NSCopyObject(); /* { dg-warning "type \\'id \\' does not conform to the \\'NSCopying\\' protocol" } */ + + id h = NSCopyObject(); /* { dg-warning "type \\'id \\' does not conform to the \\'NSCopying\\' protocol" } */ +} +@end Index: obj-c++.dg/proto-init-mimatch-1.mm =================================================================== --- obj-c++.dg/proto-init-mimatch-1.mm (revision 0) +++ obj-c++.dg/proto-init-mimatch-1.mm (revision 0) @@ -0,0 +1,35 @@ +/* Test to warn on protocol mismatch in a variety of initializations. */ + +/* { dg-do compile } */ + +typedef struct objc_class *Class; + +typedef struct objc_object { + Class isa; +} *id; + +@protocol NSObject +@end + +@interface NSObject +@end + +@protocol NSCopying +- (void)copyWithZone; +@end + +@interface Foo:NSObject +@end + + +extern id NSCopyObject(); + +@implementation Foo +- (void)copyWithZone { + Foo *copy = NSCopyObject(); /* { dg-warning "type \\'id \\' does not conform to the \\'NSCopying\\' protocol" } */ + + Foo *g = NSCopyObject(); /* { dg-warning "type \\'id \\' does not conform to the \\'NSCopying\\' protocol" } */ + + id h = NSCopyObject(); /* { dg-warning "type \\'id \\' does not conform to the \\'NSCopying\\' protocol" } */ +} +@end