* ObjC/ObjC++: fixed 'too many arguments to method xxx' error
@ 2010-09-12 8:25 Nicola Pero
2010-09-12 16:58 ` Joseph S. Myers
2010-09-12 22:54 ` Mike Stump
0 siblings, 2 replies; 15+ messages in thread
From: Nicola Pero @ 2010-09-12 8:25 UTC (permalink / raw)
To: gcc-patches
I took the testcase (marked as Apple Radar 4491608) from the
gcc.gnu.org/svn/gcc/branches/apple/trunk
branch (the one on the FSF servers that was agreed to be OK to merge from).
The problem is that calling an Objective-C method with too many arguments would return the vague error 'too many arguments to function', with no mention of what problematic method was.
The branch had a working one-liner fix, but I didn't particularly like it because it only added the name of the method, but the error message still called it a 'function' instead of a 'method', and there was no fix for ObjC++.
Below a more satisfactory patch by myself, with an additional Objective-C++ test. OK to commit to trunk ?
Thanks
Index: testsuite/objc.dg/too-many-args.m
===================================================================
--- testsuite/objc.dg/too-many-args.m (revision 0)
+++ 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: testsuite/obj-c++.dg/too-many-args.mm
===================================================================
--- testsuite/obj-c++.dg/too-many-args.mm (revision 0)
+++ 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: cp/typeck.c
===================================================================
--- cp/typeck.c (revision 164225)
+++ cp/typeck.c (working copy)
@@ -3428,8 +3428,17 @@
"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: c-typeck.c
===================================================================
--- c-typeck.c (revision 164225)
+++ c-typeck.c (working copy)
@@ -2897,8 +2897,13 @@
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;
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: ObjC/ObjC++: fixed 'too many arguments to method xxx' error
2010-09-12 8:25 ObjC/ObjC++: fixed 'too many arguments to method xxx' error Nicola Pero
@ 2010-09-12 16:58 ` Joseph S. Myers
2010-09-12 17:34 ` Nicola Pero
2010-09-12 22:54 ` Mike Stump
1 sibling, 1 reply; 15+ messages in thread
From: Joseph S. Myers @ 2010-09-12 16:58 UTC (permalink / raw)
To: Nicola Pero; +Cc: gcc-patches
On Sun, 12 Sep 2010, Nicola Pero wrote:
> Below a more satisfactory patch by myself, with an additional
> Objective-C++ test. OK to commit to trunk ?
Please include the ChangeLog entries with patch submissions and generate
diffs with "-p". You did neither, so your patch does not usefully
indicate what functions are being changed.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: ObjC/ObjC++: fixed 'too many arguments to method xxx' error
2010-09-12 16:58 ` Joseph S. Myers
@ 2010-09-12 17:34 ` Nicola Pero
2010-09-12 19:03 ` Eric Botcazou
2010-09-12 19:59 ` Joseph S. Myers
0 siblings, 2 replies; 15+ messages in thread
From: Nicola Pero @ 2010-09-12 17:34 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: gcc-patches
> Please include the ChangeLog entries with patch submissions and generate
> diffs with "-p". You did neither, so your patch does not usefully
> indicate what functions are being changed.
Joseph,
apologies for that. I generated the diff again as requested (below). :-)
(I used
svn diff --diff-cmd diff -x "-u -p" gcc > patch
hope that's good)
Is it recommended to send patches as text/plain attachments, or to copy/paste into
the email body ? I'm assuming small ones are better "inline", while bigger ones should
go into attachments ?
Thanks
Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog (revision 164229)
+++ gcc/ChangeLog (working copy)
@@ -1,3 +1,11 @@
+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).
+ * cp/typeck.c (warn_args_num): Same change for Objective-C++.
+
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/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;
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: ObjC/ObjC++: fixed 'too many arguments to method xxx' error
2010-09-12 17:34 ` Nicola Pero
@ 2010-09-12 19:03 ` Eric Botcazou
2010-09-12 19:39 ` Eric Botcazou
2010-09-12 22:00 ` Nicola Pero
2010-09-12 19:59 ` Joseph S. Myers
1 sibling, 2 replies; 15+ messages in thread
From: Eric Botcazou @ 2010-09-12 19:03 UTC (permalink / raw)
To: Nicola Pero; +Cc: gcc-patches, Joseph S. Myers, gcc-patches
> +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).
> + * cp/typeck.c (warn_args_num): Same change for Objective-C++.
ChangeLog for cp/ changes must go into cp/ChangeLog.
--
Eric Botcazou
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: ObjC/ObjC++: fixed 'too many arguments to method xxx' error
2010-09-12 19:03 ` Eric Botcazou
@ 2010-09-12 19:39 ` Eric Botcazou
2010-09-12 22:00 ` Nicola Pero
1 sibling, 0 replies; 15+ messages in thread
From: Eric Botcazou @ 2010-09-12 19:39 UTC (permalink / raw)
To: Nicola Pero; +Cc: gcc-patches, Joseph S. Myers, gcc-patches
> +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).
> + * cp/typeck.c (warn_args_num): Same change for Objective-C++.
ChangeLog for cp/ changes must go into cp/ChangeLog.
--
Eric Botcazou
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: ObjC/ObjC++: fixed 'too many arguments to method xxx' error
2010-09-12 17:34 ` Nicola Pero
2010-09-12 19:03 ` Eric Botcazou
@ 2010-09-12 19:59 ` Joseph S. Myers
1 sibling, 0 replies; 15+ messages in thread
From: Joseph S. Myers @ 2010-09-12 19:59 UTC (permalink / raw)
To: Nicola Pero; +Cc: gcc-patches
On Sun, 12 Sep 2010, Nicola Pero wrote:
>
> > Please include the ChangeLog entries with patch submissions and generate
> > diffs with "-p". You did neither, so your patch does not usefully
> > indicate what functions are being changed.
>
> Joseph,
>
> apologies for that. I generated the diff again as requested (below). :-)
Thanks. The c-typeck.c changes are OK.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: ObjC/ObjC++: fixed 'too many arguments to method xxx' error
2010-09-12 19:03 ` Eric Botcazou
2010-09-12 19:39 ` Eric Botcazou
@ 2010-09-12 22:00 ` Nicola Pero
2010-09-12 22:05 ` Eric Botcazou
1 sibling, 1 reply; 15+ messages in thread
From: Nicola Pero @ 2010-09-12 22:00 UTC (permalink / raw)
To: Eric Botcazou; +Cc: gcc-patches, Joseph S. Myers
> ChangeLog for cp/ changes must go into cp/ChangeLog.
Eric,
good point. A revised patch below. :-)
Thanks
===================================================================
--- 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>
+
+ * cp/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;
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: ObjC/ObjC++: fixed 'too many arguments to method xxx' error
2010-09-12 22:00 ` Nicola Pero
@ 2010-09-12 22:05 ` Eric Botcazou
2010-09-12 22:48 ` Nicola Pero
0 siblings, 1 reply; 15+ messages in thread
From: Eric Botcazou @ 2010-09-12 22:05 UTC (permalink / raw)
To: Nicola Pero; +Cc: gcc-patches, Joseph S. Myers
> good point. A revised patch below. :-)
Without the cp/ prefix. :-)
--
Eric Botcazou
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: ObjC/ObjC++: fixed 'too many arguments to method xxx' error
2010-09-12 22:05 ` Eric Botcazou
@ 2010-09-12 22:48 ` Nicola Pero
2010-09-14 13:03 ` [C++ Ping] " Nicola Pero
0 siblings, 1 reply; 15+ messages in thread
From: Nicola Pero @ 2010-09-12 22:48 UTC (permalink / raw)
To: Eric Botcazou; +Cc: gcc-patches, Joseph S. Myers
> 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;
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: ObjC/ObjC++: fixed 'too many arguments to method xxx' error
2010-09-12 8:25 ObjC/ObjC++: fixed 'too many arguments to method xxx' error Nicola Pero
2010-09-12 16:58 ` Joseph S. Myers
@ 2010-09-12 22:54 ` Mike Stump
2010-09-12 23:18 ` Nicola Pero
1 sibling, 1 reply; 15+ messages in thread
From: Mike Stump @ 2010-09-12 22:54 UTC (permalink / raw)
To: Nicola Pero; +Cc: gcc-patches
On Sep 11, 2010, at 9:09 PM, Nicola Pero wrote:
> I took the testcase (marked as Apple Radar 4491608) from the
>
> gcc.gnu.org/svn/gcc/branches/apple/trunk
In general, I'll pre-approve the gcc/objc subdirectory changes from that branch and the corresponding objc testsuite changes as well.
> OK to commit to trunk ?
The testsuite/objc.* changes are ok once the corresponding FE bits are approved.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: ObjC/ObjC++: fixed 'too many arguments to method xxx' error
2010-09-12 22:54 ` Mike Stump
@ 2010-09-12 23:18 ` Nicola Pero
2010-09-13 6:31 ` Mike Stump
0 siblings, 1 reply; 15+ messages in thread
From: Nicola Pero @ 2010-09-12 23:18 UTC (permalink / raw)
To: Mike Stump; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 582 bytes --]
>> I took the testcase (marked as Apple Radar 4491608) from the
>>
>> gcc.gnu.org/svn/gcc/branches/apple/trunk
>
> In general, I'll pre-approve the gcc/objc subdirectory changes from that branch and the corresponding objc testsuite changes as well.
Thanks
Here is a patch that merges 4 bug fixes from the apple/trunk branch. It only requires
changing objc/objc-act.c and all the bug fixes come with an associated testcase. It passes
all existing tests, plus the new ones, which would otherwise fail.
I guess Mike approved it so I can commit ? :-)
Thanks
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 9583 bytes --]
Index: gcc/objc/objc-act.c
===================================================================
--- gcc/objc/objc-act.c (revision 164235)
+++ gcc/objc/objc-act.c (working copy)
@@ -788,6 +788,13 @@ objc_start_method_definition (tree decl)
if (!objc_implementation_context)
fatal_error ("method definition not in @implementation context");
+#ifndef OBJCPLUS
+ /* Indicate no valid break/continue context by setting these variables
+ to some non-null, non-label value. We'll notice and emit the proper
+ error message in c_finish_bc_stmt. */
+ c_break_label = c_cont_label = size_zero_node;
+#endif
+
objc_add_method (objc_implementation_context,
decl,
objc_inherit_code == CLASS_METHOD_DECL);
@@ -1131,6 +1138,29 @@ objc_compare_types (tree ltyp, tree rtyp
}
while (POINTER_TYPE_P (ltyp) && POINTER_TYPE_P (rtyp));
+ /* We must also handle function pointers, since ObjC is a bit more
+ lenient than C or C++ on this. */
+ if (TREE_CODE (ltyp) == FUNCTION_TYPE && TREE_CODE (rtyp) == FUNCTION_TYPE)
+ {
+ /* Return types must be covariant. */
+ if (!comptypes (TREE_TYPE (ltyp), TREE_TYPE (rtyp))
+ && !objc_compare_types (TREE_TYPE (ltyp), TREE_TYPE (rtyp),
+ argno, callee))
+ return false;
+
+ /* Argument types must be contravariant. */
+ for (ltyp = TYPE_ARG_TYPES (ltyp), rtyp = TYPE_ARG_TYPES (rtyp);
+ ltyp && rtyp; ltyp = TREE_CHAIN (ltyp), rtyp = TREE_CHAIN (rtyp))
+ {
+ if (!comptypes (TREE_VALUE (rtyp), TREE_VALUE (ltyp))
+ && !objc_compare_types (TREE_VALUE (rtyp), TREE_VALUE (ltyp),
+ argno, callee))
+ return false;
+ }
+
+ return (ltyp == rtyp);
+ }
+
/* Past this point, we are only interested in ObjC class instances,
or 'id' or 'Class'. */
if (TREE_CODE (ltyp) != RECORD_TYPE || TREE_CODE (rtyp) != RECORD_TYPE)
@@ -1415,7 +1445,17 @@ objc_get_protocol_qualified_type (tree i
type = objc_is_class_name (interface);
if (type)
- type = xref_tag (RECORD_TYPE, type);
+ {
+ /* If looking at a typedef, retrieve the precise type it
+ describes. */
+ if (TREE_CODE (interface) == IDENTIFIER_NODE)
+ interface = identifier_global_value (interface);
+
+ type = ((interface && TREE_CODE (interface) == TYPE_DECL
+ && DECL_ORIGINAL_TYPE (interface))
+ ? DECL_ORIGINAL_TYPE (interface)
+ : xref_tag (RECORD_TYPE, type));
+ }
else
return interface;
}
@@ -6360,7 +6400,14 @@ objc_finish_message_expr (tree receiver,
more intelligent about which methods the receiver will
understand. */
if (!rtype || TREE_CODE (rtype) == IDENTIFIER_NODE)
- rtype = NULL_TREE;
+ {
+ rtype = NULL_TREE;
+ /* We could not find an @interface declaration, yet Message maybe in a
+ @class's protocol. */
+ if (!method_prototype && rprotos)
+ method_prototype
+ = lookup_method_in_protocol_list (rprotos, sel_name, 0);
+ }
else if (TREE_CODE (rtype) == CLASS_INTERFACE_TYPE
|| TREE_CODE (rtype) == CLASS_IMPLEMENTATION_TYPE)
{
Index: gcc/objc/ChangeLog
===================================================================
--- gcc/objc/ChangeLog (revision 164235)
+++ gcc/objc/ChangeLog (working copy)
@@ -1,3 +1,34 @@
+2010-09-12 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ Merge from 'apple/trunk' branch on FSF servers.
+
+ 2006-03-09 Fariborz Jahanian <fjahanian@apple.com>
+
+ Radar 4457381
+ * objc/objc-act.c (objc_finish_message_expr): Look for message in
+ @class's protocol list.
+
+ 2006-02-07 Fariborz Jahanian <fjahanian@apple.com>
+
+ Radar 4219590
+ * objc/objc-act.c (objc_start_method_definition): Initialize
+ break/continue labels.
+
+ 2005-08-22 Ziemowit Laski <zlaski@apple.com>
+
+ Radar 4174166
+ * objc-act.c (objc_compare_types): Compare function
+ pointers; indicate success if the right-hand side has
+ a return type that is covariant, and the argument types
+ contravariant, with those of the left side.
+
+ 2005-08-22 Ziemowit Laski <zlaski@apple.com>
+
+ Radar 4216500
+ * objc-act.c (objc_get_protocol_qualified_type): When looking
+ at a typedef, retrieve the precise type it describes (rather
+ than merely looking up a class by name).
+
2010-09-10 Nicola Pero <nicola.pero@meta-innovation.com>
* objc/objc-act.c (objc_begin_try_stmt): Generate an error if
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog (revision 164235)
+++ gcc/testsuite/ChangeLog (working copy)
@@ -1,3 +1,30 @@
+2010-09-12 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ Merge from 'apple/trunk' branch on FSF servers.
+
+ 2006-03-09 Fariborz Jahanian <fjahanian@apple.com>
+
+ Radar 4457381
+ * objc.dg/msg-in-protocol.m: New.
+ * obj-c++.dg/msg-in-protocol.mm: New.
+
+ 2006-02-07 Fariborz Jahanian <fjahanian@apple.com>
+
+ Radar 4219590
+ * objc.dg/break-in-ifstmt.m: New.
+
+ 2005-08-22 Ziemowit Laski <zlaski@apple.com>
+
+ Radar 4174166
+ * obj-c++.dg/comp-types-13.mm: New.
+ * objc.dg/comp-types-12.m: New.
+
+ 2005-08-22 Ziemowit Laski <zlaski@apple.com>
+
+ Radar 4216500
+ * obj-c++.dg/proto-lossage-7.mm: New.
+ * objc.dg/proto-lossage-7.m: New.
+
2010-09-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
* gfortran.dg/promotion.f90: Fix options.
Index: gcc/testsuite/objc.dg/proto-lossage-7.m
===================================================================
--- gcc/testsuite/objc.dg/proto-lossage-7.m (revision 0)
+++ gcc/testsuite/objc.dg/proto-lossage-7.m (revision 0)
@@ -0,0 +1,28 @@
+/* Check that typedefs of ObjC classes preserve
+ any @protocol qualifiers. */
+/* { dg-do compile } */
+#include <objc/Object.h>
+
+@protocol CanDoStuff;
+
+typedef Object<CanDoStuff> CanDoStuffType;
+typedef Object<CanDoStuff> *CanDoStuffTypePtr;
+
+@protocol CanDoStuff
+- (int) dostuff;
+@end
+
+@protocol MoreStuff
+- (int) morestuff;
+@end
+
+int main(void)
+{
+ CanDoStuffTypePtr dice = nil;
+ CanDoStuffType *nodice = nil;
+ int count;
+ count = [dice dostuff];
+ count = [nodice dostuff];
+ return 0;
+}
+
Index: gcc/testsuite/objc.dg/break-in-ifstmt.m
===================================================================
--- gcc/testsuite/objc.dg/break-in-ifstmt.m (revision 0)
+++ gcc/testsuite/objc.dg/break-in-ifstmt.m (revision 0)
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+@interface foo
+- (void) test;
+@end
+
+@implementation foo
+-(void) test {
+ if (1) {
+ break; /* { dg-error "break" } */
+ }
+}
+@end
+
Index: gcc/testsuite/objc.dg/comp-types-12.m
===================================================================
--- gcc/testsuite/objc.dg/comp-types-12.m (revision 0)
+++ gcc/testsuite/objc.dg/comp-types-12.m (revision 0)
@@ -0,0 +1,19 @@
+/* When assigning function pointers, allow for covariant return types
+ and contravariant argument types. */
+/* { dg-do compile } */
+#include <objc/Object.h>
+
+@class Derived;
+
+Object *ExternFunc (Object *filePath, Object *key);
+typedef id FuncSignature (Object *arg1, Derived *arg2);
+
+@interface Derived: Object
++ (void)registerFunc:(FuncSignature *)function;
+@end
+
+void foo(void)
+{
+ [Derived registerFunc: ExternFunc];
+}
+
Index: gcc/testsuite/objc.dg/msg-in-protocol.m
===================================================================
--- gcc/testsuite/objc.dg/msg-in-protocol.m (revision 0)
+++ gcc/testsuite/objc.dg/msg-in-protocol.m (revision 0)
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+#include <objc/objc.h>
+
+@class Foo;
+
+@protocol Bar
+
+- (void)bang;
+
+@end
+
+void foo()
+{
+ Foo<Bar> *foo = nil;
+ [foo bang];
+}
+
Index: gcc/testsuite/obj-c++.dg/comp-types-13.mm
===================================================================
--- gcc/testsuite/obj-c++.dg/comp-types-13.mm (revision 0)
+++ gcc/testsuite/obj-c++.dg/comp-types-13.mm (revision 0)
@@ -0,0 +1,19 @@
+/* When assigning function pointers, allow for covariant return types
+ and contravariant argument types. */
+/* { dg-do compile } */
+#include <objc/Object.h>
+
+@class Derived;
+
+Object *ExternFunc (Object *filePath, Object *key);
+typedef id FuncSignature (Object *arg1, Derived *arg2);
+
+@interface Derived: Object
++ (void)registerFunc:(FuncSignature *)function;
+@end
+
+void foo(void)
+{
+ [Derived registerFunc: ExternFunc];
+}
+
Index: gcc/testsuite/obj-c++.dg/proto-lossage-7.mm
===================================================================
--- gcc/testsuite/obj-c++.dg/proto-lossage-7.mm (revision 0)
+++ gcc/testsuite/obj-c++.dg/proto-lossage-7.mm (revision 0)
@@ -0,0 +1,28 @@
+/* Check that typedefs of ObjC classes preserve
+ any @protocol qualifiers. */
+/* { dg-do compile } */
+#include <objc/Object.h>
+
+@protocol CanDoStuff;
+
+typedef Object<CanDoStuff> CanDoStuffType;
+typedef Object<CanDoStuff> *CanDoStuffTypePtr;
+
+@protocol CanDoStuff
+- (int) dostuff;
+@end
+
+@protocol MoreStuff
+- (int) morestuff;
+@end
+
+int main(void)
+{
+ CanDoStuffTypePtr dice = nil;
+ CanDoStuffType *nodice = nil;
+ int count;
+ count = [dice dostuff];
+ count = [nodice dostuff];
+ return 0;
+}
+
Index: gcc/testsuite/obj-c++.dg/msg-in-protocol.mm
===================================================================
--- gcc/testsuite/obj-c++.dg/msg-in-protocol.mm (revision 0)
+++ gcc/testsuite/obj-c++.dg/msg-in-protocol.mm (revision 0)
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+#include <objc/objc.h>
+
+@class Foo;
+
+@protocol Bar
+
+- (void)bang;
+
+@end
+
+void foo()
+{
+ Foo<Bar> *foo = nil;
+ [foo bang];
+}
+
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: ObjC/ObjC++: fixed 'too many arguments to method xxx' error
2010-09-12 23:18 ` Nicola Pero
@ 2010-09-13 6:31 ` Mike Stump
2010-09-15 5:53 ` Nicola Pero
0 siblings, 1 reply; 15+ messages in thread
From: Mike Stump @ 2010-09-13 6:31 UTC (permalink / raw)
To: Nicola Pero; +Cc: gcc-patches
On Sep 12, 2010, at 3:00 PM, Nicola Pero wrote:
> Here is a patch that merges 4 bug fixes from the apple/trunk branch. It only requires
> changing objc/objc-act.c and all the bug fixes come with an associated testcase. It passes
> all existing tests, plus the new ones, which would otherwise fail.
>
> I guess Mike approved it so I can commit ? :-)
Yes, looks fine.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [C++ Ping] Re: ObjC/ObjC++: fixed 'too many arguments to method xxx' error
2010-09-12 22:48 ` Nicola Pero
@ 2010-09-14 13:03 ` Nicola Pero
2010-09-28 22:02 ` Mike Stump
0 siblings, 1 reply; 15+ messages in thread
From: Nicola Pero @ 2010-09-14 13:03 UTC (permalink / raw)
To: gcc-patches
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" <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;
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: ObjC/ObjC++: fixed 'too many arguments to method xxx' error
2010-09-13 6:31 ` Mike Stump
@ 2010-09-15 5:53 ` Nicola Pero
0 siblings, 0 replies; 15+ messages in thread
From: Nicola Pero @ 2010-09-15 5:53 UTC (permalink / raw)
To: Mike Stump; +Cc: gcc-patches
Thanks, committed
-----Original Message-----
From: "Mike Stump" <mikestump@comcast.net>
Sent: Monday, 13 September, 2010 00:47
To: "Nicola Pero" <nicola.pero@meta-innovation.com>
Cc: gcc-patches@gnu.org
Subject: Re: ObjC/ObjC++: fixed 'too many arguments to method xxx' error
On Sep 12, 2010, at 3:00 PM, Nicola Pero wrote:
> Here is a patch that merges 4 bug fixes from the apple/trunk branch. It only requires
> changing objc/objc-act.c and all the bug fixes come with an associated testcase. It passes
> all existing tests, plus the new ones, which would otherwise fail.
>
> I guess Mike approved it so I can commit ? :-)
Yes, looks fine.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [C++ Ping] Re: ObjC/ObjC++: fixed 'too many arguments to method xxx' error
2010-09-14 13:03 ` [C++ Ping] " Nicola Pero
@ 2010-09-28 22:02 ` Mike Stump
0 siblings, 0 replies; 15+ messages in thread
From: Mike Stump @ 2010-09-28 22:02 UTC (permalink / raw)
To: Nicola Pero; +Cc: gcc-patches
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;
>
>
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2010-09-28 17:32 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-12 8:25 ObjC/ObjC++: fixed 'too many arguments to method xxx' error Nicola Pero
2010-09-12 16:58 ` Joseph S. Myers
2010-09-12 17:34 ` Nicola Pero
2010-09-12 19:03 ` Eric Botcazou
2010-09-12 19:39 ` Eric Botcazou
2010-09-12 22:00 ` Nicola Pero
2010-09-12 22:05 ` Eric Botcazou
2010-09-12 22:48 ` Nicola Pero
2010-09-14 13:03 ` [C++ Ping] " Nicola Pero
2010-09-28 22:02 ` Mike Stump
2010-09-12 19:59 ` Joseph S. Myers
2010-09-12 22:54 ` Mike Stump
2010-09-12 23:18 ` Nicola Pero
2010-09-13 6:31 ` Mike Stump
2010-09-15 5:53 ` Nicola Pero
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).