This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ Ping] Re: ObjC/ObjC++: fixed 'too many arguments to method xxx' error


On Sep 14, 2010, at 3:28 AM, Nicola Pero wrote:
> I think the C++ FE maintainers still need to approve the changes to cp/typecheck.c
> 
> OK to commit guys ? :-)

Ok with me...

> Thanks
> 
> -----Original Message-----
> From: "Nicola Pero" <nicola.pero@meta-innovation.com>
> Sent: Sunday, 12 September, 2010 21:03
> To: "Eric Botcazou" <ebotcazou@adacore.com>
> Cc: gcc-patches@gcc.gnu.org, "Joseph S. Myers" <joseph@codesourcery.com>
> 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  <nicola.pero@meta-innovation.com>
> +
> +       * 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  <jh@suse.cz>
> 
>        * 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  <nicola.pero@meta-innovation.com>
> +
> +       * obj-c++.dg/too-many-args.mm: New file.
> +
> +2010-09-12  Nicola Pero  <nicola.pero@meta-innovation.com>
> +
> +       Merge from 'apple/trunk' branch on FSF servers.
> +
> +       2006-03-27 Fariborz Jahanian <fjahanian@apple.com>
> +
> +       Radar 4491608
> +       * objc.dg/too-many-args.m: New
> +
> 2010-09-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
> 
>        * 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  <nicola.pero@meta-innovation.com>
> +
> +       * 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 <rodrigorivascosta@gmail.com>
> 
>        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;
> 
> 
> 
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]