aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog19
-rw-r--r--gcc/c-common.c10
-rw-r--r--gcc/c-decl.c266
-rw-r--r--gcc/c-format.c7
-rw-r--r--gcc/c-objc-common.c20
-rw-r--r--gcc/c-pragma.c4
-rw-r--r--gcc/config/arm/pe.c4
-rw-r--r--gcc/config/i386/winnt.c26
-rw-r--r--gcc/config/ia64/ia64.c8
-rw-r--r--gcc/config/mcore/mcore.c2
-rw-r--r--gcc/config/sh/symbian.c29
-rw-r--r--gcc/config/sol2.c4
-rw-r--r--gcc/config/v850/v850.c6
-rw-r--r--gcc/cp/ChangeLog11
-rw-r--r--gcc/cp/call.c10
-rw-r--r--gcc/cp/class.c108
-rw-r--r--gcc/cp/cp-tree.h4
-rw-r--r--gcc/cp/decl.c134
-rw-r--r--gcc/cp/decl2.c23
-rw-r--r--gcc/cp/error.c125
-rw-r--r--gcc/cp/friend.c4
-rw-r--r--gcc/cp/init.c6
-rw-r--r--gcc/cp/name-lookup.c30
-rw-r--r--gcc/cp/parser.c2
-rw-r--r--gcc/cp/pt.c44
-rw-r--r--gcc/cp/search.c21
-rw-r--r--gcc/cp/semantics.c9
-rw-r--r--gcc/cp/typeck.c18
-rw-r--r--gcc/cp/typeck2.c67
-rw-r--r--gcc/function.c12
-rw-r--r--gcc/java/ChangeLog5
-rw-r--r--gcc/java/class.c4
-rw-r--r--gcc/java/decl.c14
-rw-r--r--gcc/java/expr.c12
-rw-r--r--gcc/objc/ChangeLog5
-rw-r--r--gcc/objc/objc-act.c12
-rw-r--r--gcc/stor-layout.c16
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/format/gcc_diag-1.c7
-rw-r--r--gcc/toplev.c15
-rw-r--r--gcc/tree-inline.c28
-rw-r--r--gcc/tree-optimize.c8
-rw-r--r--gcc/tree.c10
-rw-r--r--gcc/varasm.c50
44 files changed, 551 insertions, 672 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 10a8536..1d39529 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,22 @@
+2005-07-02 Zack Weinberg <zack@codesourcery.com>
+ Joseph S. Myers <joseph@codesourcery.com>
+
+ * toplev.c (default_tree_printer): Handle setting location with
+ '+' flag.
+ * c-objc.common.c (c_tree_printer): Likewise.
+ * c-format.c (gcc_diag_flag_specs): Add '+'.
+ (gcc_cdiag_char_table): Allow '+' flag for tree formats.
+ (format_types_orig): Allow '+' flag for gcc_diag and gcc_cdiag
+ formats.
+ * c-common.c, c-decl.c, c-objc-common.c, c-pragma.c,
+ config/arm/pe.c, config/i386/winnt.c, config/ia64/ia64.c,
+ config/mcore/mcore.c, config/sh/symbian.c, config/sol2.c,
+ config/v850/v850.c, function.c, stor-layout.c, toplev.c,
+ tree-inline.c, tree-optimize.c, tree.c, varasm.c: Use '+' flag
+ instead of %J or %H. Use 'q' flag for quoting. Avoid '.' at end
+ of diagnostics. Use %q+D not %s for a decl. Do not pass excess
+ format arguments where %J is used without %D.
+
2005-07-02 Jakub Jelinek <jakub@redhat.com>
* gcc.c (LINK_SSP_SPEC): Define.
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 997fc71..f3d4a28 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -4559,8 +4559,8 @@ handle_section_attribute (tree *node, tree ARG_UNUSED (name), tree args,
&& strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)),
TREE_STRING_POINTER (TREE_VALUE (args))) != 0)
{
- error ("%Jsection of %qD conflicts with previous declaration",
- *node, *node);
+ error ("section of %q+D conflicts with previous declaration",
+ *node);
*no_add_attrs = true;
}
else
@@ -4568,7 +4568,7 @@ handle_section_attribute (tree *node, tree ARG_UNUSED (name), tree args,
}
else
{
- error ("%Jsection attribute not allowed for %qD", *node, *node);
+ error ("section attribute not allowed for %q+D", *node);
*no_add_attrs = true;
}
}
@@ -4642,7 +4642,7 @@ handle_aligned_attribute (tree *node, tree ARG_UNUSED (name), tree args,
else if (TREE_CODE (decl) != VAR_DECL
&& TREE_CODE (decl) != FIELD_DECL)
{
- error ("%Jalignment may not be specified for %qD", decl, decl);
+ error ("alignment may not be specified for %q+D", decl);
*no_add_attrs = true;
}
else
@@ -4680,7 +4680,7 @@ handle_alias_attribute (tree *node, tree name, tree args,
if ((TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl))
|| (TREE_CODE (decl) != FUNCTION_DECL && !DECL_EXTERNAL (decl)))
{
- error ("%J%qD defined both normally and as an alias", decl, decl);
+ error ("%q+D defined both normally and as an alias", decl);
*no_add_attrs = true;
}
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 667a28a..04d095c 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -560,7 +560,7 @@ c_finish_incomplete_decl (tree decl)
&& !DECL_EXTERNAL (decl)
&& TYPE_DOMAIN (type) == 0)
{
- warning (0, "%Jarray %qD assumed to have one element", decl, decl);
+ warning (0, "array %q+D assumed to have one element", decl);
complete_array_type (&TREE_TYPE (decl), NULL_TREE, true);
@@ -751,15 +751,15 @@ pop_scope (void)
/* Warnings for unused labels, errors for undefined labels. */
if (TREE_USED (p) && !DECL_INITIAL (p))
{
- error ("%Jlabel %qD used but not defined", p, p);
+ error ("label %q+D used but not defined", p);
DECL_INITIAL (p) = error_mark_node;
}
else if (!TREE_USED (p) && warn_unused_label)
{
if (DECL_INITIAL (p))
- warning (0, "%Jlabel %qD defined but not used", p, p);
+ warning (0, "label %q+D defined but not used", p);
else
- warning (0, "%Jlabel %qD declared but not defined", p, p);
+ warning (0, "label %q+D declared but not defined", p);
}
/* Labels go in BLOCK_VARS. */
TREE_CHAIN (p) = BLOCK_VARS (block);
@@ -794,7 +794,7 @@ pop_scope (void)
if (!DECL_EXTERNAL (p)
&& DECL_INITIAL (p) == 0)
{
- error ("%Jnested function %qD declared but never defined", p, p);
+ error ("nested function %q+D declared but never defined", p);
undef_nested_function = true;
}
goto common_symbol;
@@ -807,12 +807,12 @@ pop_scope (void)
&& !DECL_ARTIFICIAL (p)
&& scope != file_scope
&& scope != external_scope)
- warning (OPT_Wunused_variable, "%Junused variable %qD", p, p);
+ warning (OPT_Wunused_variable, "unused variable %q+D", p);
if (b->inner_comp)
{
- error ("%Jtype of array %qD completed incompatibly with"
- " implicit initialization", p, p);
+ error ("type of array %q+D completed incompatibly with"
+ " implicit initialization", p);
}
/* Fall through. */
@@ -1087,14 +1087,14 @@ validate_proto_after_old_defn (tree newdecl, tree newtype, tree oldtype)
agree on the number of arguments. */
if (END_OF_ARGLIST (oldargtype))
{
- error ("%Jprototype for %qD declares more arguments "
- "than previous old-style definition", newdecl, newdecl);
+ error ("prototype for %q+D declares more arguments "
+ "than previous old-style definition", newdecl);
return false;
}
else if (END_OF_ARGLIST (newargtype))
{
- error ("%Jprototype for %qD declares fewer arguments "
- "than previous old-style definition", newdecl, newdecl);
+ error ("prototype for %q+D declares fewer arguments "
+ "than previous old-style definition", newdecl);
return false;
}
@@ -1102,9 +1102,9 @@ validate_proto_after_old_defn (tree newdecl, tree newtype, tree oldtype)
for the arg. */
else if (!comptypes (oldargtype, newargtype))
{
- error ("%Jprototype for %qD declares argument %d"
+ error ("prototype for %q+D declares argument %d"
" with incompatible type",
- newdecl, newdecl, i);
+ newdecl, i);
return false;
}
@@ -1115,8 +1115,8 @@ validate_proto_after_old_defn (tree newdecl, tree newtype, tree oldtype)
/* If we get here, no errors were found, but do issue a warning
for this poor-style construct. */
- warning (0, "%Jprototype for %qD follows non-prototype definition",
- newdecl, newdecl);
+ warning (0, "prototype for %q+D follows non-prototype definition",
+ newdecl);
return true;
#undef END_OF_ARGLIST
}
@@ -1130,11 +1130,11 @@ locate_old_decl (tree decl, void (*diag)(const char *, ...) ATTRIBUTE_GCC_CDIAG(
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl))
;
else if (DECL_INITIAL (decl))
- diag (G_("%Jprevious definition of %qD was here"), decl, decl);
+ diag (G_("previous definition of %q+D was here"), decl);
else if (C_DECL_IMPLICIT (decl))
- diag (G_("%Jprevious implicit declaration of %qD was here"), decl, decl);
+ diag (G_("previous implicit declaration of %q+D was here"), decl);
else
- diag (G_("%Jprevious declaration of %qD was here"), decl, decl);
+ diag (G_("previous declaration of %q+D was here"), decl);
}
/* Subroutine of duplicate_decls. Compare NEWDECL to OLDDECL.
@@ -1174,16 +1174,15 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& DECL_BUILT_IN (olddecl)
&& !C_DECL_DECLARED_BUILTIN (olddecl)))
{
- error ("%J%qD redeclared as different kind of symbol",
- newdecl, newdecl);
+ error ("%q+D redeclared as different kind of symbol", newdecl);
locate_old_decl (olddecl, error);
}
else if (TREE_PUBLIC (newdecl))
- warning (0, "%Jbuilt-in function %qD declared as non-function",
- newdecl, newdecl);
+ warning (0, "built-in function %q+D declared as non-function",
+ newdecl);
else
- warning (OPT_Wshadow, "%Jdeclaration of %qD shadows "
- "a built-in function", newdecl, newdecl);
+ warning (OPT_Wshadow, "declaration of %q+D shadows "
+ "a built-in function", newdecl);
return false;
}
@@ -1191,7 +1190,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
given scope. */
if (TREE_CODE (olddecl) == CONST_DECL)
{
- error ("%Jredeclaration of enumerator %qD", newdecl, newdecl);
+ error ("redeclaration of enumerator %q+D", newdecl);
locate_old_decl (olddecl, error);
return false;
}
@@ -1212,8 +1211,8 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
/* If types don't match for a built-in, throw away the
built-in. No point in calling locate_old_decl here, it
won't print anything. */
- warning (0, "%Jconflicting types for built-in function %qD",
- newdecl, newdecl);
+ warning (0, "conflicting types for built-in function %q+D",
+ newdecl);
return false;
}
}
@@ -1236,7 +1235,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& TYPE_MAIN_VARIANT (TREE_TYPE (newtype)) == integer_type_node
&& C_FUNCTION_IMPLICIT_INT (newdecl) && !DECL_INITIAL (olddecl))
{
- pedwarn ("%Jconflicting types for %qD", newdecl, newdecl);
+ pedwarn ("conflicting types for %q+D", newdecl);
/* Make sure we keep void as the return type. */
TREE_TYPE (newdecl) = *newtypep = newtype = oldtype;
C_FUNCTION_IMPLICIT_INT (newdecl) = 0;
@@ -1249,7 +1248,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& TYPE_MAIN_VARIANT (TREE_TYPE (oldtype)) == integer_type_node
&& C_DECL_IMPLICIT (olddecl) && !DECL_INITIAL (olddecl))
{
- pedwarn ("%Jconflicting types for %qD", newdecl, newdecl);
+ pedwarn ("conflicting types for %q+D", newdecl);
/* Make sure we keep void as the return type. */
TREE_TYPE (olddecl) = *oldtypep = oldtype = newtype;
pedwarned = true;
@@ -1257,9 +1256,9 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
else
{
if (TYPE_QUALS (newtype) != TYPE_QUALS (oldtype))
- error ("%J conflicting type qualifiers for %qD", newdecl, newdecl);
+ error ("conflicting type qualifiers for %q+D", newdecl);
else
- error ("%Jconflicting types for %qD", newdecl, newdecl);
+ error ("conflicting types for %q+D", newdecl);
diagnose_arglist_conflict (newdecl, olddecl, newtype, oldtype);
locate_old_decl (olddecl, error);
return false;
@@ -1274,7 +1273,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
if (DECL_IN_SYSTEM_HEADER (newdecl) || DECL_IN_SYSTEM_HEADER (olddecl))
return true; /* Allow OLDDECL to continue in use. */
- error ("%Jredefinition of typedef %qD", newdecl, newdecl);
+ error ("redefinition of typedef %q+D", newdecl);
locate_old_decl (olddecl, error);
return false;
}
@@ -1298,8 +1297,8 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
|| (DECL_INITIAL (newdecl)
&& !TYPE_ARG_TYPES (TREE_TYPE (newdecl)))))
{
- warning (OPT_Wshadow, "%Jdeclaration of %qD shadows "
- "a built-in function", newdecl, newdecl);
+ warning (OPT_Wshadow, "declaration of %q+D shadows "
+ "a built-in function", newdecl);
/* Discard the old built-in function. */
return false;
}
@@ -1322,7 +1321,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& !DECL_EXTERN_INLINE (newdecl))
&& same_translation_unit_p (newdecl, olddecl))
{
- error ("%Jredefinition of %qD", newdecl, newdecl);
+ error ("redefinition of %q+D", newdecl);
locate_old_decl (olddecl, error);
return false;
}
@@ -1357,8 +1356,8 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
if (!DECL_IS_BUILTIN (olddecl)
&& !DECL_EXTERN_INLINE (olddecl))
{
- error ("%Jstatic declaration of %qD follows "
- "non-static declaration", newdecl, newdecl);
+ error ("static declaration of %q+D follows "
+ "non-static declaration", newdecl);
locate_old_decl (olddecl, error);
}
return false;
@@ -1367,15 +1366,15 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
{
if (DECL_CONTEXT (olddecl))
{
- error ("%Jnon-static declaration of %qD follows "
- "static declaration", newdecl, newdecl);
+ error ("non-static declaration of %q+D follows "
+ "static declaration", newdecl);
locate_old_decl (olddecl, error);
return false;
}
else if (warn_traditional)
{
- warning (OPT_Wtraditional, "%Jnon-static declaration of %qD "
- "follows static declaration", newdecl, newdecl);
+ warning (OPT_Wtraditional, "non-static declaration of %q+D "
+ "follows static declaration", newdecl);
warned = true;
}
}
@@ -1387,11 +1386,11 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
if (DECL_THREAD_LOCAL_P (newdecl) != DECL_THREAD_LOCAL_P (olddecl))
{
if (DECL_THREAD_LOCAL_P (newdecl))
- error ("%Jthread-local declaration of %qD follows "
- "non-thread-local declaration", newdecl, newdecl);
+ error ("thread-local declaration of %q+D follows "
+ "non-thread-local declaration", newdecl);
else
- error ("%Jnon-thread-local declaration of %qD follows "
- "thread-local declaration", newdecl, newdecl);
+ error ("non-thread-local declaration of %q+D follows "
+ "thread-local declaration", newdecl);
locate_old_decl (olddecl, error);
return false;
@@ -1400,7 +1399,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
/* Multiple initialized definitions are not allowed (6.9p3,5). */
if (DECL_INITIAL (newdecl) && DECL_INITIAL (olddecl))
{
- error ("%Jredefinition of %qD", newdecl, newdecl);
+ error ("redefinition of %q+D", newdecl);
locate_old_decl (olddecl, error);
return false;
}
@@ -1420,26 +1419,26 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
{
if (!DECL_FILE_SCOPE_P (olddecl))
{
- error ("%Jextern declaration of %qD follows "
- "declaration with no linkage", newdecl, newdecl);
+ error ("extern declaration of %q+D follows "
+ "declaration with no linkage", newdecl);
locate_old_decl (olddecl, error);
return false;
}
else if (warn_traditional)
{
- warning (OPT_Wtraditional, "%Jnon-static declaration of %qD "
- "follows static declaration", newdecl, newdecl);
+ warning (OPT_Wtraditional, "non-static declaration of %q+D "
+ "follows static declaration", newdecl);
warned = true;
}
}
else
{
if (TREE_PUBLIC (newdecl))
- error ("%Jnon-static declaration of %qD follows "
- "static declaration", newdecl, newdecl);
+ error ("non-static declaration of %q+D follows "
+ "static declaration", newdecl);
else
- error ("%Jstatic declaration of %qD follows "
- "non-static declaration", newdecl, newdecl);
+ error ("static declaration of %q+D follows "
+ "non-static declaration", newdecl);
locate_old_decl (olddecl, error);
return false;
@@ -1456,14 +1455,13 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
}
else if (DECL_EXTERNAL (olddecl))
{
- error ("%Jdeclaration of %qD with no linkage follows "
- "extern declaration", newdecl, newdecl);
+ error ("declaration of %q+D with no linkage follows "
+ "extern declaration", newdecl);
locate_old_decl (olddecl, error);
}
else
{
- error ("%Jredeclaration of %qD with no linkage",
- newdecl, newdecl);
+ error ("redeclaration of %q+D with no linkage", newdecl);
locate_old_decl (olddecl, error);
}
@@ -1476,8 +1474,8 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
if (DECL_VISIBILITY_SPECIFIED (newdecl) && DECL_VISIBILITY_SPECIFIED (olddecl)
&& DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
{
- warning (0, "%Jredeclaration of %qD with different visibility "
- "(old visibility preserved)", newdecl, newdecl);
+ warning (0, "redeclaration of %q+D with different visibility "
+ "(old visibility preserved)", newdecl);
warned = true;
}
@@ -1487,15 +1485,15 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
if (DECL_DECLARED_INLINE_P (newdecl)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl)))
{
- warning (OPT_Wattributes, "%Jinline declaration of %qD follows "
- "declaration with attribute noinline", newdecl, newdecl);
+ warning (OPT_Wattributes, "inline declaration of %qD follows "
+ "declaration with attribute noinline", newdecl);
warned = true;
}
else if (DECL_DECLARED_INLINE_P (olddecl)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl)))
{
- warning (OPT_Wattributes, "%Jdeclaration of %qD with attribute "
- "noinline follows inline declaration ", newdecl, newdecl);
+ warning (OPT_Wattributes, "declaration of %q+D with attribute "
+ "noinline follows inline declaration ", newdecl);
warned = true;
}
@@ -1509,14 +1507,12 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
{
if (TREE_USED (olddecl))
{
- warning (0, "%J%qD declared inline after being called",
- olddecl, olddecl);
+ warning (0, "%q+D declared inline after being called", olddecl);
warned = true;
}
else if (DECL_INITIAL (olddecl))
{
- warning (0, "%J%qD declared inline after its definition",
- olddecl, olddecl);
+ warning (0, "%q+D declared inline after its definition", olddecl);
warned = true;
}
}
@@ -1535,7 +1531,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
if (TREE_CODE (newdecl) == PARM_DECL
&& (!TREE_ASM_WRITTEN (olddecl) || TREE_ASM_WRITTEN (newdecl)))
{
- error ("%Jredefinition of parameter %qD", newdecl, newdecl);
+ error ("redefinition of parameter %q+D", newdecl);
locate_old_decl (olddecl, error);
return false;
}
@@ -1559,8 +1555,8 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& !(TREE_CODE (newdecl) == PARM_DECL
&& TREE_ASM_WRITTEN (olddecl) && !TREE_ASM_WRITTEN (newdecl)))
{
- warning (OPT_Wredundant_decls, "%Jredundant redeclaration of %qD",
- newdecl, newdecl);
+ warning (OPT_Wredundant_decls, "redundant redeclaration of %q+D",
+ newdecl);
warned = true;
}
@@ -1887,26 +1883,25 @@ warn_if_shadowing (tree new_decl)
if (old_decl == error_mark_node)
{
- warning (0, "%Jdeclaration of %qD shadows previous non-variable",
- new_decl, new_decl);
+ warning (0, "declaration of %q+D shadows previous non-variable",
+ new_decl);
break;
}
else if (TREE_CODE (old_decl) == PARM_DECL)
- warning (0, "%Jdeclaration of %qD shadows a parameter",
- new_decl, new_decl);
+ warning (0, "declaration of %q+D shadows a parameter", new_decl);
else if (DECL_FILE_SCOPE_P (old_decl))
- warning (0, "%Jdeclaration of %qD shadows a global declaration",
- new_decl, new_decl);
+ warning (0, "declaration of %q+D shadows a global declaration",
+ new_decl);
else if (TREE_CODE (old_decl) == FUNCTION_DECL
&& DECL_BUILT_IN (old_decl))
{
- warning (0, "%Jdeclaration of %qD shadows a built-in function",
- new_decl, new_decl);
+ warning (0, "declaration of %q+D shadows a built-in function",
+ new_decl);
break;
}
else
- warning (0, "%Jdeclaration of %qD shadows a previous local",
- new_decl, new_decl);
+ warning (0, "declaration of %q+D shadows a previous local",
+ new_decl);
warning (0, "%Jshadowed declaration is here", old_decl);
@@ -3086,7 +3081,7 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs,
if (warn_main > 0 && TREE_CODE (decl) != FUNCTION_DECL
&& MAIN_NAME_P (DECL_NAME (decl)))
- warning (OPT_Wmain, "%J%qD is usually a function", decl, decl);
+ warning (OPT_Wmain, "%q+D is usually a function", decl);
if (initialized)
/* Is it valid for this decl to have an initializer at all?
@@ -3207,8 +3202,8 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs,
&& DECL_DECLARED_INLINE_P (decl)
&& DECL_UNINLINABLE (decl)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (decl)))
- warning (OPT_Wattributes, "%Jinline function %qD given attribute noinline",
- decl, decl);
+ warning (OPT_Wattributes, "inline function %q+D given attribute noinline",
+ decl);
/* Add this decl to the current scope.
TEM may equal DECL or it may be a previous decl of the same name. */
@@ -3279,12 +3274,12 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
switch (failure)
{
case 1:
- error ("%Jinitializer fails to determine size of %qD", decl, decl);
+ error ("initializer fails to determine size of %q+D", decl);
break;
case 2:
if (do_default)
- error ("%Jarray size missing in %qD", decl, decl);
+ error ("array size missing in %q+D", decl);
/* If a `static' var's size isn't known,
make it extern as well as static, so it does not get
allocated.
@@ -3296,7 +3291,7 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
break;
case 3:
- error ("%Jzero or negative size array %qD", decl, decl);
+ error ("zero or negative size array %q+D", decl);
break;
case 0:
@@ -3348,7 +3343,7 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
is an error. */
: !DECL_EXTERNAL (decl)))
{
- error ("%Jstorage size of %qD isn%'t known", decl, decl);
+ error ("storage size of %q+D isn%'t known", decl);
TREE_TYPE (decl) = error_mark_node;
}
@@ -3358,7 +3353,7 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST)
constant_expression_warning (DECL_SIZE (decl));
else
- error ("%Jstorage size of %qD isn%'t constant", decl, decl);
+ error ("storage size of %q+D isn%'t constant", decl);
}
if (TREE_USED (type))
@@ -3405,8 +3400,8 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
&& TREE_CODE (decl) == VAR_DECL
&& !C_DECL_REGISTER (decl)
&& !TREE_STATIC (decl))
- warning (0, "%Jignoring asm-specifier for non-static local "
- "variable %qD", decl, decl);
+ warning (0, "ignoring asm-specifier for non-static local "
+ "variable %q+D", decl);
else if (C_DECL_REGISTER (decl))
change_decl_assembler_name (decl, get_identifier (asmspec));
else
@@ -4367,7 +4362,7 @@ grokdeclarator (const struct c_declarator *declarator,
C_TYPEDEF_EXPLICITLY_SIGNED (decl) = 1;
decl_attributes (&decl, returned_attrs, 0);
if (declspecs->inline_p)
- pedwarn ("%Jtypedef %qD declared %<inline%>", decl, decl);
+ pedwarn ("typedef %q+D declared %<inline%>", decl);
return decl;
}
@@ -4482,7 +4477,7 @@ grokdeclarator (const struct c_declarator *declarator,
DECL_ARG_TYPE (decl) = promoted_type;
DECL_ARG_TYPE_AS_WRITTEN (decl) = type_as_written;
if (declspecs->inline_p)
- pedwarn ("%Jparameter %qD declared %<inline%>", decl, decl);
+ pedwarn ("parameter %q+D declared %<inline%>", decl);
}
else if (decl_context == FIELD)
{
@@ -4636,7 +4631,7 @@ grokdeclarator (const struct c_declarator *declarator,
C_DECL_VARIABLE_SIZE (decl) = 1;
if (declspecs->inline_p)
- pedwarn ("%Jvariable %qD declared %<inline%>", decl, decl);
+ pedwarn ("variable %q+D declared %<inline%>", decl);
/* At file scope, an initialized extern declaration may follow
a static declaration. In that case, DECL_EXTERNAL will be
@@ -4770,8 +4765,8 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag)
if (funcdef_flag)
{
if (DECL_NAME (parm))
- error ("%Jparameter %u (%qD) has incomplete type",
- parm, parmno, parm);
+ error ("parameter %u (%q+D) has incomplete type",
+ parmno, parm);
else
error ("%Jparameter %u has incomplete type",
parm, parmno);
@@ -4782,8 +4777,8 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag)
else if (VOID_TYPE_P (type))
{
if (DECL_NAME (parm))
- warning (0, "%Jparameter %u (%qD) has void type",
- parm, parmno, parm);
+ warning (0, "parameter %u (%q+D) has void type",
+ parmno, parm);
else
warning (0, "%Jparameter %u has void type",
parm, parmno);
@@ -4874,8 +4869,7 @@ get_parm_info (bool ellipsis)
/* Check for forward decls that never got their actual decl. */
if (TREE_ASM_WRITTEN (decl))
- error ("%Jparameter %qD has just a forward declaration",
- decl, decl);
+ error ("parameter %q+D has just a forward declaration", decl);
/* Check for (..., void, ...) and issue an error. */
else if (VOID_TYPE_P (type) && !DECL_NAME (decl))
{
@@ -5189,7 +5183,7 @@ detect_field_duplicates (tree fieldlist)
for (y = fieldlist; y != x; y = TREE_CHAIN (y))
if (DECL_NAME (y) == DECL_NAME (x))
{
- error ("%Jduplicate member %qD", x, x);
+ error ("duplicate member %q+D", x);
DECL_NAME (x) = NULL_TREE;
}
}
@@ -5205,7 +5199,7 @@ detect_field_duplicates (tree fieldlist)
slot = htab_find_slot (htab, y, INSERT);
if (*slot)
{
- error ("%Jduplicate member %qD", x, x);
+ error ("duplicate member %q+D", x);
DECL_NAME (x) = NULL_TREE;
}
*slot = y;
@@ -5800,8 +5794,8 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
if (DECL_DECLARED_INLINE_P (decl1)
&& DECL_UNINLINABLE (decl1)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (decl1)))
- warning (OPT_Wattributes, "%Jinline function %qD given attribute noinline",
- decl1, decl1);
+ warning (OPT_Wattributes, "inline function %q+D given attribute noinline",
+ decl1);
announce_function (decl1);
@@ -5886,8 +5880,7 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
&& TREE_PUBLIC (decl1)
&& !MAIN_NAME_P (DECL_NAME (decl1))
&& C_DECL_ISNT_PROTOTYPE (old_decl))
- warning (OPT_Wmissing_prototypes, "%Jno previous prototype for %qD",
- decl1, decl1);
+ warning (OPT_Wmissing_prototypes, "no previous prototype for %q+D", decl1);
/* Optionally warn of any def with no previous prototype
if the function has already been used. */
else if (warn_missing_prototypes
@@ -5896,15 +5889,14 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
&& TREE_USED (old_decl)
&& TYPE_ARG_TYPES (TREE_TYPE (old_decl)) == 0)
warning (OPT_Wmissing_prototypes,
- "%J%qD was used with no prototype before its definition",
- decl1, decl1);
+ "%q+D was used with no prototype before its definition", decl1);
/* Optionally warn of any global def with no previous declaration. */
else if (warn_missing_declarations
&& TREE_PUBLIC (decl1)
&& old_decl == 0
&& !MAIN_NAME_P (DECL_NAME (decl1)))
- warning (OPT_Wmissing_declarations, "%Jno previous declaration for %qD",
- decl1, decl1);
+ warning (OPT_Wmissing_declarations, "no previous declaration for %q+D",
+ decl1);
/* Optionally warn of any def with no previous declaration
if the function has already been used. */
else if (warn_missing_declarations
@@ -5913,8 +5905,7 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
&& TREE_USED (old_decl)
&& C_DECL_IMPLICIT (old_decl))
warning (OPT_Wmissing_declarations,
- "%J%qD was used with no declaration before its definition",
- decl1, decl1);
+ "%q+D was used with no declaration before its definition", decl1);
/* This is a definition, not a reference.
So normally clear DECL_EXTERNAL.
@@ -5946,7 +5937,7 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl1)))
!= integer_type_node)
- pedwarn ("%Jreturn type of %qD is not %<int%>", decl1, decl1);
+ pedwarn ("return type of %q+D is not %<int%>", decl1);
for (args = TYPE_ARG_TYPES (TREE_TYPE (decl1)); args;
args = TREE_CHAIN (args))
@@ -5961,8 +5952,7 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
{
case 1:
if (TYPE_MAIN_VARIANT (type) != integer_type_node)
- pedwarn ("%Jfirst argument of %qD should be %<int%>",
- decl1, decl1);
+ pedwarn ("first argument of %q+D should be %<int%>", decl1);
break;
case 2:
@@ -5970,8 +5960,8 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
|| TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE
|| (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type)))
!= char_type_node))
- pedwarn ("%Jsecond argument of %qD should be %<char **%>",
- decl1, decl1);
+ pedwarn ("second argument of %q+D should be %<char **%>",
+ decl1);
break;
case 3:
@@ -5979,8 +5969,8 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
|| TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE
|| (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type)))
!= char_type_node))
- pedwarn ("%Jthird argument of %qD should probably be "
- "%<char **%>", decl1, decl1);
+ pedwarn ("third argument of %q+D should probably be "
+ "%<char **%>", decl1);
break;
}
}
@@ -5989,10 +5979,10 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
argument because it's only mentioned in an appendix of the
standard. */
if (argct > 0 && (argct < 2 || argct > 3))
- pedwarn ("%J%qD takes only zero or two arguments", decl1, decl1);
+ pedwarn ("%q+D takes only zero or two arguments", decl1);
if (!TREE_PUBLIC (decl1))
- pedwarn ("%J%qD is normally a non-static function", decl1, decl1);
+ pedwarn ("%q+D is normally a non-static function", decl1);
}
/* Record the decl so that the function name is defined.
@@ -6124,12 +6114,12 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
decl = b->decl;
/* If we got something other than a PARM_DECL it is an error. */
if (TREE_CODE (decl) != PARM_DECL)
- error ("%J%qD declared as a non-parameter", decl, decl);
+ error ("%q+D declared as a non-parameter", decl);
/* If the declaration is already marked, we have a duplicate
name. Complain and ignore the duplicate. */
else if (DECL_WEAK (decl))
{
- error ("%Jmultiple parameters named %qD", decl, decl);
+ error ("multiple parameters named %q+D", decl);
TREE_PURPOSE (parm) = 0;
continue;
}
@@ -6137,7 +6127,7 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
an int. */
else if (VOID_TYPE_P (TREE_TYPE (decl)))
{
- error ("%Jparameter %qD declared with void type", decl, decl);
+ error ("parameter %q+D declared with void type", decl);
TREE_TYPE (decl) = integer_type_node;
DECL_ARG_TYPE (decl) = integer_type_node;
layout_decl (decl, 0);
@@ -6152,10 +6142,9 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
pushdecl (decl);
if (flag_isoc99)
- pedwarn ("%Jtype of %qD defaults to %<int%>", decl, decl);
+ pedwarn ("type of %q+D defaults to %<int%>", decl);
else if (extra_warnings)
- warning (OPT_Wextra, "%Jtype of %qD defaults to %<int%>",
- decl, decl);
+ warning (OPT_Wextra, "type of %q+D defaults to %<int%>", decl);
}
TREE_PURPOSE (parm) = decl;
@@ -6174,14 +6163,13 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
if (TREE_TYPE (parm) != error_mark_node
&& !COMPLETE_TYPE_P (TREE_TYPE (parm)))
{
- error ("%Jparameter %qD has incomplete type", parm, parm);
+ error ("parameter %q+D has incomplete type", parm);
TREE_TYPE (parm) = error_mark_node;
}
if (!DECL_WEAK (parm))
{
- error ("%Jdeclaration for parameter %qD but no such parameter",
- parm, parm);
+ error ("declaration for parameter %q+D but no such parameter", parm);
/* Pretend the parameter was not missing.
This gets us to a standard state and minimizes
@@ -6466,7 +6454,7 @@ finish_function (void)
/* If warn_main is 1 (-Wmain) or 2 (-Wall), we have already warned.
If warn_main is -1 (-Wno-main) we don't want to be warned. */
if (!warn_main)
- pedwarn ("%Jreturn type of %qD is not %<int%>", fndecl, fndecl);
+ pedwarn ("return type of %q+D is not %<int%>", fndecl);
}
else
{
@@ -6642,11 +6630,11 @@ check_for_loop_decls (void)
{
case VAR_DECL:
if (TREE_STATIC (decl))
- error ("%Jdeclaration of static variable %qD in %<for%> loop "
- "initial declaration", decl, decl);
+ error ("declaration of static variable %q+D in %<for%> loop "
+ "initial declaration", decl);
else if (DECL_EXTERNAL (decl))
- error ("%Jdeclaration of %<extern%> variable %qD in %<for%> loop "
- "initial declaration", decl, decl);
+ error ("declaration of %<extern%> variable %q+D in %<for%> loop "
+ "initial declaration", decl);
break;
case RECORD_TYPE:
@@ -6662,8 +6650,8 @@ check_for_loop_decls (void)
id);
break;
default:
- error ("%Jdeclaration of non-variable %qD in %<for%> loop "
- "initial declaration", decl, decl);
+ error ("declaration of non-variable %q+D in %<for%> loop "
+ "initial declaration", decl);
}
}
}
@@ -7519,7 +7507,7 @@ c_write_global_declarations_1 (tree globals)
&& !TREE_PUBLIC (decl)
&& C_DECL_USED (decl))
{
- pedwarn ("%J%qF used but never defined", decl, decl);
+ pedwarn ("%q+F used but never defined", decl);
TREE_NO_WARNING (decl) = 1;
}
}
diff --git a/gcc/c-format.c b/gcc/c-format.c
index 28eefd9..5c4bb67 100644
--- a/gcc/c-format.c
+++ b/gcc/c-format.c
@@ -391,6 +391,7 @@ static const format_flag_pair gcc_diag_flag_pairs[] =
static const format_flag_spec gcc_diag_flag_specs[] =
{
+ { '+', 0, 0, N_("'+' flag"), N_("the '+' printf flag"), STD_C89 },
{ 'q', 0, 0, N_("'q' flag"), N_("the 'q' diagnostic flag"), STD_C89 },
{ 'p', 0, 0, N_("precision"), N_("precision in printf format"), STD_C89 },
{ 'L', 0, 0, N_("length modifier"), N_("length modifier in printf format"), STD_C89 },
@@ -558,7 +559,7 @@ static const format_char_info gcc_cdiag_char_table[] =
{ "H", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL },
/* These will require a "tree" at runtime. */
- { "DEFJT", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q", "", NULL },
+ { "DEFJT", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "q+", "", NULL },
{ "<>'", 0, STD_C89, NOARGUMENTS, "", "", NULL },
{ "m", 0, STD_C89, NOARGUMENTS, "q", "", NULL },
@@ -659,13 +660,13 @@ static const format_kind_info format_types_orig[] =
'w', 0, 'p', 0, 'L',
NULL, NULL
},
- { "gcc_diag", gcc_diag_length_specs, gcc_diag_char_table, "q", NULL,
+ { "gcc_diag", gcc_diag_length_specs, gcc_diag_char_table, "q+", NULL,
gcc_diag_flag_specs, gcc_diag_flag_pairs,
FMT_FLAG_ARG_CONVERT,
0, 0, 'p', 0, 'L',
NULL, &integer_type_node
},
- { "gcc_cdiag", gcc_cdiag_length_specs, gcc_cdiag_char_table, "q", NULL,
+ { "gcc_cdiag", gcc_cdiag_length_specs, gcc_cdiag_char_table, "q+", NULL,
gcc_cdiag_flag_specs, gcc_cdiag_flag_pairs,
FMT_FLAG_ARG_CONVERT,
0, 0, 'p', 0, 'L',
diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c
index 0fb5b61..eb556b1 100644
--- a/gcc/c-objc-common.c
+++ b/gcc/c-objc-common.c
@@ -78,8 +78,8 @@ c_cannot_inline_tree_fn (tree *fnp)
&& lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)) == NULL)
{
if (do_warning)
- warning (0, "%Jfunction %qF can never be inlined because it "
- "is suppressed using -fno-inline", fn, fn);
+ warning (0, "function %q+F can never be inlined because it "
+ "is suppressed using -fno-inline", fn);
goto cannot_inline;
}
@@ -88,16 +88,16 @@ c_cannot_inline_tree_fn (tree *fnp)
if (!DECL_DECLARED_INLINE_P (fn) && !targetm.binds_local_p (fn))
{
if (do_warning)
- warning (0, "%Jfunction %qF can never be inlined because it might not "
- "be bound within this unit of translation", fn, fn);
+ warning (0, "function %q+F can never be inlined because it might not "
+ "be bound within this unit of translation", fn);
goto cannot_inline;
}
if (!function_attribute_inlinable_p (fn))
{
if (do_warning)
- warning (0, "%Jfunction %qF can never be inlined because it uses "
- "attributes conflicting with inlining", fn, fn);
+ warning (0, "function %q+F can never be inlined because it uses "
+ "attributes conflicting with inlining", fn);
goto cannot_inline;
}
@@ -162,7 +162,7 @@ c_objc_common_init (void)
diagnostic machinery. */
static bool
c_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
- int precision, bool wide, bool plus, bool hash)
+ int precision, bool wide, bool set_locus, bool hash)
{
tree t = va_arg (*text->args_ptr, tree);
tree name;
@@ -170,10 +170,12 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
c_pretty_printer *cpp = (c_pretty_printer *) pp;
pp->padding = pp_none;
- /* FUTURE: %+x should set the locus. */
- if (precision != 0 || wide || plus || hash)
+ if (precision != 0 || wide || hash)
return false;
+ if (set_locus && text->locus)
+ *text->locus = DECL_SOURCE_LOCATION (t);
+
switch (*spec)
{
case 'D':
diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c
index 7d7b0da..7e028cb 100644
--- a/gcc/c-pragma.c
+++ b/gcc/c-pragma.c
@@ -259,8 +259,8 @@ apply_pragma_weak (tree decl, tree value)
if (SUPPORTS_WEAK && DECL_EXTERNAL (decl) && TREE_USED (decl)
&& !DECL_WEAK (decl) /* Don't complain about a redundant #pragma. */
&& TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
- warning (0, "%Japplying #pragma weak %qD after first use results "
- "in unspecified behavior", decl, decl);
+ warning (0, "applying #pragma weak %q+D after first use results "
+ "in unspecified behavior", decl);
declare_weak (decl);
}
diff --git a/gcc/config/arm/pe.c b/gcc/config/arm/pe.c
index 9ffdfbb..f2f67d5 100644
--- a/gcc/config/arm/pe.c
+++ b/gcc/config/arm/pe.c
@@ -162,7 +162,7 @@ arm_mark_dllimport (decl)
&& !DECL_VIRTUAL_P (decl)
&& DECL_INITIAL (decl))
{
- error ("%Jinitialized variable '%D' is marked dllimport", decl, decl);
+ error ("initialized variable %q+D is marked dllimport", decl);
return;
}
/* Nor can they be static. */
@@ -171,7 +171,7 @@ arm_mark_dllimport (decl)
&& !DECL_VIRTUAL_P (decl)
&& 0 /*???*/)
{
- error ("%Jstatic variable '%D' is marked dllimport", decl, decl);
+ error ("static variable %q+D is marked dllimport", decl);
return;
}
diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c
index 743acd0..c1c605c 100644
--- a/gcc/config/i386/winnt.c
+++ b/gcc/config/i386/winnt.c
@@ -199,8 +199,8 @@ i386_pe_dllimport_p (tree decl)
{
/* Don't warn about artificial methods. */
if (!DECL_ARTIFICIAL (decl))
- warning (0, "%Jfunction '%D' is defined after prior declaration "
- "as dllimport: attribute ignored", decl, decl);
+ warning (0, "function %q+D is defined after prior declaration "
+ "as dllimport: attribute ignored", decl);
return 0;
}
@@ -210,8 +210,8 @@ i386_pe_dllimport_p (tree decl)
else if (TREE_CODE (decl) == FUNCTION_DECL && DECL_INLINE (decl))
{
if (extra_warnings)
- warning (0, "%Jinline function '%D' is declared as dllimport: "
- "attribute ignored.", decl, decl);
+ warning (0, "inline function %q+D is declared as dllimport: "
+ "attribute ignored", decl);
return 0;
}
@@ -222,8 +222,8 @@ i386_pe_dllimport_p (tree decl)
&& !DECL_EXTERNAL (decl) && context_imp)
{
if (!DECL_VIRTUAL_P (decl))
- error ("%Jdefinition of static data member '%D' of "
- "dllimport'd class.", decl, decl);
+ error ("definition of static data member %q+D of "
+ "dllimport'd class", decl);
return 0;
}
@@ -279,8 +279,8 @@ i386_pe_mark_dllexport (tree decl)
oldname = XSTR (rtlname, 0);
if (i386_pe_dllimport_name_p (oldname))
{
- warning (0, "%Jinconsistent dll linkage for '%D', dllexport assumed.",
- decl, decl);
+ warning (0, "inconsistent dll linkage for %q+D, dllexport assumed",
+ decl);
/* Remove DLL_IMPORT_PREFIX. */
oldname += strlen (DLL_IMPORT_PREFIX);
DECL_NON_ADDR_CONST_P (decl) = 0;
@@ -463,12 +463,12 @@ i386_pe_encode_section_info (tree decl, rtx rtl, int first)
We leave these alone for now. */
if (DECL_INITIAL (decl) || !DECL_EXTERNAL (decl))
- warning (0, "%J'%D' defined locally after being "
- "referenced with dllimport linkage", decl, decl);
+ warning (0, "%q+D defined locally after being "
+ "referenced with dllimport linkage", decl);
else
- warning (OPT_Wattributes, "%J'%D' redeclared without dllimport "
+ warning (OPT_Wattributes, "%q+D redeclared without dllimport "
"attribute after being referenced with dllimport linkage",
- decl, decl);
+ decl);
}
}
@@ -634,7 +634,7 @@ i386_pe_section_type_flags (tree decl, const char *name, int reloc)
else
{
if (decl && **slot != flags)
- error ("%J'%D' causes a section type conflict", decl, decl);
+ error ("%q+D causes a section type conflict", decl);
}
return flags;
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index f8f3463..8f28e20 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -515,21 +515,21 @@ ia64_handle_model_attribute (tree *node, tree name, tree args,
&& !TREE_STATIC (decl))
{
error ("%Jan address area attribute cannot be specified for "
- "local variables", decl, decl);
+ "local variables", decl);
*no_add_attrs = true;
}
area = ia64_get_addr_area (decl);
if (area != ADDR_AREA_NORMAL && addr_area != area)
{
- error ("%Jaddress area of '%s' conflicts with previous "
- "declaration", decl, decl);
+ error ("address area of %q+D conflicts with previous "
+ "declaration", decl);
*no_add_attrs = true;
}
break;
case FUNCTION_DECL:
error ("%Jaddress area attribute cannot be specified for functions",
- decl, decl);
+ decl);
*no_add_attrs = true;
break;
diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c
index b01cef8..8237d45 100644
--- a/gcc/config/mcore/mcore.c
+++ b/gcc/config/mcore/mcore.c
@@ -2895,7 +2895,7 @@ mcore_mark_dllimport (tree decl)
&& !DECL_VIRTUAL_P (decl)
&& DECL_INITIAL (decl))
{
- error ("%Jinitialized variable '%D' is marked dllimport", decl, decl);
+ error ("initialized variable %q+D is marked dllimport", decl);
return;
}
diff --git a/gcc/config/sh/symbian.c b/gcc/config/sh/symbian.c
index ef85066..456c23c 100644
--- a/gcc/config/sh/symbian.c
+++ b/gcc/config/sh/symbian.c
@@ -144,9 +144,9 @@ sh_symbian_dllimport_p (tree decl)
{
/* Don't warn about artificial methods. */
if (!DECL_ARTIFICIAL (decl))
- warning (OPT_Wattributes, "%H function '%D' is defined after prior "
+ warning (OPT_Wattributes, "function %q+D is defined after prior "
"declaration as dllimport: attribute ignored",
- & DECL_SOURCE_LOCATION (decl), decl);
+ decl);
return false;
}
@@ -156,9 +156,9 @@ sh_symbian_dllimport_p (tree decl)
else if (TREE_CODE (decl) == FUNCTION_DECL && DECL_INLINE (decl))
{
if (extra_warnings)
- warning (OPT_Wattributes, "%Hinline function '%D' is declared as "
- "dllimport: attribute ignored.",
- & DECL_SOURCE_LOCATION (decl), decl);
+ warning (OPT_Wattributes, "inline function %q+D is declared as "
+ "dllimport: attribute ignored",
+ decl);
return false;
}
@@ -170,8 +170,8 @@ sh_symbian_dllimport_p (tree decl)
&& !DECL_EXTERNAL (decl))
{
if (!DECL_VIRTUAL_P (decl))
- error ("%Hdefinition of static data member '%D' of dllimport'd class.",
- & DECL_SOURCE_LOCATION (decl), decl);
+ error ("definition of static data member %q+D of dllimport'd class",
+ decl);
return false;
}
@@ -277,8 +277,8 @@ sh_symbian_mark_dllimport (tree decl)
{
/* Already done, but do a sanity check to prevent assembler errors. */
if (!DECL_EXTERNAL (decl) || !TREE_PUBLIC (decl))
- error ("%Hfailure in redeclaration of '%D': dllimport'd symbol lacks external linkage.",
- &DECL_SOURCE_LOCATION (decl), decl);
+ error ("failure in redeclaration of %q+D: dllimport'd symbol lacks external linkage",
+ decl);
}
else
{
@@ -323,8 +323,7 @@ sh_symbian_encode_section_info (tree decl, rtx rtl, int first)
tree idp = get_identifier (oldname + strlen (DLL_IMPORT_PREFIX));
rtx newrtl = gen_rtx_SYMBOL_REF (Pmode, IDENTIFIER_POINTER (idp));
- warning (0, "%H%s '%D' %s after being referenced with dllimport linkage.",
- & DECL_SOURCE_LOCATION (decl),
+ warning (0, "%s %q+D %s after being referenced with dllimport linkage",
TREE_CODE (decl) == VAR_DECL ? "variable" : "function",
decl, (DECL_INITIAL (decl) || !DECL_EXTERNAL (decl))
? "defined locally" : "redeclared without dllimport attribute");
@@ -427,8 +426,8 @@ sh_symbian_handle_dll_attribute (tree *pnode, tree name, tree args,
{
if (DECL_INITIAL (node))
{
- error ("%Hvariable %qD definition is marked dllimport.",
- & DECL_SOURCE_LOCATION (node), node);
+ error ("variable %q+D definition is marked dllimport",
+ node);
*no_add_attrs = true;
}
@@ -502,8 +501,8 @@ sh_symbian_handle_dll_attribute (tree *pnode, tree name, tree args,
&& ( TREE_CODE (node) == VAR_DECL
|| TREE_CODE (node) == FUNCTION_DECL))
{
- error ("%Hexternal linkage required for symbol '%D' because of '%s' attribute.",
- & DECL_SOURCE_LOCATION (node), node, IDENTIFIER_POINTER (name));
+ error ("external linkage required for symbol %q+D because of %qs attribute",
+ node, IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
diff --git a/gcc/config/sol2.c b/gcc/config/sol2.c
index f54269d..e3d3147 100644
--- a/gcc/config/sol2.c
+++ b/gcc/config/sol2.c
@@ -51,8 +51,8 @@ solaris_insert_attributes (tree decl, tree *attributes)
{
if (lookup_attribute ("aligned", DECL_ATTRIBUTES (decl))
|| lookup_attribute ("aligned", *attributes))
- warning (0, "%Jignoring %<#pragma align%> for explicitly "
- "aligned %<%D%>", decl, decl);
+ warning (0, "ignoring %<#pragma align%> for explicitly "
+ "aligned %q+D", decl);
else
*attributes = tree_cons (get_identifier ("aligned"), value,
*attributes);
diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c
index 39d8a47..efc8320 100644
--- a/gcc/config/v850/v850.c
+++ b/gcc/config/v850/v850.c
@@ -2138,7 +2138,7 @@ v850_handle_data_area_attribute (tree* node,
if (current_function_decl != NULL_TREE)
{
error ("%Jdata area attributes cannot be specified for "
- "local variables", decl, decl);
+ "local variables", decl);
*no_add_attrs = true;
}
@@ -2148,8 +2148,8 @@ v850_handle_data_area_attribute (tree* node,
area = v850_get_data_area (decl);
if (area != DATA_AREA_NORMAL && data_area != area)
{
- error ("%Jdata area of '%D' conflicts with previous declaration",
- decl, decl);
+ error ("data area of %q+D conflicts with previous declaration",
+ decl);
*no_add_attrs = true;
}
break;
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e67ed48..530b0e4 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,14 @@
+2005-07-02 Zack Weinberg <zack@codesourcery.com>
+ Joseph S. Myers <joseph@codesourcery.com>
+
+ * error.c (location_of): Add comment.
+ (locate_error, cp_error_at, cp_warning_at, cp_pedwarn_at): Remove.
+ * cp-tree.h (cp_error_at, cp_warning_at, cp_pedwarn_at): Remove.
+ * call.c, class.c, decl.c, decl2.c, friend.c, init.c,
+ name-lookup.c, parser.c, pt.c, search.c, semantics.c, typeck.c,
+ typeck2.c: Use '+' flag instead of %J, cp_error_at, cp_warning_at
+ or cp_pedwarn_at. Mark up some diagnostic strings with N_.
+
2005-06-30 Daniel Berlin <dberlin@dberlin.org>
* decl.c (require_complete_types_for_parms): Call relayout_decl
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index d3cd467..382d6ea 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -2388,9 +2388,9 @@ print_z_candidate (const char *msgstr, struct z_candidate *candidate)
else if (TYPE_P (candidate->fn))
inform ("%s %T <conversion>", msgstr, candidate->fn);
else if (candidate->viable == -1)
- inform ("%J%s %+#D <near match>", candidate->fn, msgstr, candidate->fn);
+ inform ("%s %+#D <near match>", msgstr, candidate->fn);
else
- inform ("%J%s %+#D", candidate->fn, msgstr, candidate->fn);
+ inform ("%s %+#D", msgstr, candidate->fn);
}
static void
@@ -4052,11 +4052,11 @@ enforce_access (tree basetype_path, tree decl)
if (!accessible_p (basetype_path, decl, true))
{
if (TREE_PRIVATE (decl))
- cp_error_at ("%q+#D is private", decl);
+ error ("%q+#D is private", decl);
else if (TREE_PROTECTED (decl))
- cp_error_at ("%q+#D is protected", decl);
+ error ("%q+#D is protected", decl);
else
- cp_error_at ("%q+#D is inaccessible", decl);
+ error ("%q+#D is inaccessible", decl);
error ("within this context");
return false;
}
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index b58a501..4af7412 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -1029,15 +1029,15 @@ add_method (tree type, tree method, tree using_decl)
/* Defer to the local function. */
return;
if (DECL_CONTEXT (fn) == DECL_CONTEXT (method))
- cp_error_at ("repeated using declaration %qD", using_decl);
+ error ("repeated using declaration %q+D", using_decl);
else
- cp_error_at ("using declaration %qD conflicts with a previous using declaration",
- using_decl);
+ error ("using declaration %q+D conflicts with a previous using declaration",
+ using_decl);
}
else
{
- cp_error_at ("%q#D cannot be overloaded", method);
- cp_error_at ("with %q#D", fn);
+ error ("%q+#D cannot be overloaded", method);
+ error ("with %q+#D", fn);
}
/* We don't call duplicate_decls here to merge the
@@ -1092,8 +1092,8 @@ alter_access (tree t, tree fdecl, tree access)
if (TREE_VALUE (elem) != access)
{
if (TREE_CODE (TREE_TYPE (fdecl)) == FUNCTION_DECL)
- cp_error_at ("conflicting access specifications for method"
- " %qD, ignored", TREE_TYPE (fdecl));
+ error ("conflicting access specifications for method"
+ " %q+D, ignored", TREE_TYPE (fdecl));
else
error ("conflicting access specifications for field %qE, ignored",
DECL_NAME (fdecl));
@@ -1156,16 +1156,16 @@ handle_using_decl (tree using_decl, tree t)
the same name already present in the current class. */;
else
{
- cp_error_at ("%qD invalid in %q#T", using_decl, t);
- cp_error_at (" because of local method %q#D with same name",
- OVL_CURRENT (old_value));
+ error ("%q+D invalid in %q#T", using_decl, t);
+ error (" because of local method %q+#D with same name",
+ OVL_CURRENT (old_value));
return;
}
}
else if (!DECL_ARTIFICIAL (old_value))
{
- cp_error_at ("%qD invalid in %q#T", using_decl, t);
- cp_error_at (" because of local member %q#D with same name", old_value);
+ error ("%q+D invalid in %q#T", using_decl, t);
+ error (" because of local member %q+#D with same name", old_value);
return;
}
@@ -2383,8 +2383,8 @@ warn_hidden (tree t)
while (base_fndecls)
{
/* Here we know it is a hider, and no overrider exists. */
- cp_warning_at ("%qD was hidden", TREE_VALUE (base_fndecls));
- cp_warning_at (" by %qD", fns);
+ warning (0, "%q+D was hidden", TREE_VALUE (base_fndecls));
+ warning (0, " by %q+D", fns);
base_fndecls = TREE_CHAIN (base_fndecls);
}
}
@@ -2425,18 +2425,15 @@ finish_struct_anon (tree t)
if (TREE_CODE (elt) != FIELD_DECL)
{
- cp_pedwarn_at ("%q#D invalid; an anonymous union can "
- "only have non-static data members",
- elt);
+ pedwarn ("%q+#D invalid; an anonymous union can "
+ "only have non-static data members", elt);
continue;
}
if (TREE_PRIVATE (elt))
- cp_pedwarn_at ("private member %q#D in anonymous union",
- elt);
+ pedwarn ("private member %q+#D in anonymous union", elt);
else if (TREE_PROTECTED (elt))
- cp_pedwarn_at ("protected member %q#D in anonymous union",
- elt);
+ pedwarn ("protected member %q+#D in anonymous union", elt);
TREE_PRIVATE (elt) = TREE_PRIVATE (field);
TREE_PROTECTED (elt) = TREE_PROTECTED (field);
@@ -2602,7 +2599,7 @@ check_bitfield_decl (tree field)
if (DECL_INITIAL (field)
&& ! INTEGRAL_TYPE_P (TREE_TYPE (field)))
{
- cp_error_at ("bit-field %q#D with non-integral type", field);
+ error ("bit-field %q+#D with non-integral type", field);
w = error_mark_node;
}
@@ -2619,24 +2616,23 @@ check_bitfield_decl (tree field)
if (TREE_CODE (w) != INTEGER_CST)
{
- cp_error_at ("bit-field %qD width not an integer constant",
- field);
+ error ("bit-field %q+D width not an integer constant", field);
w = error_mark_node;
}
else if (tree_int_cst_sgn (w) < 0)
{
- cp_error_at ("negative width in bit-field %qD", field);
+ error ("negative width in bit-field %q+D", field);
w = error_mark_node;
}
else if (integer_zerop (w) && DECL_NAME (field) != 0)
{
- cp_error_at ("zero width for bit-field %qD", field);
+ error ("zero width for bit-field %q+D", field);
w = error_mark_node;
}
else if (compare_tree_int (w, TYPE_PRECISION (type)) > 0
&& TREE_CODE (type) != ENUMERAL_TYPE
&& TREE_CODE (type) != BOOLEAN_TYPE)
- cp_warning_at ("width of %qD exceeds its type", field);
+ warning (0, "width of %q+D exceeds its type", field);
else if (TREE_CODE (type) == ENUMERAL_TYPE
&& (0 > compare_tree_int (w,
min_precision (TYPE_MIN_VALUE (type),
@@ -2645,8 +2641,7 @@ check_bitfield_decl (tree field)
min_precision
(TYPE_MAX_VALUE (type),
TYPE_UNSIGNED (type)))))
- cp_warning_at ("%qD is too small to hold all values of %q#T",
- field, type);
+ warning (0, "%q+D is too small to hold all values of %q#T", field, type);
}
/* Remove the bit-field width indicator so that the rest of the
@@ -2705,14 +2700,13 @@ check_field_decl (tree field,
if (TREE_CODE (t) == UNION_TYPE)
{
if (TYPE_NEEDS_CONSTRUCTING (type))
- cp_error_at ("member %q#D with constructor not allowed in union",
- field);
+ error ("member %q+#D with constructor not allowed in union",
+ field);
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
- cp_error_at ("member %q#D with destructor not allowed in union",
- field);
+ error ("member %q+#D with destructor not allowed in union", field);
if (TYPE_HAS_COMPLEX_ASSIGN_REF (type))
- cp_error_at ("member %q#D with copy assignment operator not allowed in union",
- field);
+ error ("member %q+#D with copy assignment operator not allowed in union",
+ field);
}
else
{
@@ -2794,8 +2788,9 @@ check_field_decls (tree t, tree *access_decls,
if (TYPE_PACKED (t))
{
if (!pod_type_p (TREE_TYPE (x)) && !TYPE_PACKED (TREE_TYPE (x)))
- cp_warning_at
- ("ignoring packed attribute on unpacked non-POD field %q#D",
+ warning
+ (0,
+ "ignoring packed attribute on unpacked non-POD field %q+#D",
x);
else
DECL_PACKED (x) = 1;
@@ -2855,33 +2850,33 @@ check_field_decls (tree t, tree *access_decls,
reference type, the program is ill-formed. */
if (TREE_CODE (x) == VAR_DECL)
{
- cp_error_at ("%qD may not be static because it is a member of a union", x);
+ error ("%q+D may not be static because it is a member of a union", x);
continue;
}
if (TREE_CODE (type) == REFERENCE_TYPE)
{
- cp_error_at ("%qD may not have reference type %qT because"
- " it is a member of a union",
- x, type);
+ error ("%q+D may not have reference type %qT because"
+ " it is a member of a union",
+ x, type);
continue;
}
}
/* ``A local class cannot have static data members.'' ARM 9.4 */
if (current_function_decl && TREE_STATIC (x))
- cp_error_at ("field %qD in local class cannot be static", x);
+ error ("field %q+D in local class cannot be static", x);
/* Perform error checking that did not get done in
grokdeclarator. */
if (TREE_CODE (type) == FUNCTION_TYPE)
{
- cp_error_at ("field %qD invalidly declared function type", x);
+ error ("field %q+D invalidly declared function type", x);
type = build_pointer_type (type);
TREE_TYPE (x) = type;
}
else if (TREE_CODE (type) == METHOD_TYPE)
{
- cp_error_at ("field %qD invalidly declared method type", x);
+ error ("field %q+D invalidly declared method type", x);
type = build_pointer_type (type);
TREE_TYPE (x) = type;
}
@@ -2913,7 +2908,7 @@ check_field_decls (tree t, tree *access_decls,
if (! TYPE_HAS_CONSTRUCTOR (t) && CLASSTYPE_NON_AGGREGATE (t)
&& extra_warnings)
- cp_warning_at ("non-static reference %q#D in class without a constructor", x);
+ warning (0, "non-static reference %q+#D in class without a constructor", x);
}
type = strip_array_types (type);
@@ -2960,7 +2955,7 @@ check_field_decls (tree t, tree *access_decls,
if (! TYPE_HAS_CONSTRUCTOR (t) && CLASSTYPE_NON_AGGREGATE (t)
&& extra_warnings)
- cp_warning_at ("non-static const member %q#D in class without a constructor", x);
+ warning (0, "non-static const member %q+#D in class without a constructor", x);
}
/* A field that is pseudo-const makes the structure likewise. */
else if (CLASS_TYPE_P (type))
@@ -2975,7 +2970,7 @@ check_field_decls (tree t, tree *access_decls,
different name from the class iff the class has a
user-defined constructor. */
if (constructor_name_p (DECL_NAME (x), t) && TYPE_HAS_CONSTRUCTOR (t))
- cp_pedwarn_at ("field %q#D with same name as class", x);
+ pedwarn ("field %q+#D with same name as class", x);
/* We set DECL_C_BIT_FIELD in grokbitfield.
If the type and width are valid, we'll also set DECL_BIT_FIELD. */
@@ -3644,7 +3639,7 @@ check_methods (tree t)
{
check_for_override (x, t);
if (DECL_PURE_VIRTUAL_P (x) && ! DECL_VINDEX (x))
- cp_error_at ("initializer specified for non-virtual method %qD", x);
+ error ("initializer specified for non-virtual method %q+D", x);
/* The name of the field is the original field name
Save this in auxiliary field for later overloading. */
if (DECL_VINDEX (x))
@@ -4662,9 +4657,8 @@ layout_class_type (tree t, tree *virtuals_p)
&& !integer_zerop (size_binop (TRUNC_MOD_EXPR,
DECL_FIELD_BIT_OFFSET (field),
bitsize_unit_node)))
- cp_warning_at ("offset of %qD is not ABI-compliant and may "
- "change in a future version of GCC",
- field);
+ warning (0, "offset of %q+D is not ABI-compliant and may "
+ "change in a future version of GCC", field);
/* G++ used to use DECL_FIELD_OFFSET as if it were the byte
offset of the field. */
@@ -4672,10 +4666,9 @@ layout_class_type (tree t, tree *virtuals_p)
&& !tree_int_cst_equal (DECL_FIELD_OFFSET (field),
byte_position (field))
&& contains_empty_class_p (TREE_TYPE (field)))
- cp_warning_at ("%qD contains empty classes which may cause base "
- "classes to be placed at different locations in a "
- "future version of GCC",
- field);
+ warning (0, "%q+D contains empty classes which may cause base "
+ "classes to be placed at different locations in a "
+ "future version of GCC", field);
/* If we needed additional padding after this field, add it
now. */
@@ -6249,9 +6242,8 @@ note_name_declared_in_class (tree name, tree decl)
in its context and when re-evaluated in the completed scope of
S. */
error ("declaration of %q#D", decl);
- cp_error_at ("changes meaning of %qD from %q+#D",
- DECL_NAME (OVL_CURRENT (decl)),
- (tree) n->value);
+ error ("changes meaning of %qD from %q+#D",
+ DECL_NAME (OVL_CURRENT (decl)), (tree) n->value);
}
}
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index f661952f..2cef234 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4375,8 +4375,4 @@ extern void cp_genericize (tree);
#define ATTRIBUTE_GCC_CXXDIAG(m, n) ATTRIBUTE_NONNULL(m)
#endif
-extern void cp_error_at (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1, 2);
-extern void cp_warning_at (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1, 2);
-extern void cp_pedwarn_at (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1, 2);
-
#endif /* ! GCC_CP_TREE_H */
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 5eebd81..6e1dad1 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -352,7 +352,7 @@ pop_label (tree label, tree old_value)
{
location_t location;
- cp_error_at ("label %qD used but not defined", label);
+ error ("label %q+D used but not defined", label);
#ifdef USE_MAPPED_LOCATION
location = input_location; /* FIXME want (input_filename, (line)0) */
#else
@@ -363,7 +363,7 @@ pop_label (tree label, tree old_value)
define_label (location, DECL_NAME (label));
}
else if (warn_unused_label && !TREE_USED (label))
- cp_warning_at ("label %qD defined but not used", label);
+ warning (0, "label %q+D defined but not used", label);
}
SET_IDENTIFIER_LABEL_VALUE (DECL_NAME (label), old_value);
@@ -557,7 +557,7 @@ poplevel (int keep, int reverse, int functionbody)
&& ! TREE_USED (decl)
&& ! DECL_IN_SYSTEM_HEADER (decl)
&& DECL_NAME (decl) && ! DECL_ARTIFICIAL (decl))
- warning (0, "%Junused variable %qD", decl, decl);
+ warning (0, "unused variable %q+D", decl);
/* Remove declarations for all the DECLs in this level. */
for (link = decls; link; link = TREE_CHAIN (link))
@@ -997,7 +997,7 @@ warn_extern_redeclared_static (tree newdecl, tree olddecl)
name = DECL_ASSEMBLER_NAME (newdecl);
pedwarn ("%qD was declared %<extern%> and later %<static%>", newdecl);
- cp_pedwarn_at ("previous declaration of %qD", olddecl);
+ pedwarn ("previous declaration of %q+D", olddecl);
}
/* If NEWDECL is a redeclaration of OLDDECL, merge the declarations.
@@ -1045,19 +1045,19 @@ duplicate_decls (tree newdecl, tree olddecl)
&& DECL_UNINLINABLE (olddecl)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl)))
{
- warning (OPT_Wattributes, "%Jfunction %qD redeclared as inline",
- newdecl, newdecl);
- warning (OPT_Wattributes, "%Jprevious declaration of %qD "
- "with attribute noinline", olddecl, olddecl);
+ warning (OPT_Wattributes, "function %q+D redeclared as inline",
+ newdecl);
+ warning (OPT_Wattributes, "previous declaration of %q+D "
+ "with attribute noinline", olddecl);
}
else if (DECL_DECLARED_INLINE_P (olddecl)
&& DECL_UNINLINABLE (newdecl)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl)))
{
- warning (OPT_Wattributes, "%Jfunction %qD redeclared with "
- "attribute noinline", newdecl, newdecl);
- warning (OPT_Wattributes, "%Jprevious declaration of %qD was inline",
- olddecl, olddecl);
+ warning (OPT_Wattributes, "function %q+D redeclared with "
+ "attribute noinline", newdecl);
+ warning (OPT_Wattributes, "previous declaration of %q+D was inline",
+ olddecl);
}
}
@@ -1218,7 +1218,7 @@ duplicate_decls (tree newdecl, tree olddecl)
error ("%q#D redeclared as different kind of symbol", newdecl);
if (TREE_CODE (olddecl) == TREE_LIST)
olddecl = TREE_VALUE (olddecl);
- cp_error_at ("previous declaration of %q#D", olddecl);
+ error ("previous declaration of %q+#D", olddecl);
return error_mark_node;
}
@@ -1238,8 +1238,7 @@ duplicate_decls (tree newdecl, tree olddecl)
|| TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL)
{
error ("declaration of template %q#D", newdecl);
- cp_error_at ("conflicts with previous declaration %q#D",
- olddecl);
+ error ("conflicts with previous declaration %q+#D", olddecl);
}
else if (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == FUNCTION_DECL
&& TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == FUNCTION_DECL
@@ -1253,7 +1252,7 @@ duplicate_decls (tree newdecl, tree olddecl)
TREE_TYPE (TREE_TYPE (olddecl))))
{
error ("new declaration %q#D", newdecl);
- cp_error_at ("ambiguates old declaration %q#D", olddecl);
+ error ("ambiguates old declaration %q+#D", olddecl);
}
return NULL_TREE;
}
@@ -1263,13 +1262,13 @@ duplicate_decls (tree newdecl, tree olddecl)
{
error ("declaration of C function %q#D conflicts with",
newdecl);
- cp_error_at ("previous declaration %q#D here", olddecl);
+ error ("previous declaration %q+#D here", olddecl);
}
else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)),
TYPE_ARG_TYPES (TREE_TYPE (olddecl))))
{
error ("new declaration %q#D", newdecl);
- cp_error_at ("ambiguates old declaration %q#D", olddecl);
+ error ("ambiguates old declaration %q+#D", olddecl);
}
else
return NULL_TREE;
@@ -1277,8 +1276,7 @@ duplicate_decls (tree newdecl, tree olddecl)
else
{
error ("conflicting declaration %q#D", newdecl);
- cp_error_at ("%qD has a previous declaration as %q#D",
- olddecl, olddecl);
+ error ("%q+D has a previous declaration as %q#D", olddecl, olddecl);
return error_mark_node;
}
}
@@ -1331,7 +1329,7 @@ duplicate_decls (tree newdecl, tree olddecl)
declared as the name of any other entity in any global scope
of the program. */
error ("declaration of namespace %qD conflicts with", newdecl);
- cp_error_at ("previous declaration of namespace %qD here", olddecl);
+ error ("previous declaration of namespace %q+D here", olddecl);
return error_mark_node;
}
else
@@ -1341,10 +1339,9 @@ duplicate_decls (tree newdecl, tree olddecl)
{
error (errmsg, newdecl);
if (DECL_NAME (olddecl) != NULL_TREE)
- cp_error_at ((DECL_INITIAL (olddecl)
- && namespace_bindings_p ())
- ? "%q#D previously defined here"
- : "%q#D previously declared here", olddecl);
+ error ((DECL_INITIAL (olddecl) && namespace_bindings_p ())
+ ? "%q+#D previously defined here"
+ : "%q+#D previously declared here", olddecl);
return error_mark_node;
}
else if (TREE_CODE (olddecl) == FUNCTION_DECL
@@ -1353,7 +1350,7 @@ duplicate_decls (tree newdecl, tree olddecl)
&& TYPE_ARG_TYPES (TREE_TYPE (newdecl)) != NULL_TREE)
{
/* Prototype decl follows defn w/o prototype. */
- cp_warning_at ("prototype for %q#D", newdecl);
+ warning (0, "prototype for %q+#D", newdecl);
warning (0, "%Jfollows non-prototype definition here", olddecl);
}
else if (TREE_CODE (olddecl) == FUNCTION_DECL
@@ -1366,8 +1363,8 @@ duplicate_decls (tree newdecl, tree olddecl)
SET_DECL_LANGUAGE (newdecl, DECL_LANGUAGE (olddecl));
else
{
- cp_error_at ("previous declaration of %q#D with %qL linkage",
- olddecl, DECL_LANGUAGE (olddecl));
+ error ("previous declaration of %q+#D with %qL linkage",
+ olddecl, DECL_LANGUAGE (olddecl));
error ("conflicts with new declaration with %qL linkage",
DECL_LANGUAGE (newdecl));
}
@@ -1393,14 +1390,13 @@ duplicate_decls (tree newdecl, tree olddecl)
{
pedwarn ("default argument given for parameter %d of %q#D",
i, newdecl);
- cp_pedwarn_at ("after previous specification in %q#D",
- olddecl);
+ pedwarn ("after previous specification in %q+#D", olddecl);
}
else
{
error ("default argument given for parameter %d of %q#D",
i, newdecl);
- cp_error_at ("after previous specification in %q#D",
+ error ("after previous specification in %q+#D",
olddecl);
}
}
@@ -1463,7 +1459,7 @@ duplicate_decls (tree newdecl, tree olddecl)
&& ! (DECL_FRIEND_P (newdecl) || DECL_FRIEND_P (olddecl)))
{
warning (0, "redundant redeclaration of %qD in same scope", newdecl);
- cp_warning_at ("previous declaration of %qD", olddecl);
+ warning (0, "previous declaration of %q+D", olddecl);
}
}
@@ -1558,7 +1554,7 @@ duplicate_decls (tree newdecl, tree olddecl)
{
error ("declaration of %qF throws different exceptions",
newdecl);
- cp_error_at ("than previous declaration %qF", olddecl);
+ error ("than previous declaration %q+F", olddecl);
}
}
TREE_TYPE (newdecl) = TREE_TYPE (olddecl) = newtype;
@@ -1798,8 +1794,8 @@ duplicate_decls (tree newdecl, tree olddecl)
&& DECL_VISIBILITY_SPECIFIED (newdecl)
&& DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
{
- warning (OPT_Wattributes, "%J%qD: visibility attribute ignored "
- "because it", newdecl, newdecl);
+ warning (OPT_Wattributes, "%q+D: visibility attribute ignored "
+ "because it", newdecl);
warning (OPT_Wattributes, "%Jconflicts with previous "
"declaration here", olddecl);
}
@@ -2151,11 +2147,9 @@ check_previous_goto_1 (tree decl,
}
if (problem > 1)
- cp_error_at (" crosses initialization of %q#D",
- new_decls);
+ error (" crosses initialization of %q+#D", new_decls);
else
- cp_pedwarn_at (" enters scope of non-POD %q#D",
- new_decls);
+ pedwarn (" enters scope of non-POD %q+#D", new_decls);
}
if (b == level)
@@ -2253,7 +2247,7 @@ check_goto (tree decl)
if ((lab->in_try_scope || lab->in_catch_scope || lab->bad_decls)
&& !identified)
{
- cp_pedwarn_at ("jump to label %qD", decl);
+ pedwarn ("jump to label %q+D", decl);
pedwarn (" from here");
identified = 1;
}
@@ -2267,9 +2261,9 @@ check_goto (tree decl)
/* Can't skip init of __exception_info. */
error ("%J enters catch block", b);
else if (u > 1)
- cp_error_at (" skips initialization of %q#D", b);
+ error (" skips initialization of %q+#D", b);
else
- cp_pedwarn_at (" enters scope of non-POD %q#D", b);
+ pedwarn (" enters scope of non-POD %q+#D", b);
}
if (lab->in_try_scope)
@@ -2677,7 +2671,7 @@ make_unbound_class_template (tree context, tree name, tree parm_list,
if (complain & tf_error)
{
error ("template parameters do not match template");
- cp_error_at ("%qD declared here", tmpl);
+ error ("%q+D declared here", tmpl);
}
return error_mark_node;
}
@@ -3367,17 +3361,14 @@ fixup_anonymous_aggr (tree t)
if (CLASS_TYPE_P (type))
{
if (TYPE_NEEDS_CONSTRUCTING (type))
- cp_error_at ("member %q#D with constructor not allowed "
- "in anonymous aggregate",
- field);
+ error ("member %q+#D with constructor not allowed "
+ "in anonymous aggregate", field);
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
- cp_error_at ("member %q#D with destructor not allowed "
- "in anonymous aggregate",
- field);
+ error ("member %q+#D with destructor not allowed "
+ "in anonymous aggregate", field);
if (TYPE_HAS_COMPLEX_ASSIGN_REF (type))
- cp_error_at ("member %q#D with copy assignment operator "
- "not allowed in anonymous aggregate",
- field);
+ error ("member %q+#D with copy assignment operator "
+ "not allowed in anonymous aggregate", field);
}
}
}
@@ -3503,10 +3494,9 @@ shadow_tag (cp_decl_specifier_seq *declspecs)
if (declspecs->attributes)
{
- cp_warning_at ("attribute ignored in declaration of %q#T", t);
- cp_warning_at ("attribute for %q#T must follow the %qs keyword",
- t,
- class_key_or_enum_as_string (t));
+ warning (0, "attribute ignored in declaration of %q+#T", t);
+ warning (0, "attribute for %q+#T must follow the %qs keyword",
+ t, class_key_or_enum_as_string (t));
}
@@ -3661,7 +3651,7 @@ start_decl (const cp_declarator *declarator,
&& DECL_DECLARED_INLINE_P (decl)
&& DECL_UNINLINABLE (decl)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (decl)))
- warning (0, "%Jinline function %qD given attribute noinline", decl, decl);
+ warning (0, "inline function %q+D given attribute noinline", decl);
if (context && COMPLETE_TYPE_P (complete_type (context)))
{
@@ -4045,9 +4035,9 @@ maybe_commonize_var (tree decl)
be merged. */
TREE_PUBLIC (decl) = 0;
DECL_COMMON (decl) = 0;
- cp_warning_at ("sorry: semantics of inline function static "
- "data %q#D are wrong (you'll wind up "
- "with multiple copies)", decl);
+ warning (0, "sorry: semantics of inline function static "
+ "data %q+#D are wrong (you'll wind up "
+ "with multiple copies)", decl);
warning (0, "%J you can work around this by removing "
"the initializer",
decl);
@@ -5446,13 +5436,13 @@ bad_specifiers (tree object,
"%qD invalid in %s declaration",
object, type);
if (friendp)
- cp_error_at ("%qD declared as a friend", object);
+ error ("%q+D declared as a friend", object);
if (raises
&& (TREE_CODE (object) == TYPE_DECL
|| (!TYPE_PTRFN_P (TREE_TYPE (object))
&& !TYPE_REFFN_P (TREE_TYPE (object))
&& !TYPE_PTRMEMFUNC_P (TREE_TYPE (object)))))
- cp_error_at ("%qD declared with an exception specification", object);
+ error ("%q+D declared with an exception specification", object);
}
/* CTYPE is class type, or null if non-class.
@@ -5579,9 +5569,9 @@ grokfndecl (tree ctype,
pedwarn ("non-local function %q#D uses anonymous type",
decl);
if (DECL_ORIGINAL_TYPE (TYPE_NAME (t)))
- cp_pedwarn_at ("%q#D does not refer to the unqualified "
- "type, so it is not used for linkage",
- TYPE_NAME (t));
+ pedwarn ("%q+#D does not refer to the unqualified "
+ "type, so it is not used for linkage",
+ TYPE_NAME (t));
}
}
else
@@ -5915,9 +5905,9 @@ grokvardecl (tree type,
warning (0, "non-local variable %q#D uses anonymous type",
decl);
if (DECL_ORIGINAL_TYPE (TYPE_NAME (t)))
- cp_warning_at ("%q#D does not refer to the unqualified "
- "type, so it is not used for linkage",
- TYPE_NAME (t));
+ warning (0, "%q+#D does not refer to the unqualified "
+ "type, so it is not used for linkage",
+ TYPE_NAME (t));
}
}
else
@@ -9017,7 +9007,7 @@ check_elaborated_type_specifier (enum tag_types tag_code,
&& tag_code != typename_type)
{
error ("using typedef-name %qD after %qs", decl, tag_name (tag_code));
- cp_error_at ("%qD has a previous declaration here", decl);
+ error ("%q+D has a previous declaration here", decl);
return error_mark_node;
}
else if (TREE_CODE (type) != RECORD_TYPE
@@ -9026,7 +9016,7 @@ check_elaborated_type_specifier (enum tag_types tag_code,
&& tag_code != typename_type)
{
error ("%qT referred to as %qs", type, tag_name (tag_code));
- cp_error_at ("%qT has a previous declaration here", type);
+ error ("%q+T has a previous declaration here", type);
return error_mark_node;
}
else if (TREE_CODE (type) != ENUMERAL_TYPE
@@ -9034,7 +9024,7 @@ check_elaborated_type_specifier (enum tag_types tag_code,
&& tag_code != typename_type)
{
error ("%qT referred to as enum", type);
- cp_error_at ("%qT has a previous declaration here", type);
+ error ("%q+T has a previous declaration here", type);
return error_mark_node;
}
else if (!allow_template_p
@@ -9918,7 +9908,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
if (DECL_DECLARED_INLINE_P (decl1)
&& lookup_attribute ("noinline", attrs))
- warning (0, "%Jinline function %qD given attribute noinline", decl1, decl1);
+ warning (0, "inline function %q+D given attribute noinline", decl1);
if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl1))
/* This is a constructor, we must ensure that any default args
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index c5fb47a..2abf30c 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -49,6 +49,7 @@ Boston, MA 02110-1301, USA. */
#include "cgraph.h"
#include "tree-inline.h"
#include "c-pragma.h"
+#include "intl.h"
extern cpp_reader *parse_in;
@@ -690,12 +691,12 @@ check_classfn (tree ctype, tree function, tree template_parms)
is_conv_op = false;
}
if (format)
- format = " %#D";
+ format = " %+#D";
else if (fndecls)
- format = "candidates are: %#D";
+ format = N_("candidates are: %+#D");
else
- format = "candidate is: %#D";
- cp_error_at (format, fndecl);
+ format = N_("candidate is: %+#D");
+ error (format, fndecl);
}
}
else if (!COMPLETE_TYPE_P (ctype))
@@ -1085,16 +1086,15 @@ build_anon_union_vars (tree type, tree object)
continue;
if (TREE_CODE (field) != FIELD_DECL)
{
- cp_pedwarn_at ("%q#D invalid; an anonymous union can only "
- "have non-static data members",
- field);
+ pedwarn ("%q+#D invalid; an anonymous union can only "
+ "have non-static data members", field);
continue;
}
if (TREE_PRIVATE (field))
- cp_pedwarn_at ("private member %q#D in anonymous union", field);
+ pedwarn ("private member %q+#D in anonymous union", field);
else if (TREE_PROTECTED (field))
- cp_pedwarn_at ("protected member %q#D in anonymous union", field);
+ pedwarn ("protected member %q+#D in anonymous union", field);
if (processing_template_decl)
ref = build_min_nt (COMPONENT_REF, object,
@@ -3061,7 +3061,7 @@ cp_finish_file (void)
already verified there was a definition. */
&& !DECL_EXPLICIT_INSTANTIATION (decl))
{
- cp_warning_at ("inline function %qD used but never defined", decl);
+ warning (0, "inline function %q+D used but never defined", decl);
/* This symbol is effectively an "extern" declaration now.
This is not strictly necessary, but removes a duplicate
warning. */
@@ -3212,8 +3212,7 @@ check_default_args (tree x)
saw_def = true;
else if (saw_def)
{
- cp_error_at ("default argument missing for parameter %P of %q+#D",
- i, x);
+ error ("default argument missing for parameter %P of %q+#D", i, x);
break;
}
}
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index fd222be..6d80fc6 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -88,7 +88,6 @@ static void cp_print_error_function (diagnostic_context *, diagnostic_info *);
static bool cp_printer (pretty_printer *, text_info *, const char *,
int, bool, bool, bool);
-static tree locate_error (const char *, va_list);
static location_t location_of (tree);
void
@@ -1943,6 +1942,8 @@ lang_decl_name (tree decl, int v)
return pp_formatted_text (cxx_pp);
}
+/* Return the location of a tree passed to %+ formats. */
+
static location_t
location_of (tree t)
{
@@ -2311,125 +2312,3 @@ cp_printer (pretty_printer *pp, text_info *text, const char *spec,
#undef next_lang
#undef next_int
}
-
-/* These are temporary wrapper functions which handle the historic
- behavior of cp_*_at. */
-
-static tree
-locate_error (const char *gmsgid, va_list ap)
-{
- tree here = 0, t;
- int plus = 0;
- const char *f;
-
- for (f = gmsgid; *f; f++)
- {
- plus = 0;
- if (*f == '%')
- {
- if (*++f == 'q')
- ++f; /* ignore quoting flag. */
-
- if (*f == '+')
- {
- ++f;
- plus = 1;
- }
- if (*f == '#')
- f++;
-
- switch (*f)
- {
- /* Just ignore these possibilities. */
- case '%': break;
- case 'P':
- case 'd': (void) va_arg (ap, int); break;
- case 's': (void) va_arg (ap, char *); break;
- case 'L': (void) va_arg (ap, enum languages); break;
- case 'C':
- case 'O':
- case 'Q': (void) va_arg (ap, enum tree_code); break;
-
- /* These take a tree, which may be where the error is
- located. */
- case 'A':
- case 'D':
- case 'E':
- case 'F':
- case 'T':
- case 'V':
- t = va_arg (ap, tree);
- if (!here || plus)
- here = t;
- break;
-
- default:
- errorcount = 0; /* damn ICE suppression */
- internal_error ("unexpected letter %qc in locate_error\n", *f);
- }
- }
- }
-
- if (here == 0)
- here = va_arg (ap, tree);
-
- return here;
-}
-
-
-void
-cp_error_at (const char *gmsgid, ...)
-{
- tree here;
- diagnostic_info diagnostic;
- va_list ap;
-
- va_start (ap, gmsgid);
- here = locate_error (gmsgid, ap);
- va_end (ap);
-
- va_start (ap, gmsgid);
- diagnostic_set_info (&diagnostic, gmsgid, &ap,
- input_location, DK_ERROR);
- cp_diagnostic_starter (global_dc, &diagnostic);
- diagnostic_set_info (&diagnostic, gmsgid, &ap,
- location_of (here), DK_ERROR);
- report_diagnostic (&diagnostic);
- va_end (ap);
-}
-
-void
-cp_warning_at (const char *gmsgid, ...)
-{
- tree here;
- diagnostic_info diagnostic;
- va_list ap;
-
- va_start (ap, gmsgid);
- here = locate_error (gmsgid, ap);
- va_end (ap);
-
- va_start (ap, gmsgid);
- diagnostic_set_info (&diagnostic, gmsgid, &ap,
- location_of (here), DK_WARNING);
- report_diagnostic (&diagnostic);
- va_end (ap);
-}
-
-void
-cp_pedwarn_at (const char *gmsgid, ...)
-{
- tree here;
- diagnostic_info diagnostic;
- va_list ap;
-
- va_start (ap, gmsgid);
- here = locate_error (gmsgid, ap);
- va_end (ap);
-
- va_start (ap, gmsgid);
- diagnostic_set_info (&diagnostic, gmsgid, &ap,
- location_of (here), pedantic_error_kind());
- report_diagnostic (&diagnostic);
- va_end (ap);
-}
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c
index dec90a1..4e1a209 100644
--- a/gcc/cp/friend.c
+++ b/gcc/cp/friend.c
@@ -314,7 +314,7 @@ make_friend_class (tree type, tree friend_type, bool complain)
{
error ("%qT is not a member class template of %qT",
name, ctype);
- cp_error_at ("%qD declared here", decl);
+ error ("%q+D declared here", decl);
return;
}
if (!template_member_p && (TREE_CODE (decl) != TYPE_DECL
@@ -322,7 +322,7 @@ make_friend_class (tree type, tree friend_type, bool complain)
{
error ("%qT is not a nested class of %qT",
name, ctype);
- cp_error_at ("%qD declared here", decl);
+ error ("%q+D declared here", decl);
return;
}
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 2d2daac..05491c4 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -522,13 +522,13 @@ sort_mem_initializers (tree t, tree mem_inits)
if (warn_reorder && !subobject_init)
{
if (TREE_CODE (TREE_PURPOSE (next_subobject)) == FIELD_DECL)
- cp_warning_at ("%qD will be initialized after",
- TREE_PURPOSE (next_subobject));
+ warning (0, "%q+D will be initialized after",
+ TREE_PURPOSE (next_subobject));
else
warning (0, "base %qT will be initialized after",
TREE_PURPOSE (next_subobject));
if (TREE_CODE (subobject) == FIELD_DECL)
- cp_warning_at (" %q#D", subobject);
+ warning (0, " %q+#D", subobject);
else
warning (0, " base %qT", subobject);
warning (0, "%J when initialized here", current_function_decl);
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 658b701..50a92ca 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -505,7 +505,7 @@ supplement_binding (cxx_binding *binding, tree decl)
else
{
error ("declaration of %q#D", decl);
- cp_error_at ("conflicts with previous declaration %q#D", bval);
+ error ("conflicts with previous declaration %q+#D", bval);
ok = false;
}
@@ -721,7 +721,7 @@ pushdecl (tree x)
[basic.start.main]
This function shall not be overloaded. */
- cp_error_at ("invalid redeclaration of %qD", t);
+ error ("invalid redeclaration of %q+D", t);
error ("as %qD", x);
/* We don't try to push this declaration since that
causes a crash. */
@@ -811,7 +811,7 @@ pushdecl (tree x)
&& !same_type_p (TREE_TYPE (x), TREE_TYPE (decl)))
{
pedwarn ("type mismatch with previous external decl of %q#D", x);
- cp_pedwarn_at ("previous external decl of %q#D", decl);
+ pedwarn ("previous external decl of %q+#D", decl);
}
}
@@ -894,7 +894,7 @@ pushdecl (tree x)
else
{
warning (0, "extern declaration of %q#D doesn't match", x);
- cp_warning_at ("global declaration %q#D", oldglobal);
+ warning (0, "global declaration %q+#D", oldglobal);
}
}
/* If we have a local external declaration,
@@ -1092,9 +1092,9 @@ check_for_out_of_scope_variable (tree decl)
if (!DECL_ERROR_REPORTED (decl))
{
warning (0, "name lookup of %qD changed", DECL_NAME (decl));
- cp_warning_at (" matches this %qD under ISO standard rules",
- shadowed);
- cp_warning_at (" matches this %qD under old rules", decl);
+ warning (0, " matches this %q+D under ISO standard rules",
+ shadowed);
+ warning (0, " matches this %q+D under old rules", decl);
DECL_ERROR_REPORTED (decl) = 1;
}
return shadowed;
@@ -1114,15 +1114,15 @@ check_for_out_of_scope_variable (tree decl)
{
error ("name lookup of %qD changed for new ISO %<for%> scoping",
DECL_NAME (decl));
- cp_error_at (" cannot use obsolete binding at %qD because "
- "it has a destructor", decl);
+ error (" cannot use obsolete binding at %q+D because "
+ "it has a destructor", decl);
return error_mark_node;
}
else
{
pedwarn ("name lookup of %qD changed for new ISO %<for%> scoping",
DECL_NAME (decl));
- cp_pedwarn_at (" using obsolete binding at %qD", decl);
+ pedwarn (" using obsolete binding at %q+D", decl);
}
return decl;
@@ -1895,7 +1895,7 @@ push_overloaded_decl (tree decl, int flags)
old = NULL_TREE;
else
{
- cp_error_at ("previous non-function declaration %q#D", old);
+ error ("previous non-function declaration %q+#D", old);
error ("conflicts with function declaration %q#D", decl);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
}
@@ -3386,9 +3386,9 @@ ambiguous_decl (tree name, struct scope_binding *old, cxx_binding *new,
if (old->value != error_mark_node)
{
error ("use of %qD is ambiguous", name);
- cp_error_at (" first declared as %q#D here", old->value);
+ error (" first declared as %q+#D here", old->value);
}
- cp_error_at (" also declared as %q#D here", val);
+ error (" also declared as %q+#D here", val);
}
old->value = error_mark_node;
}
@@ -4165,8 +4165,8 @@ add_function (struct arg_lookup *k, tree fn)
{
fn = f1; f1 = f2; f2 = fn;
}
- cp_error_at ("%qD is not a function,", f1);
- cp_error_at (" conflict with %qD", f2);
+ error ("%q+D is not a function,", f1);
+ error (" conflict with %q+D", f2);
error (" in call to %qD", k->name);
return true;
}
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 0a64193..2d17cde 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -13058,7 +13058,7 @@ cp_parser_class_head (cp_parser* parser,
if (type != error_mark_node && COMPLETE_TYPE_P (type))
{
error ("redefinition of %q#T", type);
- cp_error_at ("previous definition of %q#T", type);
+ error ("previous definition of %q+#T", type);
type = NULL_TREE;
goto done;
}
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index cae8da1..3b4c588 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -667,7 +667,7 @@ check_specialization_namespace (tree tmpl)
else
{
pedwarn ("specialization of %qD in different namespace", tmpl);
- cp_pedwarn_at (" from definition of %q#D", tmpl);
+ pedwarn (" from definition of %q+#D", tmpl);
return false;
}
}
@@ -736,8 +736,8 @@ maybe_process_partial_specialization (tree type)
!= decl_namespace_context (CLASSTYPE_TI_TEMPLATE (type)))
{
pedwarn ("specializing %q#T in different namespace", type);
- cp_pedwarn_at (" from definition of %q#D",
- CLASSTYPE_TI_TEMPLATE (type));
+ pedwarn (" from definition of %q+#D",
+ CLASSTYPE_TI_TEMPLATE (type));
}
/* Check for invalid specialization after instantiation:
@@ -1284,7 +1284,7 @@ print_candidates (tree fns)
tree f;
for (f = TREE_VALUE (fn); f; f = OVL_NEXT (f))
- cp_error_at ("%s %+#D", str, OVL_CURRENT (f));
+ error ("%s %+#D", str, OVL_CURRENT (f));
str = " ";
}
}
@@ -1533,17 +1533,16 @@ determine_specialization (tree template_id,
if (templates == NULL_TREE && candidates == NULL_TREE)
{
- cp_error_at ("template-id %qD for %q+D does not match any template "
- "declaration",
- template_id, decl);
+ error ("template-id %qD for %q+D does not match any template "
+ "declaration", template_id, decl);
return error_mark_node;
}
else if ((templates && TREE_CHAIN (templates))
|| (candidates && TREE_CHAIN (candidates))
|| (templates && candidates))
{
- cp_error_at ("ambiguous template specialization %qD for %q+D",
- template_id, decl);
+ error ("ambiguous template specialization %qD for %q+D",
+ template_id, decl);
chainon (candidates, templates);
print_candidates (candidates);
return error_mark_node;
@@ -2197,8 +2196,8 @@ check_template_shadow (tree decl)
|| TEMPLATE_PARMS_FOR_INLINE (current_template_parms))
return;
- cp_error_at ("declaration of %q#D", decl);
- cp_error_at (" shadows template parm %q#D", olddecl);
+ error ("declaration of %q+#D", decl);
+ error (" shadows template parm %q+#D", olddecl);
}
/* Return a new TEMPLATE_PARM_INDEX with the indicated INDEX, LEVEL,
@@ -3219,7 +3218,7 @@ redeclare_class_template (tree type, tree parms)
if (TREE_VEC_LENGTH (parms) != TREE_VEC_LENGTH (tmpl_parms))
{
- cp_error_at ("previous declaration %qD", tmpl);
+ error ("previous declaration %q+D", tmpl);
error ("used %d template parameter(s) instead of %d",
TREE_VEC_LENGTH (tmpl_parms),
TREE_VEC_LENGTH (parms));
@@ -3239,7 +3238,7 @@ redeclare_class_template (tree type, tree parms)
|| (TREE_CODE (tmpl_parm) != TYPE_DECL
&& !same_type_p (TREE_TYPE (tmpl_parm), TREE_TYPE (parm))))
{
- cp_error_at ("template parameter %q#D", tmpl_parm);
+ error ("template parameter %q+#D", tmpl_parm);
error ("redeclared here as %q#D", parm);
return;
}
@@ -3960,7 +3959,7 @@ coerce_template_parms (tree parms,
nargs, nparms);
if (in_decl)
- cp_error_at ("provided for %qD", in_decl);
+ error ("provided for %q+D", in_decl);
}
return error_mark_node;
@@ -4347,7 +4346,7 @@ lookup_template_class (tree d1,
{
error ("non-template type %qT used as a template", d1);
if (in_decl)
- cp_error_at ("for template declaration %qD", in_decl);
+ error ("for template declaration %q+D", in_decl);
}
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
}
@@ -5441,7 +5440,7 @@ instantiate_class_template (tree type)
{
if (get_class_bindings (TREE_VALUE (t), TREE_PURPOSE (t), args))
{
- cp_error_at ("%s %+#T", str, TREE_TYPE (t));
+ error ("%s %+#T", str, TREE_TYPE (t));
str = " ";
}
}
@@ -6547,7 +6546,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
complain, in_decl);
TREE_CHAIN (r) = NULL_TREE;
if (VOID_TYPE_P (type))
- cp_error_at ("instantiation of %qD as type %qT", r, type);
+ error ("instantiation of %q+D as type %qT", r, type);
}
break;
@@ -6723,7 +6722,7 @@ tsubst_arg_types (tree arg_types,
{
error ("invalid parameter type %qT", type);
if (in_decl)
- cp_error_at ("in declaration %qD", in_decl);
+ error ("in declaration %q+D", in_decl);
}
return error_mark_node;
}
@@ -11624,11 +11623,10 @@ instantiate_pending_templates (int retries)
to avoid infinite loop. */
if (pending_templates && retries >= max_tinst_depth)
{
- cp_error_at ("template instantiation depth exceeds maximum of %d"
- " (use -ftemplate-depth-NN to increase the maximum)"
- " instantiating %q+D, possibly from virtual table"
- " generation",
- max_tinst_depth, TREE_VALUE (pending_templates));
+ error ("template instantiation depth exceeds maximum of %d"
+ " instantiating %q+D, possibly from virtual table generation"
+ " (use -ftemplate-depth-NN to increase the maximum)",
+ max_tinst_depth, TREE_VALUE (pending_templates));
return;
}
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 77d63da..795e8c2 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -1839,9 +1839,9 @@ check_final_overrider (tree overrider, tree basefn)
fail = 2;
else
{
- cp_warning_at ("deprecated covariant return type for %q#D",
+ warning (0, "deprecated covariant return type for %q+#D",
overrider);
- cp_warning_at (" overriding %q#D", basefn);
+ warning (0, " overriding %q+#D", basefn);
}
}
else
@@ -1855,14 +1855,13 @@ check_final_overrider (tree overrider, tree basefn)
{
if (fail == 1)
{
- cp_error_at ("invalid covariant return type for %q#D", overrider);
- cp_error_at (" overriding %q#D", basefn);
+ error ("invalid covariant return type for %q+#D", overrider);
+ error (" overriding %q+#D", basefn);
}
else
{
- cp_error_at ("conflicting return type specified for %q#D",
- overrider);
- cp_error_at (" overriding %q#D", basefn);
+ error ("conflicting return type specified for %q+#D", overrider);
+ error (" overriding %q+#D", basefn);
}
DECL_INVALID_OVERRIDER_P (overrider) = 1;
return 0;
@@ -1871,8 +1870,8 @@ check_final_overrider (tree overrider, tree basefn)
/* Check throw specifier is at least as strict. */
if (!comp_except_specs (base_throw, over_throw, 0))
{
- cp_error_at ("looser throw specifier for %q#F", overrider);
- cp_error_at (" overriding %q#F", basefn);
+ error ("looser throw specifier for %q+#F", overrider);
+ error (" overriding %q+#F", basefn);
DECL_INVALID_OVERRIDER_P (overrider) = 1;
return 0;
}
@@ -1965,8 +1964,8 @@ look_for_overrides_r (tree type, tree fndecl)
{
/* A static member function cannot match an inherited
virtual member function. */
- cp_error_at ("%q#D cannot be declared", fndecl);
- cp_error_at (" since %q#D declared in base class", fn);
+ error ("%q+#D cannot be declared", fndecl);
+ error (" since %q+#D declared in base class", fn);
}
else
{
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 4f9a03a..3d99c5d 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1342,10 +1342,9 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
{
if (current_function_decl
&& DECL_STATIC_FUNCTION_P (current_function_decl))
- cp_error_at ("invalid use of member %qD in static member function",
- decl);
+ error ("invalid use of member %q+D in static member function", decl);
else
- cp_error_at ("invalid use of non-static data member %qD", decl);
+ error ("invalid use of non-static data member %q+D", decl);
error ("from this location");
return error_mark_node;
@@ -1384,7 +1383,7 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
if (!access_type)
{
- cp_error_at ("object missing in reference to %qD", decl);
+ error ("object missing in reference to %q+D", decl);
error ("from this location");
return error_mark_node;
}
@@ -2789,7 +2788,7 @@ finish_id_expression (tree id_expression,
error (TREE_CODE (decl) == VAR_DECL
? "use of %<auto%> variable from containing function"
: "use of parameter from containing function");
- cp_error_at (" %q#D declared here", decl);
+ error (" %q+#D declared here", decl);
return error_mark_node;
}
}
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 32d3f04..c6989ee 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -2560,8 +2560,7 @@ convert_arguments (tree typelist, tree values, tree fndecl, int flags)
{
if (fndecl)
{
- cp_error_at ("too many arguments to %s %q+#D", called_thing,
- fndecl);
+ error ("too many arguments to %s %q+#D", called_thing, fndecl);
error ("at this point in file");
}
else
@@ -2663,8 +2662,7 @@ convert_arguments (tree typelist, tree values, tree fndecl, int flags)
{
if (fndecl)
{
- cp_error_at ("too few arguments to %s %q+#D",
- called_thing, fndecl);
+ error ("too few arguments to %s %q+#D", called_thing, fndecl);
error ("at this point in file");
}
else
@@ -6018,9 +6016,9 @@ convert_for_initialization (tree exp, tree type, tree rhs, int flags,
if (fndecl)
{
if (warningcount > savew)
- cp_warning_at ("in passing argument %P of %q+D", parmnum, fndecl);
+ warning (0, "in passing argument %P of %q+D", parmnum, fndecl);
else if (errorcount > savee)
- cp_error_at ("in passing argument %P of %q+D", parmnum, fndecl);
+ error ("in passing argument %P of %q+D", parmnum, fndecl);
}
return rhs;
}
@@ -6089,11 +6087,11 @@ maybe_warn_about_returning_address_of_local (tree retval)
|| TREE_PUBLIC (whats_returned)))
{
if (TREE_CODE (valtype) == REFERENCE_TYPE)
- cp_warning_at ("reference to local variable %qD returned",
- whats_returned);
+ warning (0, "reference to local variable %q+D returned",
+ whats_returned);
else
- cp_warning_at ("address of local variable %qD returned",
- whats_returned);
+ warning (0, "address of local variable %q+D returned",
+ whats_returned);
return;
}
}
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 516116d..4244088 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -214,7 +214,7 @@ complete_type_check_abstract (tree type)
/* Tweak input_location so that the diagnostic appears at the correct
location. Notice that this is only needed if the decl is an
- IDENTIFIER_NODE, otherwise cp_error_at. */
+ IDENTIFIER_NODE. */
input_location = pat->locus;
abstract_virtuals_error (pat->decl, pat->type);
pat = pat->next;
@@ -289,27 +289,24 @@ abstract_virtuals_error (tree decl, tree type)
return 0;
if (TREE_CODE (decl) == VAR_DECL)
- cp_error_at ("cannot declare variable %q+D to be of abstract "
- "type %qT", decl, type);
+ error ("cannot declare variable %q+D to be of abstract "
+ "type %qT", decl, type);
else if (TREE_CODE (decl) == PARM_DECL)
- cp_error_at ("cannot declare parameter %q+D to be of abstract "
- "type %qT", decl, type);
+ error ("cannot declare parameter %q+D to be of abstract type %qT",
+ decl, type);
else if (TREE_CODE (decl) == FIELD_DECL)
- cp_error_at ("cannot declare field %q+D to be of abstract "
- "type %qT", decl, type);
+ error ("cannot declare field %q+D to be of abstract type %qT",
+ decl, type);
else if (TREE_CODE (decl) == FUNCTION_DECL
&& TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE)
- cp_error_at ("invalid abstract return type for member function %q+#D",
- decl);
+ error ("invalid abstract return type for member function %q+#D", decl);
else if (TREE_CODE (decl) == FUNCTION_DECL)
- cp_error_at ("invalid abstract return type for function %q+#D",
- decl);
+ error ("invalid abstract return type for function %q+#D", decl);
else if (TREE_CODE (decl) == IDENTIFIER_NODE)
- /* Here we do not have location information, so use error instead
- of cp_error_at. */
+ /* Here we do not have location information. */
error ("invalid abstract type %qT for %qE", type, decl);
else
- cp_error_at ("invalid abstract type for %q+D", decl);
+ error ("invalid abstract type for %q+D", decl);
}
else
error ("cannot allocate an object of abstract type %qT", type);
@@ -324,7 +321,7 @@ abstract_virtuals_error (tree decl, tree type)
"within %qT:", TYPE_MAIN_DECL (type), type);
for (ix = 0; VEC_iterate (tree, pure, ix, fn); ix++)
- inform ("%J\t%#D", fn, fn);
+ inform ("\t%+#D", fn);
/* Now truncate the vector. This leaves it non-null, so we know
there are pure virtuals, but empty so we don't list them out
again. */
@@ -348,23 +345,13 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type)
{
int decl = 0;
void (*p_msg) (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1,2);
- void (*p_msg_at) (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1,2);
if (diag_type == 1)
- {
- p_msg = warning0;
- p_msg_at = cp_warning_at;
- }
+ p_msg = warning0;
else if (diag_type == 2)
- {
- p_msg = pedwarn;
- p_msg_at = cp_pedwarn_at;
- }
+ p_msg = pedwarn;
else
- {
- p_msg = error;
- p_msg_at = cp_error_at;
- }
+ p_msg = error;
/* Avoid duplicate error message. */
if (TREE_CODE (type) == ERROR_MARK)
@@ -374,7 +361,7 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type)
|| TREE_CODE (value) == PARM_DECL
|| TREE_CODE (value) == FIELD_DECL))
{
- (*p_msg_at) ("%qD has incomplete type", value);
+ p_msg ("%q+D has incomplete type", value);
decl = 1;
}
retry:
@@ -386,15 +373,15 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type)
case UNION_TYPE:
case ENUMERAL_TYPE:
if (!decl)
- (*p_msg) ("invalid use of undefined type %q#T", type);
+ p_msg ("invalid use of undefined type %q#T", type);
if (!TYPE_TEMPLATE_INFO (type))
- (*p_msg_at) ("forward declaration of %q#T", type);
+ p_msg ("forward declaration of %q+#T", type);
else
- (*p_msg_at) ("declaration of %q#T", type);
+ p_msg ("declaration of %q+#T", type);
break;
case VOID_TYPE:
- (*p_msg) ("invalid use of %qT", type);
+ p_msg ("invalid use of %qT", type);
break;
case ARRAY_TYPE:
@@ -403,28 +390,28 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type)
type = TREE_TYPE (type);
goto retry;
}
- (*p_msg) ("invalid use of array with unspecified bounds");
+ p_msg ("invalid use of array with unspecified bounds");
break;
case OFFSET_TYPE:
bad_member:
- (*p_msg) ("invalid use of member (did you forget the %<&%> ?)");
+ p_msg ("invalid use of member (did you forget the %<&%> ?)");
break;
case TEMPLATE_TYPE_PARM:
- (*p_msg) ("invalid use of template type parameter");
+ p_msg ("invalid use of template type parameter");
break;
case UNKNOWN_TYPE:
if (value && TREE_CODE (value) == COMPONENT_REF)
goto bad_member;
else if (value && TREE_CODE (value) == ADDR_EXPR)
- (*p_msg) ("address of overloaded function with no contextual "
- "type information");
+ p_msg ("address of overloaded function with no contextual "
+ "type information");
else if (value && TREE_CODE (value) == OVERLOAD)
- (*p_msg) ("overloaded function with no contextual type information");
+ p_msg ("overloaded function with no contextual type information");
else
- (*p_msg) ("insufficient contextual information to determine type");
+ p_msg ("insufficient contextual information to determine type");
break;
default:
diff --git a/gcc/function.c b/gcc/function.c
index 12ebece..92415cc 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -820,7 +820,7 @@ assign_temp (tree type_or_decl, int keep, int memory_required,
if (decl && size == -1
&& TREE_CODE (TYPE_SIZE_UNIT (type)) == INTEGER_CST)
{
- error ("%Jsize of variable %qD is too large", decl, decl);
+ error ("size of variable %q+D is too large", decl);
size = 1;
}
@@ -3451,9 +3451,9 @@ setjmp_vars_warning (tree block)
&& DECL_RTL_SET_P (decl)
&& REG_P (DECL_RTL (decl))
&& regno_clobbered_at_setjmp (REGNO (DECL_RTL (decl))))
- warning (0, "%Jvariable %qD might be clobbered by %<longjmp%>"
+ warning (0, "variable %q+D might be clobbered by %<longjmp%>"
" or %<vfork%>",
- decl, decl);
+ decl);
}
for (sub = BLOCK_SUBBLOCKS (block); sub; sub = TREE_CHAIN (sub))
@@ -3472,8 +3472,8 @@ setjmp_args_warning (void)
if (DECL_RTL (decl) != 0
&& REG_P (DECL_RTL (decl))
&& regno_clobbered_at_setjmp (REGNO (DECL_RTL (decl))))
- warning (0, "%Jargument %qD might be clobbered by %<longjmp%> or %<vfork%>",
- decl, decl);
+ warning (0, "argument %q+D might be clobbered by %<longjmp%> or %<vfork%>",
+ decl);
}
@@ -4277,7 +4277,7 @@ do_warn_unused_parameter (tree fn)
decl; decl = TREE_CHAIN (decl))
if (!TREE_USED (decl) && TREE_CODE (decl) == PARM_DECL
&& DECL_NAME (decl) && !DECL_ARTIFICIAL (decl))
- warning (0, "%Junused parameter %qD", decl, decl);
+ warning (0, "unused parameter %q+D", decl);
}
static GTY(()) rtx initial_trampoline;
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 3d5b221..18edb05 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,8 @@
+2005-07-02 Joseph S. Myers <joseph@codesourcery.com>
+
+ * class.c, decl.c, expr.c: Use '+' flag instead of %J. Use 'q'
+ flag for quoting.
+
2005-07-01 Andrew Pinski <pinskia@physics.uc.edu>
* parse.y (issue_warning_error_from_context): Call
diff --git a/gcc/java/class.c b/gcc/java/class.c
index f5a5bb6..eca8017 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -2359,8 +2359,8 @@ layout_class_method (tree this_class, tree super_class,
&& ! flag_indirect_dispatch
&& !CLASS_FROM_SOURCE_P (this_class)
&& ! DECL_ARTIFICIAL (super_method))
- error ("%Jnon-static method '%D' overrides static method",
- method_decl, method_decl);
+ error ("non-static method %q+D overrides static method",
+ method_decl);
}
else if (this_class == object_type_node
&& (METHOD_FINAL (method_decl)
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index e63ef84..ec8ff4e 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -1310,7 +1310,7 @@ pushdecl (tree x)
/* error_mark_node is 0 for a while during initialization! */
{
t = 0;
- error ("%J'%D' used prior to declaration", x, x);
+ error ("%q+D used prior to declaration", x);
}
/* If we're naming a hitherto-unnamed type, set its TYPE_NAME
@@ -1682,12 +1682,12 @@ poplevel (int keep, int reverse, int functionbody)
if (DECL_INITIAL (label) == 0)
{
- error ("%Jlabel '%D' used but not defined", label, label);
+ error ("label %q+D used but not defined", label);
/* Avoid crashing later. */
define_label (input_location, DECL_NAME (label));
}
else if (warn_unused[UNUSED_LABEL] && !TREE_USED (label))
- warning (0, "%Jlabel '%D' defined but not used", label, label);
+ warning (0, "label %q+D defined but not used", label);
IDENTIFIER_LABEL_VALUE (DECL_NAME (label)) = 0;
/* Put the labels into the "variables" of the
@@ -1815,8 +1815,8 @@ force_poplevels (int start_pc)
while (current_binding_level->start_pc > start_pc)
{
if (pedantic && current_binding_level->start_pc > start_pc)
- warning (0, "%JIn %D: overlapped variable and exception ranges at %d",
- current_function_decl, current_function_decl,
+ warning (0, "In %+D: overlapped variable and exception ranges at %d",
+ current_function_decl,
current_binding_level->start_pc);
poplevel (1, 0, 0);
}
@@ -1887,8 +1887,8 @@ give_name_to_locals (JCF *jcf)
tree decl = build_decl (VAR_DECL, name, type);
if (end_pc > DECL_CODE_LENGTH (current_function_decl))
{
- warning (0, "%Jbad PC range for debug info for local '%D'",
- decl, decl);
+ warning (0, "bad PC range for debug info for local %q+D",
+ decl);
end_pc = DECL_CODE_LENGTH (current_function_decl);
}
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index 523bfd6..f3f4c84 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -2730,22 +2730,22 @@ expand_java_field_op (int is_static, int is_putting, int field_ref_index)
if (FIELD_FINAL (field_decl))
{
if (DECL_CONTEXT (field_decl) != current_class)
- error ("%Jassignment to final field '%D' not in field's class",
- field_decl, field_decl);
+ error ("assignment to final field %q+D not in field's class",
+ field_decl);
else if (FIELD_STATIC (field_decl))
{
if (!DECL_CLINIT_P (current_function_decl))
- warning (0, "%Jassignment to final static field %qD not in "
+ warning (0, "assignment to final static field %q+D not in "
"class initializer",
- field_decl, field_decl);
+ field_decl);
}
else
{
tree cfndecl_name = DECL_NAME (current_function_decl);
if (! DECL_CONSTRUCTOR_P (current_function_decl)
&& !ID_FINIT_P (cfndecl_name))
- warning (0, "%Jassignment to final field '%D' not in constructor",
- field_decl, field_decl);
+ warning (0, "assignment to final field %q+D not in constructor",
+ field_decl);
}
}
java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (field_ref),
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index 6963c53..18feb8d 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,8 @@
+2005-07-02 Joseph S. Myers <joseph@codesourcery.com>
+
+ * objc-act.c: Use '+' flag instead of %J. Use 'q' flag for
+ quoting.
+
2005-06-30 Ziemowit Laski <zlaski@apple.com>
* objc-act.c (objc_build_volatilized_type): New function.
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index e44f8b0..9bd0884 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -2922,8 +2922,8 @@ objc_declare_class (tree ident_list)
{
error ("%qs redeclared as different kind of symbol",
IDENTIFIER_POINTER (ident));
- error ("%Jprevious declaration of '%D'",
- record, record);
+ error ("previous declaration of %q+D",
+ record);
}
}
@@ -4317,8 +4317,8 @@ encode_method_prototype (tree method_decl)
/* If a type size is not known, bail out. */
if (sz < 0)
{
- error ("%Jtype '%D' does not have a known size",
- type, type);
+ error ("type %q+D does not have a known size",
+ type);
/* Pretend that the encoding succeeded; the compilation will
fail nevertheless. */
goto finish_encoding;
@@ -7493,8 +7493,8 @@ start_class (enum tree_code code, tree class_name, tree super_name,
{
error ("%qs redeclared as different kind of symbol",
IDENTIFIER_POINTER (class_name));
- error ("%Jprevious declaration of '%D'",
- decl, decl);
+ error ("previous declaration of %q+D",
+ decl);
}
if (code == CLASS_IMPLEMENTATION_TYPE)
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 50228b7..a2d55a8 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -451,10 +451,10 @@ layout_decl (tree decl, unsigned int known_align)
int size_as_int = TREE_INT_CST_LOW (size);
if (compare_tree_int (size, size_as_int) == 0)
- warning (0, "%Jsize of %qD is %d bytes", decl, decl, size_as_int);
+ warning (0, "size of %q+D is %d bytes", decl, size_as_int);
else
- warning (0, "%Jsize of %qD is larger than %d bytes",
- decl, decl, larger_than_size);
+ warning (0, "size of %q+D is larger than %d bytes",
+ decl, larger_than_size);
}
}
@@ -851,11 +851,11 @@ place_field (record_layout_info rli, tree field)
if (TYPE_ALIGN (type) > desired_align)
{
if (STRICT_ALIGNMENT)
- warning (OPT_Wattributes, "%Jpacked attribute causes "
- "inefficient alignment for %qD", field, field);
+ warning (OPT_Wattributes, "packed attribute causes "
+ "inefficient alignment for %q+D", field);
else
- warning (OPT_Wattributes, "%Jpacked attribute is "
- "unnecessary for %qD", field, field);
+ warning (OPT_Wattributes, "packed attribute is "
+ "unnecessary for %q+D", field);
}
}
else
@@ -869,7 +869,7 @@ place_field (record_layout_info rli, tree field)
/* No, we need to skip space before this field.
Bump the cumulative size to multiple of field alignment. */
- warning (OPT_Wpadded, "%Jpadding struct to align %qD", field, field);
+ warning (OPT_Wpadded, "padding struct to align %q+D", field);
/* If the alignment is still within offset_align, just align
the bit position. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 32ef7e1..65caac9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2005-07-02 Joseph S. Myers <joseph@codesourcery.com>
+
+ * gcc.dg/format/gcc_diag-1.c: Update.
+
2005-07-01 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-opt/22269
diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-1.c b/gcc/testsuite/gcc.dg/format/gcc_diag-1.c
index 69e572e..e734006 100644
--- a/gcc/testsuite/gcc.dg/format/gcc_diag-1.c
+++ b/gcc/testsuite/gcc.dg/format/gcc_diag-1.c
@@ -40,6 +40,9 @@ foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p,
diag ("%d%i%o%u%x%c%s%p%%", i, i, u, u, u, i, s, p);
cdiag ("%d%i%o%u%x%c%s%p%%", i, i, u, u, u, i, s, p);
cxxdiag ("%d%i%o%u%x%c%s%p%%", i, i, u, u, u, i, s, p);
+ diag ("%qd%qi%qo%qu%qx%qc%qs%qp%<%%%'%>", i, i, u, u, u, i, s, p);
+ cdiag ("%qd%qi%qo%qu%qx%qc%qs%qp%<%%%'%>", i, i, u, u, u, i, s, p);
+ cxxdiag ("%qd%qi%qo%qu%qx%qc%qs%qp%<%%%'%>", i, i, u, u, u, i, s, p);
diag ("%ld%li%lo%lu%lx", l, l, ul, ul, ul);
cdiag ("%ld%li%lo%lu%lx", l, l, ul, ul, ul);
cxxdiag ("%ld%li%lo%lu%lx", l, l, ul, ul, ul);
@@ -65,6 +68,8 @@ foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p,
cxxdiag ("%J", t1);
cdiag ("%D%F%T", t1, t1, t1);
+ cdiag ("%+D%+F%+T", t1, t1, t1);
+ cdiag ("%q+D%q+F%q+T", t1, t1, t1);
cdiag ("%D%D%D%D", t1, t2, *t3, t4[5]);
cxxdiag ("%A%D%E%F%T%V", t1, t1, t1, t1, t1, t1);
cxxdiag ("%D%D%D%D", t1, t2, *t3, t4[5]);
@@ -107,7 +112,7 @@ foo (int i, int i1, int i2, unsigned int u, double d, char *s, void *p,
diag ("%D", t1); /* { dg-warning "format" "bogus tree" } */
cdiag ("%A", t1); /* { dg-warning "format" "bogus tree" } */
cdiag ("%#D", t1); /* { dg-warning "format" "bogus modifier" } */
- cdiag ("%+D", t1); /* { dg-warning "format" "bogus modifier" } */
+ cdiag ("%+D", t1);
cxxdiag ("%C"); /* { dg-warning "format" "missing arg" } */
cxxdiag ("%C", l); /* { dg-warning "format" "wrong arg" } */
cxxdiag ("%C", i, i); /* { dg-warning "format" "extra arg" } */
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 0cfbcd2..0b5278d 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -823,10 +823,10 @@ check_global_declarations (tree *vec, int len)
|| TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
{
if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
- pedwarn ("%J%qF used but never defined", decl, decl);
+ pedwarn ("%q+F used but never defined", decl);
else
- warning (0, "%J%qF declared %<static%> but never defined",
- decl, decl);
+ warning (0, "%q+F declared %<static%> but never defined",
+ decl);
/* This symbol is effectively an "extern" declaration now. */
TREE_PUBLIC (decl) = 1;
assemble_external (decl);
@@ -851,7 +851,7 @@ check_global_declarations (tree *vec, int len)
&& ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
/* Otherwise, ask the language. */
&& lang_hooks.decls.warn_unused_global (decl))
- warning (0, "%J%qD defined but not used", decl, decl);
+ warning (0, "%q+D defined but not used", decl);
/* Avoid confusing the debug information machinery when there are
errors. */
@@ -1356,12 +1356,12 @@ default_pch_valid_p (const void *data_p, size_t len)
/* Default tree printer. Handles declarations only. */
static bool
default_tree_printer (pretty_printer * pp, text_info *text, const char *spec,
- int precision, bool wide, bool plus, bool hash)
+ int precision, bool wide, bool set_locus, bool hash)
{
tree t;
/* FUTURE: %+x should set the locus. */
- if (precision != 0 || wide || plus || hash)
+ if (precision != 0 || wide || hash)
return false;
switch (*spec)
@@ -1381,6 +1381,9 @@ default_tree_printer (pretty_printer * pp, text_info *text, const char *spec,
return false;
}
+ if (set_locus && text->locus)
+ *text->locus = DECL_SOURCE_LOCATION (t);
+
if (DECL_P (t))
{
const char *n = DECL_NAME (t)
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 94f9371..fcaf2a6 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1321,7 +1321,7 @@ inline_forbidden_p_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
&& !lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)))
{
inline_forbidden_reason
- = G_("%Jfunction %qF can never be inlined because it uses "
+ = G_("function %q+F can never be inlined because it uses "
"alloca (override using the always_inline attribute)");
return node;
}
@@ -1333,7 +1333,7 @@ inline_forbidden_p_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
if (setjmp_call_p (t))
{
inline_forbidden_reason
- = G_("%Jfunction %qF can never be inlined because it uses setjmp");
+ = G_("function %q+F can never be inlined because it uses setjmp");
return node;
}
@@ -1347,7 +1347,7 @@ inline_forbidden_p_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
case BUILT_IN_NEXT_ARG:
case BUILT_IN_VA_END:
inline_forbidden_reason
- = G_("%Jfunction %qF can never be inlined because it "
+ = G_("function %q+F can never be inlined because it "
"uses variable argument lists");
return node;
@@ -1358,14 +1358,14 @@ inline_forbidden_p_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
function calling __builtin_longjmp to be inlined into the
function calling __builtin_setjmp, Things will Go Awry. */
inline_forbidden_reason
- = G_("%Jfunction %qF can never be inlined because "
+ = G_("function %q+F can never be inlined because "
"it uses setjmp-longjmp exception handling");
return node;
case BUILT_IN_NONLOCAL_GOTO:
/* Similarly. */
inline_forbidden_reason
- = G_("%Jfunction %qF can never be inlined because "
+ = G_("function %q+F can never be inlined because "
"it uses non-local goto");
return node;
@@ -1376,7 +1376,7 @@ inline_forbidden_p_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
been inlined into. Similarly __builtin_return would
return from the function the inline has been inlined into. */
inline_forbidden_reason
- = G_("%Jfunction %qF can never be inlined because "
+ = G_("function %q+F can never be inlined because "
"it uses __builtin_return or __builtin_apply_args");
return node;
@@ -1395,7 +1395,7 @@ inline_forbidden_p_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
if (TREE_CODE (t) != LABEL_DECL)
{
inline_forbidden_reason
- = G_("%Jfunction %qF can never be inlined "
+ = G_("function %q+F can never be inlined "
"because it contains a computed goto");
return node;
}
@@ -1409,7 +1409,7 @@ inline_forbidden_p_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
because we cannot remap the destination label used in the
function that is performing the non-local goto. */
inline_forbidden_reason
- = G_("%Jfunction %qF can never be inlined "
+ = G_("function %q+F can never be inlined "
"because it receives a non-local goto");
return node;
}
@@ -1434,7 +1434,7 @@ inline_forbidden_p_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
if (variably_modified_type_p (TREE_TYPE (t), NULL))
{
inline_forbidden_reason
- = G_("%Jfunction %qF can never be inlined "
+ = G_("function %q+F can never be inlined "
"because it uses variable sized variables");
return node;
}
@@ -1529,9 +1529,9 @@ inlinable_function_p (tree fn)
&& !DECL_IN_SYSTEM_HEADER (fn));
if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)))
- sorry (inline_forbidden_reason, fn, fn);
+ sorry (inline_forbidden_reason, fn);
else if (do_warning)
- warning (0, inline_forbidden_reason, fn, fn);
+ warning (0, inline_forbidden_reason, fn);
inlinable = false;
}
@@ -1971,7 +1971,7 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
{
if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)))
{
- sorry ("%Jinlining failed in call to %qF: %s", fn, fn, reason);
+ sorry ("inlining failed in call to %q+F: %s", fn, reason);
sorry ("called from here");
}
else if (warn_inline && DECL_DECLARED_INLINE_P (fn)
@@ -1981,8 +1981,8 @@ expand_call_inline (basic_block bb, tree stmt, tree *tp, void *data)
/* Avoid warnings during early inline pass. */
&& (!flag_unit_at_a_time || cgraph_global_info_ready))
{
- warning (OPT_Winline, "%Jinlining failed in call to %qF: %s",
- fn, fn, reason);
+ warning (OPT_Winline, "inlining failed in call to %q+F: %s",
+ fn, reason);
warning (OPT_Winline, "called from here");
}
goto egress;
diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c
index 4add52b..b8a50c7 100644
--- a/gcc/tree-optimize.c
+++ b/gcc/tree-optimize.c
@@ -970,11 +970,11 @@ tree_rest_of_compilation (tree fndecl)
= TREE_INT_CST_LOW (TYPE_SIZE_UNIT (ret_type));
if (compare_tree_int (TYPE_SIZE_UNIT (ret_type), size_as_int) == 0)
- warning (0, "%Jsize of return value of %qD is %u bytes",
- fndecl, fndecl, size_as_int);
+ warning (0, "size of return value of %q+D is %u bytes",
+ fndecl, size_as_int);
else
- warning (0, "%Jsize of return value of %qD is larger than %wd bytes",
- fndecl, fndecl, larger_than_size);
+ warning (0, "size of return value of %q+D is larger than %wd bytes",
+ fndecl, larger_than_size);
}
}
diff --git a/gcc/tree.c b/gcc/tree.c
index 9a747ac..012bb6b 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -3368,7 +3368,7 @@ handle_dll_attribute (tree * pnode, tree name, tree args, int flags,
if (TREE_CODE (node) == FUNCTION_DECL && DECL_INITIAL (node)
&& !DECL_DECLARED_INLINE_P (node))
{
- error ("%Jfunction %qD definition is marked dllimport.", node, node);
+ error ("function %q+D definition is marked dllimport.", node);
*no_add_attrs = true;
}
@@ -3376,8 +3376,8 @@ handle_dll_attribute (tree * pnode, tree name, tree args, int flags,
{
if (DECL_INITIAL (node))
{
- error ("%Jvariable %qD definition is marked dllimport.",
- node, node);
+ error ("variable %q+D definition is marked dllimport.",
+ node);
*no_add_attrs = true;
}
@@ -3396,8 +3396,8 @@ handle_dll_attribute (tree * pnode, tree name, tree args, int flags,
&& (TREE_CODE (node) == VAR_DECL
|| TREE_CODE (node) == FUNCTION_DECL))
{
- error ("%Jexternal linkage required for symbol %qD because of "
- "%qs attribute.", node, node, IDENTIFIER_POINTER (name));
+ error ("external linkage required for symbol %q+D because of "
+ "%qs attribute.", node, IDENTIFIER_POINTER (name));
*no_add_attrs = true;
}
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 9e3183d..2a11dd2 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -464,7 +464,7 @@ named_section (tree decl, const char *name, int reloc)
{
flags = get_named_section_flags (name);
if ((flags & SECTION_OVERRIDE) == 0)
- error ("%J%D causes a section type conflict", decl, decl);
+ error ("%+D causes a section type conflict", decl);
}
named_section_real (name, flags, decl);
@@ -925,15 +925,15 @@ make_decl_rtl (tree decl)
reg_number = decode_reg_name (name);
/* First detect errors in declaring global registers. */
if (reg_number == -1)
- error ("%Jregister name not specified for %qD", decl, decl);
+ error ("register name not specified for %q+D", decl);
else if (reg_number < 0)
- error ("%Jinvalid register name for %qD", decl, decl);
+ error ("invalid register name for %q+D", decl);
else if (TYPE_MODE (TREE_TYPE (decl)) == BLKmode)
- error ("%Jdata type of %qD isn%'t suitable for a register",
- decl, decl);
+ error ("data type of %q+D isn%'t suitable for a register",
+ decl);
else if (! HARD_REGNO_MODE_OK (reg_number, TYPE_MODE (TREE_TYPE (decl))))
- error ("%Jregister specified for %qD isn%'t suitable for data type",
- decl, decl);
+ error ("register specified for %q+D isn%'t suitable for data type",
+ decl);
/* Now handle properly declared static register variables. */
else
{
@@ -983,7 +983,7 @@ make_decl_rtl (tree decl)
{
reg_number = decode_reg_name (name);
if (reg_number >= 0 || reg_number == -3)
- error ("%Jregister name given for non-register variable %qD", decl, decl);
+ error ("register name given for non-register variable %q+D", decl);
}
#endif
}
@@ -1629,7 +1629,7 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED,
if (!dont_output_data && DECL_SIZE (decl) == 0)
{
- error ("%Jstorage size of %qD isn%'t known", decl, decl);
+ error ("storage size of %q+D isn%'t known", decl);
TREE_ASM_WRITTEN (decl) = 1;
return;
}
@@ -1657,7 +1657,7 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED,
if (! dont_output_data
&& ! host_integerp (DECL_SIZE_UNIT (decl), 1))
{
- error ("%Jsize of variable %qD is too large", decl, decl);
+ error ("size of variable %q+D is too large", decl);
return;
}
@@ -1680,8 +1680,8 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED,
In particular, a.out format supports a maximum alignment of 4. */
if (align > MAX_OFILE_ALIGNMENT)
{
- warning (0, "%Jalignment of %qD is greater than maximum object "
- "file alignment. Using %d", decl, decl,
+ warning (0, "alignment of %q+D is greater than maximum object "
+ "file alignment. Using %d", decl,
MAX_OFILE_ALIGNMENT/BITS_PER_UNIT);
align = MAX_OFILE_ALIGNMENT;
}
@@ -1744,8 +1744,8 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED,
#if !defined(ASM_OUTPUT_ALIGNED_COMMON) && !defined(ASM_OUTPUT_ALIGNED_DECL_COMMON) && !defined(ASM_OUTPUT_ALIGNED_BSS)
if ((unsigned HOST_WIDE_INT) DECL_ALIGN_UNIT (decl) > rounded)
- warning (0, "%Jrequested alignment for %qD is greater than "
- "implemented alignment of %d", decl, decl, rounded);
+ warning (0, "requested alignment for %q+D is greater than "
+ "implemented alignment of %d", decl, rounded);
#endif
/* If the target cannot output uninitialized but not common global data
@@ -4335,16 +4335,16 @@ merge_weak (tree newdecl, tree olddecl)
declare_weak because the NEWDECL and OLDDECL was not yet
been merged; therefore, TREE_ASM_WRITTEN was not set. */
if (TREE_ASM_WRITTEN (olddecl))
- error ("%Jweak declaration of %qD must precede definition",
- newdecl, newdecl);
+ error ("weak declaration of %q+D must precede definition",
+ newdecl);
/* If we've already generated rtl referencing OLDDECL, we may
have done so in a way that will not function properly with
a weak symbol. */
else if (TREE_USED (olddecl)
&& TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (olddecl)))
- warning (0, "%Jweak declaration of %qD after first use results "
- "in unspecified behavior", newdecl, newdecl);
+ warning (0, "weak declaration of %q+D after first use results "
+ "in unspecified behavior", newdecl);
if (SUPPORTS_WEAK)
{
@@ -4377,16 +4377,16 @@ void
declare_weak (tree decl)
{
if (! TREE_PUBLIC (decl))
- error ("%Jweak declaration of %qD must be public", decl, decl);
+ error ("weak declaration of %q+D must be public", decl);
else if (TREE_CODE (decl) == FUNCTION_DECL && TREE_ASM_WRITTEN (decl))
- error ("%Jweak declaration of %qD must precede definition", decl, decl);
+ error ("weak declaration of %q+D must precede definition", decl);
else if (SUPPORTS_WEAK)
{
if (! DECL_WEAK (decl))
weak_decls = tree_cons (NULL, decl, weak_decls);
}
else
- warning (0, "%Jweak declaration of %qD not supported", decl, decl);
+ warning (0, "weak declaration of %q+D not supported", decl);
mark_weak (decl);
}
@@ -4583,11 +4583,11 @@ finish_aliases_1 (void)
target_decl = find_decl_and_mark_needed (p->decl, p->target);
if (target_decl == NULL)
- error ("%J%qD aliased to undefined symbol %qE",
- p->decl, p->decl, p->target);
+ error ("%q+D aliased to undefined symbol %qE",
+ p->decl, p->target);
else if (DECL_EXTERNAL (target_decl))
- error ("%J%qD aliased to external symbol %qE",
- p->decl, p->decl, p->target);
+ error ("%q+D aliased to external symbol %qE",
+ p->decl, p->target);
}
}