OSDN Git Service

In gcc/:
authornicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Sep 2010 22:21:39 +0000 (22:21 +0000)
committernicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Sep 2010 22:21:39 +0000 (22:21 +0000)
        * 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).
In gcc/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).
In gcc/testsuite/:
        * obj-c++.dg/too-many-args.mm: New file.
        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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164573 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-typeck.c
gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/obj-c++.dg/too-many-args.mm [new file with mode: 0644]
gcc/testsuite/objc.dg/too-many-args.m [new file with mode: 0644]

index 01019ce..d23732f 100644 (file)
@@ -1,3 +1,10 @@
+2010-09-24  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-23  Eric Botcazou  <ebotcazou@adacore.com>
 
        * tree-flow.h (execute_update_addresses_taken): Remove parameter.
index 7ac866a..065e9b8 100644 (file)
@@ -2897,8 +2897,13 @@ convert_arguments (tree typelist, VEC(tree,gc) *values,
 
       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 3994a3a..95613b0 100644 (file)
@@ -1,3 +1,10 @@
+2010-09-24  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-21  Jason Merrill  <jason@redhat.com>
 
        * mangle.c (write_expression) [SCOPE_REF]: Only do -fabi-version=1
index 0ac95d0..019c51e 100644 (file)
@@ -3428,8 +3428,17 @@ warn_args_num (location_t loc, tree fndecl, bool too_many_p)
              "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 3773f07..649c269 100644 (file)
@@ -1,3 +1,16 @@
+2010-09-24  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       * obj-c++.dg/too-many-args.mm: New file.
+
+2010-09-24  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-23  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/45744
diff --git a/gcc/testsuite/obj-c++.dg/too-many-args.mm b/gcc/testsuite/obj-c++.dg/too-many-args.mm
new file mode 100644 (file)
index 0000000..6fee1b3
--- /dev/null
@@ -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;
+}
diff --git a/gcc/testsuite/objc.dg/too-many-args.m b/gcc/testsuite/objc.dg/too-many-args.m
new file mode 100644 (file)
index 0000000..6fee1b3
--- /dev/null
@@ -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;
+}