From patchwork Tue Sep 14 10:28:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Pero X-Patchwork-Id: 64690 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 77B94B6F11 for ; Tue, 14 Sep 2010 20:28:38 +1000 (EST) Received: (qmail 18113 invoked by alias); 14 Sep 2010 10:28:37 -0000 Received: (qmail 18105 invoked by uid 22791); 14 Sep 2010 10:28:36 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL, BAYES_00, TW_FN, 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; Tue, 14 Sep 2010 10:28:31 +0000 Received: from eggs.gnu.org ([140.186.70.92]:34028) by fencepost.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OvSkl-0003I5-R9 for gcc-patches@gnu.org; Tue, 14 Sep 2010 06:28:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OvSkW-0002D1-Ll for gcc-patches@gnu.org; Tue, 14 Sep 2010 06:28:29 -0400 Received: from smtp161.iad.emailsrvr.com ([207.97.245.161]:51927) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OvSkW-0002Cw-Hv for gcc-patches@gnu.org; Tue, 14 Sep 2010 06:28:28 -0400 Received: from relay6.relay.iad.emailsrvr.com (localhost [127.0.0.1]) by relay6.relay.iad.emailsrvr.com (SMTP Server) with ESMTP id 6335016CFF3 for ; Tue, 14 Sep 2010 06:28:28 -0400 (EDT) Received: from dynamic5.wm-web.iad.mlsrvr.com (dynamic5.wm-web.iad.mlsrvr.com [192.168.2.146]) by relay6.relay.iad.emailsrvr.com (SMTP Server) with ESMTP id 5C29616CF6B for ; Tue, 14 Sep 2010 06:28:28 -0400 (EDT) Received: from meta-innovation.com (localhost [127.0.0.1]) by dynamic5.wm-web.iad.mlsrvr.com (Postfix) with ESMTP id 4B2458D0AC9 for ; Tue, 14 Sep 2010 06:28:28 -0400 (EDT) Received: by www2.webmail.us (Authenticated sender: nicola.pero@meta-innovation.com, from: nicola.pero@meta-innovation.com) with HTTP; Tue, 14 Sep 2010 12:28:28 +0200 (CEST) Date: Tue, 14 Sep 2010 12:28:28 +0200 (CEST) Subject: [C++ Ping] Re: ObjC/ObjC++: fixed 'too many arguments to method xxx' error From: "Nicola Pero" To: gcc-patches@gnu.org MIME-Version: 1.0 X-Type: plain In-Reply-To: <1284318210.7412758@192.168.2.229> References: <1284264562.32429259@192.168.2.227> <201009121928.18832.ebotcazou@adacore.com> <1284317812.674718257@192.168.2.229> <201009122052.01987.ebotcazou@adacore.com> <1284318210.7412758@192.168.2.229> Message-ID: <1284460108.30529464@192.168.2.229> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 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 I think the C++ FE maintainers still need to approve the changes to cp/typecheck.c OK to commit guys ? :-) Thanks -----Original Message----- From: "Nicola Pero" Sent: Sunday, 12 September, 2010 21:03 To: "Eric Botcazou" Cc: gcc-patches@gcc.gnu.org, "Joseph S. Myers" Subject: Re: ObjC/ObjC++: fixed 'too many arguments to method xxx' error > Without the cp/ prefix. :-) Ok ... here we go ... hopefully the last iteration ;-) Thanks Index: gcc/ChangeLog =================================================================== --- gcc/ChangeLog (revision 164229) +++ gcc/ChangeLog (working copy) @@ -1,3 +1,10 @@ +2010-09-12 Nicola Pero + + * c-typeck.c (convert_arguments): Use warning 'too many arguments + to method [methodname]' for an Objective-C method instead of the + less satisfactory 'too many arguments to function' (with no method + name). + 2010-09-10 Jan Hubicka * tree-ssa-ccp.c (fold_const_aggregate_ref): Do not check STATIC flag. Index: gcc/testsuite/ChangeLog =================================================================== --- gcc/testsuite/ChangeLog (revision 164229) +++ gcc/testsuite/ChangeLog (working copy) @@ -1,3 +1,16 @@ +2010-09-12 Nicola Pero + + * obj-c++.dg/too-many-args.mm: New file. + +2010-09-12 Nicola Pero + + Merge from 'apple/trunk' branch on FSF servers. + + 2006-03-27 Fariborz Jahanian + + Radar 4491608 + * objc.dg/too-many-args.m: New + 2010-09-11 Francois-Xavier Coudert * gfortran.dg/promotion.f90: Fix options. Index: gcc/testsuite/objc.dg/too-many-args.m =================================================================== --- gcc/testsuite/objc.dg/too-many-args.m (revision 0) +++ gcc/testsuite/objc.dg/too-many-args.m (revision 0) @@ -0,0 +1,10 @@ +/* { dg-do compile } */ + +@interface SomeClass ++ method:(int)foo; +@end + +int main(void) { + [SomeClass method:3, 4]; /* { dg-error "too many arguments to method \\'method:\\'" } */ + return 0; +} Index: gcc/testsuite/obj-c++.dg/too-many-args.mm =================================================================== --- gcc/testsuite/obj-c++.dg/too-many-args.mm (revision 0) +++ gcc/testsuite/obj-c++.dg/too-many-args.mm (revision 0) @@ -0,0 +1,10 @@ +/* { dg-do compile } */ + +@interface SomeClass ++ method:(int)foo; +@end + +int main(void) { + [SomeClass method:3, 4]; /* { dg-error "too many arguments to method \\'method:\\'" } */ + return 0; +} Index: gcc/cp/typeck.c =================================================================== --- gcc/cp/typeck.c (revision 164229) +++ gcc/cp/typeck.c (working copy) @@ -3428,8 +3428,17 @@ warn_args_num (location_t loc, tree fnde "declared here"); } else - error_at (loc, too_many_p ? G_("too many arguments to function") - : G_("too few arguments to function")); + { + if (c_dialect_objc () && objc_message_selector ()) + error_at (loc, + too_many_p + ? G_("too many arguments to method %q#D") + : G_("too few arguments to method %q#D"), + objc_message_selector ()); + else + error_at (loc, too_many_p ? G_("too many arguments to function") + : G_("too few arguments to function")); + } } /* Convert the actual parameter expressions in the list VALUES to the Index: gcc/cp/ChangeLog =================================================================== --- gcc/cp/ChangeLog (revision 164229) +++ gcc/cp/ChangeLog (working copy) @@ -1,3 +1,10 @@ +2010-09-12 Nicola Pero + + * typeck.c (warn_args_num): Use warning 'too many arguments to + method [methodname]' for an Objective-C method instead of the less + satisfactory 'too many arguments to function' (with no method + name). + 2010-09-11 Rodrigo Rivas Implement range-based for-statements. Index: gcc/c-typeck.c =================================================================== --- gcc/c-typeck.c (revision 164229) +++ gcc/c-typeck.c (working copy) @@ -2897,8 +2897,13 @@ convert_arguments (tree typelist, VEC(tr if (type == void_type_node) { - error_at (input_location, - "too many arguments to function %qE", function); + if (selector) + error_at (input_location, + "too many arguments to method %qE", selector); + else + error_at (input_location, + "too many arguments to function %qE", function); + if (fundecl && !DECL_BUILT_IN (fundecl)) inform (DECL_SOURCE_LOCATION (fundecl), "declared here"); return parmnum;