+2005-03-18 Joseph S. Myers <joseph@codesourcery.com>
+
+ * c-common.c, c-decl.c, c-format.c, c-typeck.c: Use %D for
+ declarations in diagnostics and %E for identifiers, not %s.
+
2005-03-18 Jan Hubicka <jh@suse.cz>
Dale Johannesen <dalej@apple.com>
&& DECL_NAME (list->expr))
{
warned_ids = new_tlist (warned_ids, written, NULL_TREE);
- warning ("operation on %qs may be undefined",
- IDENTIFIER_POINTER (DECL_NAME (list->expr)));
+ warning ("operation on %qE may be undefined", list->expr);
}
list = list->next;
}
that changes what the typedef is typing. */
else
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
*no_add_attrs = true;
}
DECL_COMMON (*node) = 0;
else
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
*no_add_attrs = true;
}
DECL_COMMON (*node) = 1;
else
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
*no_add_attrs = true;
}
TYPE_READONLY (TREE_TYPE (type)), 1));
else
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
*no_add_attrs = true;
}
DECL_UNINLINABLE (*node) = 1;
else
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
*no_add_attrs = true;
}
}
else
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
*no_add_attrs = true;
}
}
else
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
*no_add_attrs = true;
}
TREE_USED (decl) = 1;
else
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
*no_add_attrs = true;
}
}
TREE_THIS_VOLATILE (TREE_TYPE (type))));
else
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
*no_add_attrs = true;
}
DECL_TRANSPARENT_UNION (decl) = 1;
else
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
*no_add_attrs = true;
}
}
else
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
*no_add_attrs = true;
}
}
else
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
*no_add_attrs = true;
}
*no_add_attrs = true;
if (TREE_CODE (TREE_VALUE (args)) != IDENTIFIER_NODE)
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
else
{
int j;
}
else
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
*no_add_attrs = true;
}
{
if (TREE_CODE (*node) != RECORD_TYPE && TREE_CODE (*node) != UNION_TYPE)
{
- warning ("%qs attribute ignored on non-class types",
- IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored on non-class types", name);
return NULL_TREE;
}
}
else if (decl_function_context (decl) != 0 || !TREE_PUBLIC (decl))
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
return NULL_TREE;
}
if (!DECL_THREAD_LOCAL (decl))
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
*no_add_attrs = true;
}
else
/* ??? TODO: Support types. */
else
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
*no_add_attrs = true;
}
DECL_IS_RETURNS_TWICE (*node) = 1;
else
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
*no_add_attrs = true;
}
/* ??? TODO: Support types. */
else
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
*no_add_attrs = true;
}
{
tree type = NULL_TREE;
int warn = 0;
- const char *what = NULL;
+ tree what = NULL_TREE;
if (DECL_P (*node))
{
if (type && TYPE_NAME (type))
{
if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
- what = IDENTIFIER_POINTER (TYPE_NAME (*node));
+ what = TYPE_NAME (*node);
else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
&& DECL_NAME (TYPE_NAME (type)))
- what = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
+ what = DECL_NAME (TYPE_NAME (type));
}
if (what)
- warning ("%qs attribute ignored for %qs",
- IDENTIFIER_POINTER (name), what);
+ warning ("%qE attribute ignored for %qE", name, what);
else
- warning ("%qs attribute ignored",
- IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
}
return NULL_TREE;
if (!host_integerp (size, 1))
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
return NULL_TREE;
}
&& GET_MODE_CLASS (orig_mode) != MODE_INT)
|| !host_integerp (TYPE_SIZE_UNIT (type), 1))
{
- error ("invalid vector type for attribute %qs",
- IDENTIFIER_POINTER (name));
+ error ("invalid vector type for attribute %qE", name);
return NULL_TREE;
}
/* ??? TODO: Support types. */
else
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
*no_add_attrs = true;
}
we'd be missing too much, since we do have attribute constructor. */
if (TREE_CODE (decl) != VAR_DECL || TREE_STATIC (decl))
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
*no_add_attrs = true;
return NULL_TREE;
}
/* Ignore the attribute for functions not returning any value. */
if (VOID_TYPE_P (TREE_TYPE (*node)))
{
- warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ warning ("%qE attribute ignored", name);
*no_add_attrs = true;
}
if (!params)
{
- warning ("%qs attribute requires prototypes with named arguments",
- IDENTIFIER_POINTER (name));
+ warning ("%qE attribute requires prototypes with named arguments", name);
*no_add_attrs = true;
}
else
if (VOID_TYPE_P (TREE_VALUE (params)))
{
- warning ("%qs attribute only applies to variadic functions",
- IDENTIFIER_POINTER (name));
+ warning ("%qE attribute only applies to variadic functions", name);
*no_add_attrs = true;
}
}
message = catenate_messages (msgid, " before numeric constant");
else if (token == CPP_NAME)
{
- message = catenate_messages (msgid, " before %qs");
- error (message, IDENTIFIER_POINTER (value));
+ message = catenate_messages (msgid, " before %qE");
+ error (message, value);
free (message);
message = NULL;
}
if (DECL_C_BIT_FIELD (t))
{
error ("attempt to take address of bit-field structure "
- "member %qs", IDENTIFIER_POINTER (DECL_NAME (t)));
+ "member %qD", t);
return error_mark_node;
}
off = size_binop (PLUS_EXPR, DECL_FIELD_OFFSET (t),
if (current_function_decl == 0)
{
- error ("label %qs referenced outside of any function",
- IDENTIFIER_POINTER (name));
+ error ("label %qE referenced outside of any function", name);
return 0;
}
at this scope */
if (b && B_IN_CURRENT_SCOPE (b))
{
- error ("duplicate label declaration %qs", IDENTIFIER_POINTER (name));
+ error ("duplicate label declaration %qE", name);
locate_old_decl (b->decl, error);
/* Just use the previous declaration. */
if (warn_traditional && !in_system_header && lookup_name (name))
warning ("%Htraditional C lacks a separate namespace for labels, "
- "identifier %qs conflicts", &location,
- IDENTIFIER_POINTER (name));
+ "identifier %qE conflicts", &location, name);
/* Mark label as having been defined. */
DECL_INITIAL (label) = error_mark_node;
pending_xref_error (void)
{
if (pending_invalid_xref != 0)
- error ("%H%qs defined as wrong kind of tag",
- &pending_invalid_xref_location,
- IDENTIFIER_POINTER (pending_invalid_xref));
+ error ("%H%qE defined as wrong kind of tag",
+ &pending_invalid_xref_location, pending_invalid_xref);
pending_invalid_xref = 0;
}
if (TYPE_SIZE (ref))
{
if (code == UNION_TYPE)
- error ("redefinition of %<union %s%>", IDENTIFIER_POINTER (name));
+ error ("redefinition of %<union %E%>", name);
else
- error ("redefinition of %<struct %s%>", IDENTIFIER_POINTER (name));
+ error ("redefinition of %<struct %E%>", name);
}
else if (C_TYPE_BEING_DEFINED (ref))
{
if (code == UNION_TYPE)
- error ("nested redefinition of %<union %s%>",
- IDENTIFIER_POINTER (name));
+ error ("nested redefinition of %<union %E%>", name);
else
- error ("nested redefinition of %<struct %s%>",
- IDENTIFIER_POINTER (name));
+ error ("nested redefinition of %<struct %E%>", name);
}
}
else
}
if (C_TYPE_BEING_DEFINED (enumtype))
- error ("nested redefinition of %<enum %s%>", IDENTIFIER_POINTER (name));
+ error ("nested redefinition of %<enum %E%>", name);
C_TYPE_BEING_DEFINED (enumtype) = 1;
if (TYPE_VALUES (enumtype) != 0)
{
/* This enum is a named one that has been declared already. */
- error ("redeclaration of %<enum %s%>", IDENTIFIER_POINTER (name));
+ error ("redeclaration of %<enum %E%>", name);
/* Completely replace its old definition.
The old enumerators remain defined, however. */
gcc_unreachable ();
}
if (dupe && pedantic && !flag_isoc99)
- pedwarn ("duplicate %qs", IDENTIFIER_POINTER (qual));
+ pedwarn ("duplicate %qE", qual);
return specs;
}
}
if (dupe)
- error ("duplicate %qs", IDENTIFIER_POINTER (type));
+ error ("duplicate %qE", type);
return specs;
}
{
tree t = lookup_name (type);
if (!t || TREE_CODE (t) != TYPE_DECL)
- error ("%qs fails to be a typedef or built in type",
- IDENTIFIER_POINTER (type));
+ error ("%qE fails to be a typedef or built in type", type);
else if (TREE_TYPE (t) == error_mark_node)
;
else
&& C_IS_RESERVED_WORD (scspec));
i = C_RID_CODE (scspec);
if (extra_warnings && specs->non_sc_seen_p)
- warning ("%qs is not at beginning of declaration",
- IDENTIFIER_POINTER (scspec));
+ warning ("%qE is not at beginning of declaration", scspec);
switch (i)
{
case RID_INLINE:
if (n != csc_none && n == specs->storage_class)
dupe = true;
if (dupe)
- error ("duplicate %qs", IDENTIFIER_POINTER (scspec));
+ error ("duplicate %qE", scspec);
if (n != csc_none)
{
if (specs->storage_class != csc_none && n != specs->storage_class)
specs->storage_class = n;
if (n != csc_extern && n != csc_static && specs->thread_p)
{
- error ("%<__thread%> used with %qs",
- IDENTIFIER_POINTER (scspec));
+ error ("%<__thread%> used with %qE", scspec);
specs->thread_p = false;
}
}
if (info->format_type == format_type_error)
{
gcc_assert (!validated_p);
- warning ("%qs is an unrecognized format function type", p);
+ warning ("%qE is an unrecognized format function type",
+ format_type_id);
return false;
}
}
if (value != 0 && (TREE_CODE (value) == VAR_DECL
|| TREE_CODE (value) == PARM_DECL))
- error ("%qs has an incomplete type",
- IDENTIFIER_POINTER (DECL_NAME (value)));
+ error ("%qD has an incomplete type", value);
else
{
retry:
}
if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
- error ("invalid use of undefined type %<%s %s%>",
- type_code_string, IDENTIFIER_POINTER (TYPE_NAME (type)));
+ error ("invalid use of undefined type %<%s %E%>",
+ type_code_string, TYPE_NAME (type));
else
/* If this type has a typedef-name, the TYPE_NAME is a TYPE_DECL. */
- error ("invalid use of incomplete typedef %qs",
- IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
+ error ("invalid use of incomplete typedef %qD", TYPE_NAME (type));
}
}
if (!field)
{
- error ("%qT has no member named %qs", type,
- IDENTIFIER_POINTER (component));
+ error ("%qT has no member named %qE", type, component);
return error_mark_node;
}
return ref;
}
else if (code != ERROR_MARK)
- error ("request for member %qs in something not a structure or union",
- IDENTIFIER_POINTER (component));
+ error ("request for member %qE in something not a structure or union",
+ component);
return error_mark_node;
}
if (TYPE_READONLY (TREE_TYPE (TREE_OPERAND (arg, 0))))
readonly_error (TREE_OPERAND (arg, 0), use);
else
- error (READONLY_MSG (N_("assignment of read-only member %qs"),
- N_("increment of read-only member %qs"),
- N_("decrement of read-only member %qs")),
- IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (arg, 1))));
+ error (READONLY_MSG (N_("assignment of read-only member %qD"),
+ N_("increment of read-only member %qD"),
+ N_("decrement of read-only member %qD")),
+ TREE_OPERAND (arg, 1));
}
else if (TREE_CODE (arg) == VAR_DECL)
- error (READONLY_MSG (N_("assignment of read-only variable %qs"),
- N_("increment of read-only variable %qs"),
- N_("decrement of read-only variable %qs")),
- IDENTIFIER_POINTER (DECL_NAME (arg)));
+ error (READONLY_MSG (N_("assignment of read-only variable %qD"),
+ N_("increment of read-only variable %qD"),
+ N_("decrement of read-only variable %qD")),
+ arg);
else
error (READONLY_MSG (N_("assignment of read-only location"),
N_("increment of read-only location"),
}
if (tail == 0)
- error ("unknown field %qs specified in initializer",
- IDENTIFIER_POINTER (fieldname));
+ error ("unknown field %qE specified in initializer", fieldname);
else
{
constructor_fields = tail;