+2009-05-04 Joseph Myers <joseph@codesourcery.com>
+
+ * attribs.c (decl_attributes): Use %qE for identifiers in
+ diagnostics.
+ * cgraphunit.c (verify_cgraph_node): Translate function names to
+ locale character set in diagnostics.
+ * coverage.c (get_coverage_counts): Use %qE for identifiers in
+ diagnostics.
+ * doc/invoke.texi (-finstrument-functions-exclude-function-list):
+ Document that functions are named in UTF-8.
+ * expr.c (expand_expr_real_1): Translate function names to locale
+ character set in diagnostics.
+ * gimplify.c (omp_notice_variable, omp_is_private,
+ gimplify_scan_omp_clauses): Use %qE for identifiers in
+ diagnostics.
+ * langhooks.c (lhd_print_error_function): Translate function names
+ to locale character set.
+ * langhooks.h (decl_printable_name): Document that return value is
+ in internal character set.
+ * stmt.c: Include pretty-print.h
+ (tree_conflicts_with_clobbers_p): Use %qE for identifiers in
+ diagnostics.
+ (resolve_operand_name_1): Translate named operand name to locale
+ character set.
+ * stor-layout.c (finalize_record_size): Use %qE for identifiers in
+ diagnostics.
+ * toplev.c (announce_function): Translate function names to locale
+ character set.
+ (warn_deprecated_use): Use %qE for identifiers in diagnostics.
+ (default_tree_printer): Use pp_identifier or translate identifiers
+ to locale character set. Mark "<anonymous>" for translation.
+ * tree-mudflap.c (mx_register_decls, mudflap_finish_file): Use %qE
+ for identifiers in diagnostics.
+ * tree.c (handle_dll_attribute): Use %qE for identifiers in
+ diagnostics.
+ * varasm.c (output_constructor): Use %qE for identifiers in
+ diagnostics.
+
2009-05-04 Rafael Avila de Espindola <espindola@google.com>
* configure.ac: use ` ` instead of $()
if (spec == NULL)
{
- warning (OPT_Wattributes, "%qs attribute directive ignored",
- IDENTIFIER_POINTER (name));
+ warning (OPT_Wattributes, "%qE attribute directive ignored",
+ name);
continue;
}
else if (list_length (args) < spec->min_length
|| (spec->max_length >= 0
&& list_length (args) > spec->max_length))
{
- error ("wrong number of arguments specified for %qs attribute",
- IDENTIFIER_POINTER (name));
+ error ("wrong number of arguments specified for %qE attribute",
+ name);
continue;
}
gcc_assert (is_attribute_p (spec->name, name));
}
else
{
- warning (OPT_Wattributes, "%qs attribute does not apply to types",
- IDENTIFIER_POINTER (name));
+ warning (OPT_Wattributes, "%qE attribute does not apply to types",
+ name);
continue;
}
}
&& TREE_CODE (*anode) != METHOD_TYPE)
{
warning (OPT_Wattributes,
- "%qs attribute only applies to function types",
- IDENTIFIER_POINTER (name));
+ "%qE attribute only applies to function types",
+ name);
continue;
}
}
if (e->aux)
{
error ("aux field set for edge %s->%s",
- cgraph_node_name (e->caller), cgraph_node_name (e->callee));
+ identifier_to_locale (cgraph_node_name (e->caller)),
+ identifier_to_locale (cgraph_node_name (e->callee)));
error_found = true;
}
if (node->count < 0)
if (!e->aux && !e->indirect_call)
{
error ("edge %s->%s has no corresponding call_stmt",
- cgraph_node_name (e->caller),
- cgraph_node_name (e->callee));
+ identifier_to_locale (cgraph_node_name (e->caller)),
+ identifier_to_locale (cgraph_node_name (e->callee)));
debug_gimple_stmt (e->call_stmt);
error_found = true;
}
entry = (counts_entry_t *) htab_find (counts_hash, &elt);
if (!entry)
{
- warning (0, "no coverage for function %qs found", IDENTIFIER_POINTER
- (DECL_ASSEMBLER_NAME (current_function_decl)));
+ warning (0, "no coverage for function %qE found",
+ DECL_ASSEMBLER_NAME (current_function_decl));
return NULL;
}
|| entry->summary.num != expected)
{
static int warned = 0;
- const char *id = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME
- (current_function_decl));
+ tree id = DECL_ASSEMBLER_NAME (current_function_decl);
if (warn_coverage_mismatch)
warning (OPT_Wcoverage_mismatch, "coverage mismatch for function "
- "%qs while reading counter %qs", id, ctr_names[counter]);
+ "%qE while reading counter %qs", id, ctr_names[counter]);
else
- error ("coverage mismatch for function %qs while reading counter %qs",
+ error ("coverage mismatch for function %qE while reading counter %qs",
id, ctr_names[counter]);
if (!inhibit_warnings)
name, such as @code{vector<int> blah(const vector<int> &)}, not the
internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
match is done on substrings: if the @var{sym} parameter is a substring
-of the function name, it is considered to be a match.
+of the function name, it is considered to be a match. For C99 and C++
+extended identifiers, the function name must be given in UTF-8, not
+using universal character names.
@item -fstack-check
@opindex fstack-check
&& (attr = lookup_attribute ("error",
DECL_ATTRIBUTES (fndecl))) != NULL)
error ("%Kcall to %qs declared with attribute error: %s",
- exp, lang_hooks.decl_printable_name (fndecl, 1),
+ exp, identifier_to_locale (lang_hooks.decl_printable_name (fndecl, 1)),
TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr))));
if (fndecl
&& (attr = lookup_attribute ("warning",
DECL_ATTRIBUTES (fndecl))) != NULL)
warning_at (tree_nonartificial_location (exp),
0, "%Kcall to %qs declared with attribute warning: %s",
- exp, lang_hooks.decl_printable_name (fndecl, 1),
+ exp, identifier_to_locale (lang_hooks.decl_printable_name (fndecl, 1)),
TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr))));
/* Check for a built-in function. */
switch (default_kind)
{
case OMP_CLAUSE_DEFAULT_NONE:
- error ("%qs not specified in enclosing parallel",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
+ error ("%qE not specified in enclosing parallel",
+ DECL_NAME (decl));
error ("%Henclosing parallel", &ctx->location);
/* FALLTHRU */
case OMP_CLAUSE_DEFAULT_SHARED:
{
if (ctx == gimplify_omp_ctxp)
{
- error ("iteration variable %qs should be private",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
+ error ("iteration variable %qE should be private",
+ DECL_NAME (decl));
n->value = GOVD_PRIVATE;
return true;
}
&& gimplify_omp_ctxp->outer_context == ctx)))
{
if ((n->value & GOVD_FIRSTPRIVATE) != 0)
- error ("iteration variable %qs should not be firstprivate",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
+ error ("iteration variable %qE should not be firstprivate",
+ DECL_NAME (decl));
else if ((n->value & GOVD_REDUCTION) != 0)
- error ("iteration variable %qs should not be reduction",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
+ error ("iteration variable %qE should not be reduction",
+ DECL_NAME (decl));
}
return (ctx == gimplify_omp_ctxp
|| (ctx->region_type == ORT_COMBINED_PARALLEL
&& region_type == ORT_WORKSHARE
&& omp_check_private (ctx, decl))
{
- error ("%s variable %qs is private in outer context",
- check_non_private, IDENTIFIER_POINTER (DECL_NAME (decl)));
+ error ("%s variable %qE is private in outer context",
+ check_non_private, DECL_NAME (decl));
remove = true;
}
break;
if (TREE_CODE (TREE_TYPE (fndecl)) == METHOD_TYPE)
pp_printf
(context->printer, _("In member function %qs"),
- lang_hooks.decl_printable_name (fndecl, 2));
+ identifier_to_locale (lang_hooks.decl_printable_name (fndecl, 2)));
else
pp_printf
(context->printer, _("In function %qs"),
- lang_hooks.decl_printable_name (fndecl, 2));
+ identifier_to_locale (lang_hooks.decl_printable_name (fndecl, 2)));
while (abstract_origin)
{
if (flag_show_column && s.column != 0)
pp_printf (context->printer,
_(" inlined from %qs at %s:%d:%d"),
- lang_hooks.decl_printable_name (fndecl, 2),
+ identifier_to_locale (lang_hooks.decl_printable_name (fndecl, 2)),
s.file, s.line, s.column);
else
pp_printf (context->printer,
_(" inlined from %qs at %s:%d"),
- lang_hooks.decl_printable_name (fndecl, 2),
+ identifier_to_locale (lang_hooks.decl_printable_name (fndecl, 2)),
s.file, s.line);
}
else
pp_printf (context->printer, _(" inlined from %qs"),
- lang_hooks.decl_printable_name (fndecl, 2));
+ identifier_to_locale (lang_hooks.decl_printable_name (fndecl, 2)));
}
}
pp_character (context->printer, ':');
/* The lang_hooks data structure.
- Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GCC.
information will be printed: 0: DECL_NAME, demangled as
necessary. 1: and scope information. 2: and any other
information that might be interesting, such as function parameter
- types in C++. */
+ types in C++. The name is in the internal character set and
+ needs to be converted to the locale character set of diagnostics,
+ or to the execution character set for strings such as
+ __PRETTY_FUNCTION__. */
const char *(*decl_printable_name) (tree decl, int verbosity);
/* Computes the dwarf-2/3 name for a tree. VERBOSITY determines what
#include "target.h"
#include "regs.h"
#include "alloc-pool.h"
+#include "pretty-print.h"
\f
/* Functions and data structures for expanding case statements. */
if (overlap)
{
- error ("asm-specifier for variable %qs conflicts with asm clobber list",
- IDENTIFIER_POINTER (DECL_NAME (overlap)));
+ error ("asm-specifier for variable %qE conflicts with asm clobber list",
+ DECL_NAME (overlap));
/* Reset registerness to stop multiple errors emitted for a single
variable. */
}
*q = '\0';
- error ("undefined named operand %qs", p + 1);
+ error ("undefined named operand %qs", identifier_to_locale (p + 1));
op = 0;
found:
if (TYPE_NAME (rli->t))
{
- const char *name;
+ tree name;
if (TREE_CODE (TYPE_NAME (rli->t)) == IDENTIFIER_NODE)
- name = IDENTIFIER_POINTER (TYPE_NAME (rli->t));
+ name = TYPE_NAME (rli->t);
else
- name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (rli->t)));
+ name = DECL_NAME (TYPE_NAME (rli->t));
if (STRICT_ALIGNMENT)
warning (OPT_Wpacked, "packed attribute causes inefficient "
- "alignment for %qs", name);
+ "alignment for %qE", name);
else
warning (OPT_Wpacked,
- "packed attribute is unnecessary for %qs", name);
+ "packed attribute is unnecessary for %qE", name);
}
else
{
2009-05-04 Joseph Myers <joseph@codesourcery.com>
+ * gcc.dg/ucnid-11.c, gcc.dg/ucnid-12.c, gcc.dg/ucnid-13.c: New
+ tests.
+
+2009-05-04 Joseph Myers <joseph@codesourcery.com>
+
* gcc.dg/ucnid-8.c, gcc.dg/ucnid-9.c, gcc.dg/ucnid-10.c: New
tests.
* gcc.dg/declspec-9.c, gcc.dg/declspec-10.c, gcc.dg/declspec-11.c:
--- /dev/null
+/* { dg-do run } */
+/* { dg-xfail-if "" { powerpc-ibm-aix* *-*-solaris2.* } { "*" } { "" } } */
+/* { dg-options "-std=c99 -fextended-identifiers -fdata-sections" } */
+
+#include "ucnid-3.c"
--- /dev/null
+/* { dg-do run } */
+/* { dg-xfail-if "" { powerpc-ibm-aix* *-*-solaris2.* } { "*" } { "" } } */
+/* { dg-options "-std=c99 -fextended-identifiers -ffunction-sections" } */
+
+#include "ucnid-4.c"
--- /dev/null
+/* Verify diagnostics for extended identifiers refer to UCNs (in the C
+ locale). Miscellaneous diagnostics. */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -fextended-identifiers -Wpacked" } */
+
+int a __attribute__((\u00c0)); /* { dg-warning "'\\\\U000000c0' attribute directive ignored" } */
+
+extern void \u00c1 (void) __attribute__((deprecated));
+void g (void) { \u00c1 (); } /* { dg-warning "'\\\\U000000c1' is deprecated" } */
+
+struct \u00c2 { char c; } __attribute__((packed)); /* { dg-warning "'\\\\U000000c2'" } */
+
+void h (void) { asm ("%[\u00c3]" : : ); } /* { dg-error "undefined named operand '\\\\U000000c3'" } */
if (!quiet_flag)
{
if (rtl_dump_and_exit)
- fprintf (stderr, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl)));
+ fprintf (stderr, "%s ",
+ identifier_to_locale (IDENTIFIER_POINTER (DECL_NAME (decl))));
else
- fprintf (stderr, " %s", lang_hooks.decl_printable_name (decl, 2));
+ fprintf (stderr, " %s",
+ identifier_to_locale (lang_hooks.decl_printable_name (decl, 2)));
fflush (stderr);
pp_needs_newline (global_dc->printer) = true;
diagnostic_set_last_function (global_dc, (diagnostic_info *) NULL);
}
else if (TYPE_P (node))
{
- const char *what = NULL;
+ tree what = NULL_TREE;
tree decl = TYPE_STUB_DECL (node);
if (TYPE_NAME (node))
{
if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
- what = IDENTIFIER_POINTER (TYPE_NAME (node));
+ what = TYPE_NAME (node);
else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
&& DECL_NAME (TYPE_NAME (node)))
- what = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node)));
+ what = DECL_NAME (TYPE_NAME (node));
}
if (decl)
= expand_location (DECL_SOURCE_LOCATION (decl));
if (what)
warning (OPT_Wdeprecated_declarations,
- "%qs is deprecated (declared at %s:%d)", what,
+ "%qE is deprecated (declared at %s:%d)", what,
xloc.file, xloc.line);
else
warning (OPT_Wdeprecated_declarations,
else
{
if (what)
- warning (OPT_Wdeprecated_declarations, "%qs is deprecated", what);
+ warning (OPT_Wdeprecated_declarations, "%qE is deprecated", what);
else
warning (OPT_Wdeprecated_declarations, "type is deprecated");
}
t = va_arg (*text->args_ptr, tree);
if (TREE_CODE (t) == IDENTIFIER_NODE)
{
- pp_string (pp, IDENTIFIER_POINTER (t));
+ pp_identifier (pp, IDENTIFIER_POINTER (t));
return true;
}
break;
if (DECL_P (t))
{
const char *n = DECL_NAME (t)
- ? lang_hooks.decl_printable_name (t, 2)
- : "<anonymous>";
+ ? identifier_to_locale (lang_hooks.decl_printable_name (t, 2))
+ : _("<anonymous>");
pp_string (pp, n);
}
else
{
if (!DECL_ARTIFICIAL (decl))
warning (OPT_Wmudflap,
- "mudflap cannot track %qs in stub function",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
+ "mudflap cannot track %qE in stub function",
+ DECL_NAME (decl));
}
else
{
if (! COMPLETE_TYPE_P (TREE_TYPE (obj)))
{
warning (OPT_Wmudflap,
- "mudflap cannot track unknown size extern %qs",
- IDENTIFIER_POINTER (DECL_NAME (obj)));
+ "mudflap cannot track unknown size extern %qE",
+ DECL_NAME (obj));
continue;
}
}
else
{
- warning (OPT_Wattributes, "%qs attribute ignored",
- IDENTIFIER_POINTER (name));
+ warning (OPT_Wattributes, "%qE attribute ignored",
+ name);
*no_add_attrs = true;
return NULL_TREE;
}
&& TREE_CODE (node) != TYPE_DECL)
{
*no_add_attrs = true;
- warning (OPT_Wattributes, "%qs attribute ignored",
- IDENTIFIER_POINTER (name));
+ warning (OPT_Wattributes, "%qE attribute ignored",
+ name);
return NULL_TREE;
}
&& TREE_CODE (TREE_TYPE (node)) != UNION_TYPE)
{
*no_add_attrs = true;
- warning (OPT_Wattributes, "%qs attribute ignored",
- IDENTIFIER_POINTER (name));
+ warning (OPT_Wattributes, "%qE attribute ignored",
+ name);
return NULL_TREE;
}
|| TREE_CODE (node) == FUNCTION_DECL))
{
error ("external linkage required for symbol %q+D because of "
- "%qs attribute", node, IDENTIFIER_POINTER (name));
+ "%qE attribute", node, name);
*no_add_attrs = true;
}
{
if (DECL_VISIBILITY_SPECIFIED (node)
&& DECL_VISIBILITY (node) != VISIBILITY_DEFAULT)
- error ("%qs implies default visibility, but %qD has already "
+ error ("%qE implies default visibility, but %qD has already "
"been declared with a different visibility",
- IDENTIFIER_POINTER (name), node);
+ name, node);
DECL_VISIBILITY (node) = VISIBILITY_DEFAULT;
DECL_VISIBILITY_SPECIFIED (node) = 1;
}
total_bytes += fieldsize;
}
else if (val != 0 && TREE_CODE (val) != INTEGER_CST)
- error ("invalid initial value for member %qs",
- IDENTIFIER_POINTER (DECL_NAME (field)));
+ error ("invalid initial value for member %qE",
+ DECL_NAME (field));
else
{
/* Element that is a bit-field. */