/* 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);
}
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;
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. */
{
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