gcc/
authorayers <ayers@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Apr 2009 21:08:18 +0000 (21:08 +0000)
committerayers <ayers@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Apr 2009 21:08:18 +0000 (21:08 +0000)
2009-04-09  David Ayers  <ayers@fsfe.org>

PR objc/29200
* objc/objc-act.c (warn_with_method): Remove helper function.
(check_duplicates): Call warning and inform directly.
(really_start_method): Likewise.

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

gcc/ChangeLog
gcc/objc/objc-act.c

index f2e861c..5e51f85 100644 (file)
@@ -1,3 +1,10 @@
+2009-04-09  David Ayers  <ayers@fsfe.org>
+
+       PR objc/29200
+       * objc/objc-act.c (warn_with_method): Remove helper function.
+       (check_duplicates): Call warning and inform directly.
+       (really_start_method): Likewise.
+
 2009-04-09  Paolo Bonzini  <bonzini@gnu.org>
 
        * expmed.c (expand_divmod): Always use a comparison for a division
index 81d63b2..50e99d6 100644 (file)
@@ -243,7 +243,6 @@ static struct c_arg_info *objc_get_parm_info (int);
 
 /* Utilities for debugging and error diagnostics.  */
 
-static void warn_with_method (const char *, int, tree);
 static char *gen_type_name (tree);
 static char *gen_type_name_0 (tree);
 static char *gen_method_decl (tree);
@@ -6103,22 +6102,37 @@ check_duplicates (hash hsh, int methods, int is_class)
            }
 
        issue_warning:
-         warning (0, "multiple %s named %<%c%s%> found",
-                  methods ? "methods" : "selectors",
-                  (is_class ? '+' : '-'),
-                  IDENTIFIER_POINTER (METHOD_SEL_NAME (meth)));
-
-         warn_with_method (methods ? "using" : "found",
-                           ((TREE_CODE (meth) == INSTANCE_METHOD_DECL)
-                            ? '-'
-                            : '+'),
-                           meth);
+         if (methods)
+           {
+             bool type = TREE_CODE (meth) == INSTANCE_METHOD_DECL;
+
+             warning (0, "multiple methods named %<%c%s%> found",
+                      (is_class ? '+' : '-'),
+                      IDENTIFIER_POINTER (METHOD_SEL_NAME (meth)));
+             inform (0, "%Jusing %<%c%s%>", meth,
+                     (type ? '-' : '+'),
+                     gen_method_decl (meth));
+           }
+         else
+           {
+             bool type = TREE_CODE (meth) == INSTANCE_METHOD_DECL;
+
+             warning (0, "multiple selectors named %<%c%s%> found",
+                      (is_class ? '+' : '-'),
+                      IDENTIFIER_POINTER (METHOD_SEL_NAME (meth)));
+             inform (0, "%Jfound %<%c%s%>", meth,
+                     (type ? '-' : '+'),
+                     gen_method_decl (meth));
+           }
+
          for (loop = hsh->list; loop; loop = loop->next)
-           warn_with_method ("also found",
-                             ((TREE_CODE (loop->value) == INSTANCE_METHOD_DECL)
-                              ? '-'
-                              : '+'),
-                             loop->value);
+           {
+             bool type = TREE_CODE (loop->value) == INSTANCE_METHOD_DECL;
+
+             inform (0, "%Jalso found %<%c%s%>", loop->value, 
+                     (type ? '-' : '+'),
+                     gen_method_decl (loop->value));
+           }
         }
     }
   return meth;
@@ -8427,14 +8441,6 @@ start_method_def (tree method)
   really_start_method (objc_method_context, parm_info);
 }
 
-static void
-warn_with_method (const char *message, int mtype, tree method)
-{
-  /* Add a readable method name to the warning.  */
-  warning (0, "%J%s %<%c%s%>", method,
-           message, mtype, gen_method_decl (method));
-}
-
 /* Return 1 if TYPE1 is equivalent to TYPE2
    for purposes of method overloading.  */
 
@@ -8677,10 +8683,14 @@ really_start_method (tree method,
        {
          if (!comp_proto_with_proto (method, proto, 1))
            {
-             char type = (TREE_CODE (method) == INSTANCE_METHOD_DECL ? '-' : '+');
-
-             warn_with_method ("conflicting types for", type, method);
-             warn_with_method ("previous declaration of", type, proto);
+             bool type = TREE_CODE (method) == INSTANCE_METHOD_DECL;
+
+             warning (0, "%Jconflicting types for %<%c%s%>", method,
+                      (type ? '-' : '+'),
+                      gen_method_decl (method));
+             inform (0, "%Jprevious declaration of %<%c%s%>", proto,
+                     (type ? '-' : '+'),
+                     gen_method_decl (proto));
            }
        }
       else