Commit 52daca75 by David Ayers Committed by David Ayers

re PR objc/29200 (%s substituted with "methods"/"selectors" can't be properly translated)

gcc/
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.

From-SVN: r145857
parent 7a715bba
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> 2009-04-09 Paolo Bonzini <bonzini@gnu.org>
* expmed.c (expand_divmod): Always use a comparison for a division * expmed.c (expand_divmod): Always use a comparison for a division
......
...@@ -243,7 +243,6 @@ static struct c_arg_info *objc_get_parm_info (int); ...@@ -243,7 +243,6 @@ static struct c_arg_info *objc_get_parm_info (int);
/* Utilities for debugging and error diagnostics. */ /* 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 (tree);
static char *gen_type_name_0 (tree); static char *gen_type_name_0 (tree);
static char *gen_method_decl (tree); static char *gen_method_decl (tree);
...@@ -6103,22 +6102,37 @@ check_duplicates (hash hsh, int methods, int is_class) ...@@ -6103,22 +6102,37 @@ check_duplicates (hash hsh, int methods, int is_class)
} }
issue_warning: issue_warning:
warning (0, "multiple %s named %<%c%s%> found", if (methods)
methods ? "methods" : "selectors", {
(is_class ? '+' : '-'), bool type = TREE_CODE (meth) == INSTANCE_METHOD_DECL;
IDENTIFIER_POINTER (METHOD_SEL_NAME (meth)));
warning (0, "multiple methods named %<%c%s%> found",
warn_with_method (methods ? "using" : "found", (is_class ? '+' : '-'),
((TREE_CODE (meth) == INSTANCE_METHOD_DECL) IDENTIFIER_POINTER (METHOD_SEL_NAME (meth)));
? '-' inform (0, "%Jusing %<%c%s%>", meth,
: '+'), (type ? '-' : '+'),
meth); 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) for (loop = hsh->list; loop; loop = loop->next)
warn_with_method ("also found", {
((TREE_CODE (loop->value) == INSTANCE_METHOD_DECL) bool type = TREE_CODE (loop->value) == INSTANCE_METHOD_DECL;
? '-'
: '+'), inform (0, "%Jalso found %<%c%s%>", loop->value,
loop->value); (type ? '-' : '+'),
gen_method_decl (loop->value));
}
} }
} }
return meth; return meth;
...@@ -8427,14 +8441,6 @@ start_method_def (tree method) ...@@ -8427,14 +8441,6 @@ start_method_def (tree method)
really_start_method (objc_method_context, parm_info); 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 /* Return 1 if TYPE1 is equivalent to TYPE2
for purposes of method overloading. */ for purposes of method overloading. */
...@@ -8677,10 +8683,14 @@ really_start_method (tree method, ...@@ -8677,10 +8683,14 @@ really_start_method (tree method,
{ {
if (!comp_proto_with_proto (method, proto, 1)) if (!comp_proto_with_proto (method, proto, 1))
{ {
char type = (TREE_CODE (method) == INSTANCE_METHOD_DECL ? '-' : '+'); bool type = TREE_CODE (method) == INSTANCE_METHOD_DECL;
warn_with_method ("conflicting types for", type, method); warning (0, "%Jconflicting types for %<%c%s%>", method,
warn_with_method ("previous declaration of", type, proto); (type ? '-' : '+'),
gen_method_decl (method));
inform (0, "%Jprevious declaration of %<%c%s%>", proto,
(type ? '-' : '+'),
gen_method_decl (proto));
} }
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment