+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.
&& 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
}
else
{
- error ("%Jsection attribute not allowed for %qD", *node, *node);
+ error ("section attribute not allowed for %q+D", *node);
*no_add_attrs = true;
}
}
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
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;
}
&& !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);
/* 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);
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;
&& !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. */
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;
}
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;
}
/* 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
}
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.
&& 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;
}
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;
}
/* 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;
}
}
&& 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;
&& 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;
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;
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;
}
|| (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;
}
&& !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;
}
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;
{
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;
}
}
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;
/* 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;
}
{
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;
}
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);
}
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;
}
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;
}
{
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;
}
}
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;
}
&& !(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;
}
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);
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?
&& 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. */
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.
break;
case 3:
- error ("%Jzero or negative size array %qD", decl, decl);
+ error ("zero or negative size array %q+D", decl);
break;
case 0:
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;
}
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))
&& 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
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;
}
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)
{
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
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);
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);
/* 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))
{
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;
}
}
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;
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);
&& 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
&& 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
&& 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.
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))
{
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:
|| 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:
|| 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;
}
}
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.
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;
}
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);
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;
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
/* 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
{
{
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:
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);
}
}
}
&& !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;
}
}
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 },
{ "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 },
'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',
&& 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;
}
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;
}
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;
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':
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);
}
&& !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. */
&& !DECL_VIRTUAL_P (decl)
&& 0 /*???*/)
{
- error ("%Jstatic variable '%D' is marked dllimport", decl, decl);
+ error ("static variable %q+D is marked dllimport", decl);
return;
}
{
/* 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;
}
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;
}
&& !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;
}
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;
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);
}
}
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;
&& !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;
&& !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;
}
{
/* 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;
}
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;
}
&& !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;
}
{
/* 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
{
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");
{
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;
}
&& ( 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;
}
{
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);
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;
}
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;
+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
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
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;
}
/* 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
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));
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;
}
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);
}
}
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);
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;
}
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),
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
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
{
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;
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;
}
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);
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))
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. */
{
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))
&& !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. */
&& !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. */
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);
}
}
#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 */
{
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
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);
&& ! 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))
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.
&& 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);
}
}
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;
}
|| 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
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;
}
{
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;
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;
}
}
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
{
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
&& 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
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));
}
{
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);
}
}
&& ! (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);
}
}
{
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;
&& 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);
}
}
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)
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;
}
/* 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)
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;
}
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);
}
}
}
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));
}
&& 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)))
{
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);
"%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.
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
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
&& 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
&& 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
&& 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
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
#include "cgraph.h"
#include "tree-inline.h"
#include "c-pragma.h"
+#include "intl.h"
extern cpp_reader *parse_in;
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))
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,
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. */
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;
}
}
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
return pp_formatted_text (cxx_pp);
}
+/* Return the location of a tree passed to %+ formats. */
+
static location_t
location_of (tree t)
{
#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);
-}
{
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
{
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;
}
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);
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;
}
[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. */
&& !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);
}
}
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,
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;
{
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;
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);
}
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;
}
{
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;
}
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;
}
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;
}
}
!= 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:
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 = " ";
}
}
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;
|| 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,
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));
|| (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;
}
nargs, nparms);
if (in_decl)
- cp_error_at ("provided for %qD", in_decl);
+ error ("provided for %q+D", in_decl);
}
return error_mark_node;
{
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);
}
{
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 = " ";
}
}
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;
{
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;
}
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;
}
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
{
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;
/* 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;
}
{
/* 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
{
{
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;
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;
}
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;
}
}
{
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
{
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
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;
}
|| 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;
}
}
/* 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;
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);
"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. */
{
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)
|| 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:
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:
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:
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;
}
&& 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))
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);
}
\f
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;
+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
&& ! 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)
/* 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
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
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);
}
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);
}
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),
+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.
{
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);
}
}
/* 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;
{
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)
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);
}
}
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
/* 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. */
+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
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);
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]);
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" } */
|| 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);
&& ! (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. */
/* 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)
return false;
}
+ if (set_locus && text->locus)
+ *text->locus = DECL_SOURCE_LOCATION (t);
+
if (DECL_P (t))
{
const char *n = DECL_NAME (t)
&& !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;
}
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;
}
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;
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;
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;
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;
}
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;
}
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;
}
&& !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;
}
{
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)
/* 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;
= 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);
}
}
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;
}
{
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;
}
&& (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;
}
{
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);
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
{
{
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
}
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;
}
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;
}
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;
}
#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
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)
{
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);
}
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);
}
}