aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Ayers <ayers@fsfe.org>2009-04-09 21:08:18 +0000
committerDavid Ayers <ayers@gcc.gnu.org>2009-04-09 21:08:18 +0000
commit52daca759f7b5871df15ae7f92e7cf3f502d94b8 (patch)
tree6bdcf7364e0618f7bfed1b258e7f8d487a35fdbf
parent7a715bba70b4a1c282201df8b8fc9ef418021b47 (diff)
downloadgcc-52daca759f7b5871df15ae7f92e7cf3f502d94b8.zip
gcc-52daca759f7b5871df15ae7f92e7cf3f502d94b8.tar.gz
gcc-52daca759f7b5871df15ae7f92e7cf3f502d94b8.tar.bz2
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
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/objc/objc-act.c66
2 files changed, 45 insertions, 28 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f2e861c..5e51f85 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 81d63b2..50e99d6 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -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