Commit 88388a52 by Joseph Myers Committed by Joseph Myers

c-common.c (handle_mode_attribute): Use %qE for identifiers in diagnostics.

	* c-common.c (handle_mode_attribute): Use %qE for identifiers in
	diagnostics.
	* c-decl.c (check_bitfield_type_and_width): Make orig_name a tree
	and pass value to identifier_to_locale.
	(warn_variable_length_array): Make name a tree.
	(grokdeclarator): Separate diagnostic texts for named and unnamed
	declarators.  Use %qE for named declarators.
	* c-parser.c (c_lex_one_token): Use %qE for identifiers in
	diagnostics.
	* c-pragma.c (pop_alignment, handle_pragma_pack): Use %qE for
	identifiers in diagnostics.
	* c-typeck.c (push_member_name, start_init): Pass identifiers to
	identifier_to_locale.  Mark "anonymous" strings for translation.

testsuite:
	* 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:
	Update expected errors.

From-SVN: r147108
parent 960c5c79
2009-05-04 Joseph Myers <joseph@codesourcery.com>
* c-common.c (handle_mode_attribute): Use %qE for identifiers in
diagnostics.
* c-decl.c (check_bitfield_type_and_width): Make orig_name a tree
and pass value to identifier_to_locale.
(warn_variable_length_array): Make name a tree.
(grokdeclarator): Separate diagnostic texts for named and unnamed
declarators. Use %qE for named declarators.
* c-parser.c (c_lex_one_token): Use %qE for identifiers in
diagnostics.
* c-pragma.c (pop_alignment, handle_pragma_pack): Use %qE for
identifiers in diagnostics.
* c-typeck.c (push_member_name, start_init): Pass identifiers to
identifier_to_locale. Mark "anonymous" strings for translation.
2009-05-04 Michael Eager <eager@eagercon.com> 2009-05-04 Michael Eager <eager@eagercon.com>
* config/rs6000/rs6000.c (rs6000_legitimate_address): Allow * config/rs6000/rs6000.c (rs6000_legitimate_address): Allow
......
...@@ -6379,15 +6379,16 @@ handle_mode_attribute (tree *node, tree name, tree args, ...@@ -6379,15 +6379,16 @@ handle_mode_attribute (tree *node, tree name, tree args,
int ARG_UNUSED (flags), bool *no_add_attrs) int ARG_UNUSED (flags), bool *no_add_attrs)
{ {
tree type = *node; tree type = *node;
tree ident = TREE_VALUE (args);
*no_add_attrs = true; *no_add_attrs = true;
if (TREE_CODE (TREE_VALUE (args)) != IDENTIFIER_NODE) if (TREE_CODE (ident) != IDENTIFIER_NODE)
warning (OPT_Wattributes, "%qE attribute ignored", name); warning (OPT_Wattributes, "%qE attribute ignored", name);
else else
{ {
int j; int j;
const char *p = IDENTIFIER_POINTER (TREE_VALUE (args)); const char *p = IDENTIFIER_POINTER (ident);
int len = strlen (p); int len = strlen (p);
enum machine_mode mode = VOIDmode; enum machine_mode mode = VOIDmode;
tree typefm; tree typefm;
...@@ -6427,7 +6428,7 @@ handle_mode_attribute (tree *node, tree name, tree args, ...@@ -6427,7 +6428,7 @@ handle_mode_attribute (tree *node, tree name, tree args,
if (mode == VOIDmode) if (mode == VOIDmode)
{ {
error ("unknown machine mode %qs", p); error ("unknown machine mode %qE", ident);
return NULL_TREE; return NULL_TREE;
} }
......
...@@ -3894,12 +3894,14 @@ flexible_array_type_p (tree type) ...@@ -3894,12 +3894,14 @@ flexible_array_type_p (tree type)
/* Performs sanity checks on the TYPE and WIDTH of the bit-field NAME, /* Performs sanity checks on the TYPE and WIDTH of the bit-field NAME,
replacing with appropriate values if they are invalid. */ replacing with appropriate values if they are invalid. */
static void static void
check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name) check_bitfield_type_and_width (tree *type, tree *width, tree orig_name)
{ {
tree type_mv; tree type_mv;
unsigned int max_width; unsigned int max_width;
unsigned HOST_WIDE_INT w; unsigned HOST_WIDE_INT w;
const char *name = orig_name ? orig_name: _("<anonymous>"); const char *name = (orig_name
? identifier_to_locale (IDENTIFIER_POINTER (orig_name))
: _("<anonymous>"));
/* Detect and ignore out of range field width and process valid /* Detect and ignore out of range field width and process valid
field widths. */ field widths. */
...@@ -3967,7 +3969,7 @@ check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name) ...@@ -3967,7 +3969,7 @@ check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name)
/* Print warning about variable length array if necessary. */ /* Print warning about variable length array if necessary. */
static void static void
warn_variable_length_array (const char *name, tree size) warn_variable_length_array (tree name, tree size)
{ {
int const_size = TREE_CONSTANT (size); int const_size = TREE_CONSTANT (size);
...@@ -3976,7 +3978,8 @@ warn_variable_length_array (const char *name, tree size) ...@@ -3976,7 +3978,8 @@ warn_variable_length_array (const char *name, tree size)
if (const_size) if (const_size)
{ {
if (name) if (name)
pedwarn (input_location, OPT_Wvla, "ISO C90 forbids array %qs whose size " pedwarn (input_location, OPT_Wvla,
"ISO C90 forbids array %qE whose size "
"can%'t be evaluated", "can%'t be evaluated",
name); name);
else else
...@@ -3986,7 +3989,8 @@ warn_variable_length_array (const char *name, tree size) ...@@ -3986,7 +3989,8 @@ warn_variable_length_array (const char *name, tree size)
else else
{ {
if (name) if (name)
pedwarn (input_location, OPT_Wvla, "ISO C90 forbids variable length array %qs", pedwarn (input_location, OPT_Wvla,
"ISO C90 forbids variable length array %qE",
name); name);
else else
pedwarn (input_location, OPT_Wvla, "ISO C90 forbids variable length array"); pedwarn (input_location, OPT_Wvla, "ISO C90 forbids variable length array");
...@@ -3998,7 +4002,7 @@ warn_variable_length_array (const char *name, tree size) ...@@ -3998,7 +4002,7 @@ warn_variable_length_array (const char *name, tree size)
{ {
if (name) if (name)
warning (OPT_Wvla, warning (OPT_Wvla,
"the size of array %qs can" "the size of array %qE can"
"%'t be evaluated", name); "%'t be evaluated", name);
else else
warning (OPT_Wvla, warning (OPT_Wvla,
...@@ -4008,7 +4012,7 @@ warn_variable_length_array (const char *name, tree size) ...@@ -4008,7 +4012,7 @@ warn_variable_length_array (const char *name, tree size)
{ {
if (name) if (name)
warning (OPT_Wvla, warning (OPT_Wvla,
"variable length array %qs is used", "variable length array %qE is used",
name); name);
else else
warning (OPT_Wvla, warning (OPT_Wvla,
...@@ -4098,7 +4102,7 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4098,7 +4102,7 @@ grokdeclarator (const struct c_declarator *declarator,
int restrictp; int restrictp;
int volatilep; int volatilep;
int type_quals = TYPE_UNQUALIFIED; int type_quals = TYPE_UNQUALIFIED;
const char *name, *orig_name; tree name = NULL_TREE;
bool funcdef_flag = false; bool funcdef_flag = false;
bool funcdef_syntax = false; bool funcdef_syntax = false;
int size_varies = 0; int size_varies = 0;
...@@ -4126,10 +4130,9 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4126,10 +4130,9 @@ grokdeclarator (const struct c_declarator *declarator,
funcdef_flag = true, decl_context = NORMAL; funcdef_flag = true, decl_context = NORMAL;
/* Look inside a declarator for the name being declared /* Look inside a declarator for the name being declared
and get it as a string, for an error message. */ and get it as an IDENTIFIER_NODE, for an error message. */
{ {
const struct c_declarator *decl = declarator; const struct c_declarator *decl = declarator;
name = 0;
while (decl) while (decl)
switch (decl->kind) switch (decl->kind)
...@@ -4147,16 +4150,21 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4147,16 +4150,21 @@ grokdeclarator (const struct c_declarator *declarator,
case cdk_id: case cdk_id:
if (decl->u.id) if (decl->u.id)
name = IDENTIFIER_POINTER (decl->u.id); name = decl->u.id;
decl = 0; decl = 0;
break; break;
default: default:
gcc_unreachable (); gcc_unreachable ();
} }
orig_name = name;
if (name == 0) if (name == 0)
name = "type name"; {
gcc_assert (decl_context == PARM
|| decl_context == TYPENAME
|| (decl_context == FIELD
&& declarator->kind == cdk_id));
gcc_assert (!initialized);
}
} }
/* A function definition's declarator must have the form of /* A function definition's declarator must have the form of
...@@ -4178,7 +4186,10 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4178,7 +4186,10 @@ grokdeclarator (const struct c_declarator *declarator,
&& current_scope == file_scope && current_scope == file_scope
&& variably_modified_type_p (type, NULL_TREE)) && variably_modified_type_p (type, NULL_TREE))
{ {
error ("variably modified %qs at file scope", name); if (name)
error ("variably modified %qE at file scope", name);
else
error ("variably modified field at file scope");
type = integer_type_node; type = integer_type_node;
} }
...@@ -4194,9 +4205,16 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4194,9 +4205,16 @@ grokdeclarator (const struct c_declarator *declarator,
if ((warn_implicit_int || warn_return_type || flag_isoc99) if ((warn_implicit_int || warn_return_type || flag_isoc99)
&& funcdef_flag) && funcdef_flag)
warn_about_return_type = 1; warn_about_return_type = 1;
else else
pedwarn_c99 (input_location, flag_isoc99 ? 0 : OPT_Wimplicit_int, {
"type defaults to %<int%> in declaration of %qs", name); if (name)
pedwarn_c99 (input_location, flag_isoc99 ? 0 : OPT_Wimplicit_int,
"type defaults to %<int%> in declaration of %qE",
name);
else
pedwarn_c99 (input_location, flag_isoc99 ? 0 : OPT_Wimplicit_int,
"type defaults to %<int%> in type name");
}
} }
/* Adjust the type if a bit-field is being declared, /* Adjust the type if a bit-field is being declared,
...@@ -4270,11 +4288,17 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4270,11 +4288,17 @@ grokdeclarator (const struct c_declarator *declarator,
switch (decl_context) switch (decl_context)
{ {
case FIELD: case FIELD:
error ("storage class specified for structure field %qs", if (name)
name); error ("storage class specified for structure field %qE",
name);
else
error ("storage class specified for structure field");
break; break;
case PARM: case PARM:
error ("storage class specified for parameter %qs", name); if (name)
error ("storage class specified for parameter %qE", name);
else
error ("storage class specified for unnamed parameter");
break; break;
default: default:
error ("storage class specified for typename"); error ("storage class specified for typename");
...@@ -4294,26 +4318,26 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4294,26 +4318,26 @@ grokdeclarator (const struct c_declarator *declarator,
/* It is fine to have 'extern const' when compiling at C /* It is fine to have 'extern const' when compiling at C
and C++ intersection. */ and C++ intersection. */
if (!(warn_cxx_compat && constp)) if (!(warn_cxx_compat && constp))
warning (0, "%qs initialized and declared %<extern%>", name); warning (0, "%qE initialized and declared %<extern%>", name);
} }
else else
error ("%qs has both %<extern%> and initializer", name); error ("%qE has both %<extern%> and initializer", name);
} }
else if (current_scope == file_scope) else if (current_scope == file_scope)
{ {
if (storage_class == csc_auto) if (storage_class == csc_auto)
error ("file-scope declaration of %qs specifies %<auto%>", name); error ("file-scope declaration of %qE specifies %<auto%>", name);
if (pedantic && storage_class == csc_register) if (pedantic && storage_class == csc_register)
pedwarn (input_location, OPT_pedantic, pedwarn (input_location, OPT_pedantic,
"file-scope declaration of %qs specifies %<register%>", name); "file-scope declaration of %qE specifies %<register%>", name);
} }
else else
{ {
if (storage_class == csc_extern && funcdef_flag) if (storage_class == csc_extern && funcdef_flag)
error ("nested function %qs declared %<extern%>", name); error ("nested function %qE declared %<extern%>", name);
else if (threadp && storage_class == csc_none) else if (threadp && storage_class == csc_none)
{ {
error ("function-scope %qs implicitly auto and declared " error ("function-scope %qE implicitly auto and declared "
"%<__thread%>", "%<__thread%>",
name); name);
threadp = false; threadp = false;
...@@ -4407,13 +4431,19 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4407,13 +4431,19 @@ grokdeclarator (const struct c_declarator *declarator,
if (VOID_TYPE_P (type)) if (VOID_TYPE_P (type))
{ {
error ("declaration of %qs as array of voids", name); if (name)
error ("declaration of %qE as array of voids", name);
else
error ("declaration of type name as array of voids");
type = error_mark_node; type = error_mark_node;
} }
if (TREE_CODE (type) == FUNCTION_TYPE) if (TREE_CODE (type) == FUNCTION_TYPE)
{ {
error ("declaration of %qs as array of functions", name); if (name)
error ("declaration of %qE as array of functions", name);
else
error ("declaration of type name as array of functions");
type = error_mark_node; type = error_mark_node;
} }
...@@ -4444,22 +4474,34 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4444,22 +4474,34 @@ grokdeclarator (const struct c_declarator *declarator,
if (!INTEGRAL_TYPE_P (TREE_TYPE (size))) if (!INTEGRAL_TYPE_P (TREE_TYPE (size)))
{ {
error ("size of array %qs has non-integer type", name); if (name)
error ("size of array %qE has non-integer type", name);
else
error ("size of unnamed array has non-integer type");
size = integer_one_node; size = integer_one_node;
} }
size = c_fully_fold (size, false, &size_maybe_const); size = c_fully_fold (size, false, &size_maybe_const);
if (pedantic && size_maybe_const && integer_zerop (size)) if (pedantic && size_maybe_const && integer_zerop (size))
pedwarn (input_location, OPT_pedantic, {
"ISO C forbids zero-size array %qs", name); if (name)
pedwarn (input_location, OPT_pedantic,
"ISO C forbids zero-size array %qE", name);
else
pedwarn (input_location, OPT_pedantic,
"ISO C forbids zero-size array");
}
if (TREE_CODE (size) == INTEGER_CST && size_maybe_const) if (TREE_CODE (size) == INTEGER_CST && size_maybe_const)
{ {
constant_expression_warning (size); constant_expression_warning (size);
if (tree_int_cst_sgn (size) < 0) if (tree_int_cst_sgn (size) < 0)
{ {
error ("size of array %qs is negative", name); if (name)
error ("size of array %qE is negative", name);
else
error ("size of unnamed array is negative");
size = integer_one_node; size = integer_one_node;
} }
/* Handle a size folded to an integer constant but /* Handle a size folded to an integer constant but
...@@ -4474,16 +4516,17 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4474,16 +4516,17 @@ grokdeclarator (const struct c_declarator *declarator,
if ((decl_context == NORMAL || decl_context == FIELD) if ((decl_context == NORMAL || decl_context == FIELD)
&& current_scope == file_scope) && current_scope == file_scope)
pedwarn (input_location, 0, pedwarn (input_location, 0,
"variably modified %qs at file scope", name); "variably modified %qE at file scope",
name);
else else
this_size_varies = size_varies = 1; this_size_varies = size_varies = 1;
warn_variable_length_array (orig_name, size); warn_variable_length_array (name, size);
} }
} }
else if ((decl_context == NORMAL || decl_context == FIELD) else if ((decl_context == NORMAL || decl_context == FIELD)
&& current_scope == file_scope) && current_scope == file_scope)
{ {
error ("variably modified %qs at file scope", name); error ("variably modified %qE at file scope", name);
size = integer_one_node; size = integer_one_node;
} }
else else
...@@ -4492,7 +4535,7 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4492,7 +4535,7 @@ grokdeclarator (const struct c_declarator *declarator,
nonconstant even if it is (eg) a const variable nonconstant even if it is (eg) a const variable
with known value. */ with known value. */
this_size_varies = size_varies = 1; this_size_varies = size_varies = 1;
warn_variable_length_array (orig_name, size); warn_variable_length_array (name, size);
} }
if (integer_zerop (size) && !this_size_varies) if (integer_zerop (size) && !this_size_varies)
...@@ -4533,7 +4576,10 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4533,7 +4576,10 @@ grokdeclarator (const struct c_declarator *declarator,
if (TREE_CODE (itype) == INTEGER_CST if (TREE_CODE (itype) == INTEGER_CST
&& TREE_OVERFLOW (itype)) && TREE_OVERFLOW (itype))
{ {
error ("size of array %qs is too large", name); if (name)
error ("size of array %qE is too large", name);
else
error ("size of unnamed array is too large");
type = error_mark_node; type = error_mark_node;
continue; continue;
} }
...@@ -4686,12 +4732,20 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4686,12 +4732,20 @@ grokdeclarator (const struct c_declarator *declarator,
/* Warn about some types functions can't return. */ /* Warn about some types functions can't return. */
if (TREE_CODE (type) == FUNCTION_TYPE) if (TREE_CODE (type) == FUNCTION_TYPE)
{ {
error ("%qs declared as function returning a function", name); if (name)
error ("%qE declared as function returning a function",
name);
else
error ("type name declared as function "
"returning a function");
type = integer_type_node; type = integer_type_node;
} }
if (TREE_CODE (type) == ARRAY_TYPE) if (TREE_CODE (type) == ARRAY_TYPE)
{ {
error ("%qs declared as function returning an array", name); if (name)
error ("%qE declared as function returning an array", name);
else
error ("type name declared as function returning an array");
type = integer_type_node; type = integer_type_node;
} }
...@@ -4806,7 +4860,7 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4806,7 +4860,7 @@ grokdeclarator (const struct c_declarator *declarator,
/* Check the type and width of a bit-field. */ /* Check the type and width of a bit-field. */
if (bitfield) if (bitfield)
check_bitfield_type_and_width (&type, width, orig_name); check_bitfield_type_and_width (&type, width, name);
/* Did array size calculations overflow? */ /* Did array size calculations overflow? */
...@@ -4815,7 +4869,10 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4815,7 +4869,10 @@ grokdeclarator (const struct c_declarator *declarator,
&& TREE_CODE (TYPE_SIZE_UNIT (type)) == INTEGER_CST && TREE_CODE (TYPE_SIZE_UNIT (type)) == INTEGER_CST
&& TREE_OVERFLOW (TYPE_SIZE_UNIT (type))) && TREE_OVERFLOW (TYPE_SIZE_UNIT (type)))
{ {
error ("size of array %qs is too large", name); if (name)
error ("size of array %qE is too large", name);
else
error ("size of unnamed array is too large");
/* If we proceed with the array type as it is, we'll eventually /* If we proceed with the array type as it is, we'll eventually
crash in tree_low_cst(). */ crash in tree_low_cst(). */
type = error_mark_node; type = error_mark_node;
...@@ -4880,7 +4937,7 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4880,7 +4937,7 @@ grokdeclarator (const struct c_declarator *declarator,
&& !(storage_class == csc_static && !(storage_class == csc_static
|| storage_class == csc_register))))) || storage_class == csc_register)))))
{ {
error ("variable or field %qs declared void", name); error ("variable or field %qE declared void", name);
type = integer_type_node; type = integer_type_node;
} }
...@@ -4958,13 +5015,13 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4958,13 +5015,13 @@ grokdeclarator (const struct c_declarator *declarator,
if (TREE_CODE (type) == FUNCTION_TYPE) if (TREE_CODE (type) == FUNCTION_TYPE)
{ {
error ("field %qs declared as a function", name); error ("field %qE declared as a function", name);
type = build_pointer_type (type); type = build_pointer_type (type);
} }
else if (TREE_CODE (type) != ERROR_MARK else if (TREE_CODE (type) != ERROR_MARK
&& !COMPLETE_OR_UNBOUND_ARRAY_TYPE_P (type)) && !COMPLETE_OR_UNBOUND_ARRAY_TYPE_P (type))
{ {
error ("field %qs has incomplete type", name); error ("field %qE has incomplete type", name);
type = error_mark_node; type = error_mark_node;
} }
type = c_build_qualified_type (type, type_quals); type = c_build_qualified_type (type, type_quals);
...@@ -4981,7 +5038,7 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4981,7 +5038,7 @@ grokdeclarator (const struct c_declarator *declarator,
{ {
if (storage_class == csc_register || threadp) if (storage_class == csc_register || threadp)
{ {
error ("invalid storage class for function %qs", name); error ("invalid storage class for function %qE", name);
} }
else if (current_scope != file_scope) else if (current_scope != file_scope)
{ {
...@@ -4991,10 +5048,11 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -4991,10 +5048,11 @@ grokdeclarator (const struct c_declarator *declarator,
GCC allows 'auto', perhaps with 'inline', to support GCC allows 'auto', perhaps with 'inline', to support
nested functions. */ nested functions. */
if (storage_class == csc_auto) if (storage_class == csc_auto)
pedwarn (input_location, OPT_pedantic, "invalid storage class for function %qs", name); pedwarn (input_location, OPT_pedantic,
"invalid storage class for function %qE", name);
else if (storage_class == csc_static) else if (storage_class == csc_static)
{ {
error ("invalid storage class for function %qs", name); error ("invalid storage class for function %qE", name);
if (funcdef_flag) if (funcdef_flag)
storage_class = declspecs->storage_class = csc_none; storage_class = declspecs->storage_class = csc_none;
else else
......
...@@ -222,8 +222,8 @@ c_lex_one_token (c_parser *parser, c_token *token) ...@@ -222,8 +222,8 @@ c_lex_one_token (c_parser *parser, c_token *token)
{ {
warning_at (token->location, warning_at (token->location,
OPT_Wc___compat, OPT_Wc___compat,
"identifier %qs conflicts with C++ keyword", "identifier %qE conflicts with C++ keyword",
IDENTIFIER_POINTER (token->value)); token->value);
} }
else if (c_dialect_objc ()) else if (c_dialect_objc ())
{ {
......
...@@ -112,8 +112,8 @@ pop_alignment (tree id) ...@@ -112,8 +112,8 @@ pop_alignment (tree id)
} }
if (entry == NULL) if (entry == NULL)
warning (OPT_Wpragmas, "\ warning (OPT_Wpragmas, "\
#pragma pack(pop, %s) encountered without matching #pragma pack(push, %s)" #pragma pack(pop, %E) encountered without matching #pragma pack(push, %E)"
, IDENTIFIER_POINTER (id), IDENTIFIER_POINTER (id)); , id, id);
} }
entry = alignment_stack->prev; entry = alignment_stack->prev;
...@@ -179,7 +179,7 @@ handle_pragma_pack (cpp_reader * ARG_UNUSED (dummy)) ...@@ -179,7 +179,7 @@ handle_pragma_pack (cpp_reader * ARG_UNUSED (dummy))
else if (!strcmp (op, "pop")) else if (!strcmp (op, "pop"))
action = pop; action = pop;
else else
GCC_BAD2 ("unknown action %qs for %<#pragma pack%> - ignored", op); GCC_BAD2 ("unknown action %qE for %<#pragma pack%> - ignored", x);
while ((token = pragma_lex (&x)) == CPP_COMMA) while ((token = pragma_lex (&x)) == CPP_COMMA)
{ {
......
...@@ -5146,7 +5146,9 @@ static void ...@@ -5146,7 +5146,9 @@ static void
push_member_name (tree decl) push_member_name (tree decl)
{ {
const char *const string const char *const string
= DECL_NAME (decl) ? IDENTIFIER_POINTER (DECL_NAME (decl)) : "<anonymous>"; = (DECL_NAME (decl)
? identifier_to_locale (IDENTIFIER_POINTER (DECL_NAME (decl)))
: _("<anonymous>"));
PUSH_SPELLING (SPELLING_MEMBER, string, u.s); PUSH_SPELLING (SPELLING_MEMBER, string, u.s);
} }
...@@ -5765,13 +5767,13 @@ start_init (tree decl, tree asmspec_tree ATTRIBUTE_UNUSED, int top_level) ...@@ -5765,13 +5767,13 @@ start_init (tree decl, tree asmspec_tree ATTRIBUTE_UNUSED, int top_level)
|| TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE || TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE
|| TREE_CODE (TREE_TYPE (decl)) == QUAL_UNION_TYPE)); || TREE_CODE (TREE_TYPE (decl)) == QUAL_UNION_TYPE));
locus = IDENTIFIER_POINTER (DECL_NAME (decl)); locus = identifier_to_locale (IDENTIFIER_POINTER (DECL_NAME (decl)));
} }
else else
{ {
require_constant_value = 0; require_constant_value = 0;
require_constant_elements = 0; require_constant_elements = 0;
locus = "(anonymous)"; locus = _("(anonymous)");
} }
constructor_stack = 0; constructor_stack = 0;
......
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:
Update expected errors.
2009-05-04 Manuel Lopez-Ibanez <manu@gcc.gnu.org> 2009-05-04 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c++/28152 PR c++/28152
......
...@@ -9,11 +9,11 @@ auto void f0 (void) {} /* { dg-warning "function definition declared 'auto'" } * ...@@ -9,11 +9,11 @@ auto void f0 (void) {} /* { dg-warning "function definition declared 'auto'" } *
register void f1 (void) {} /* { dg-error "function definition declared 'register'" } */ register void f1 (void) {} /* { dg-error "function definition declared 'register'" } */
typedef void f2 (void) {} /* { dg-error "function definition declared 'typedef'" } */ typedef void f2 (void) {} /* { dg-error "function definition declared 'typedef'" } */
void f3 (auto int); /* { dg-error "storage class specified for parameter 'type name'" } */ void f3 (auto int); /* { dg-error "storage class specified for unnamed parameter" } */
void f4 (extern int); /* { dg-error "storage class specified for parameter 'type name'" } */ void f4 (extern int); /* { dg-error "storage class specified for unnamed parameter" } */
void f5 (register int); void f5 (register int);
void f6 (static int); /* { dg-error "storage class specified for parameter 'type name'" } */ void f6 (static int); /* { dg-error "storage class specified for unnamed parameter" } */
void f7 (typedef int); /* { dg-error "storage class specified for parameter 'type name'" } */ void f7 (typedef int); /* { dg-error "storage class specified for unnamed parameter" } */
auto int x; /* { dg-error "file-scope declaration of 'x' specifies 'auto'" } */ auto int x; /* { dg-error "file-scope declaration of 'x' specifies 'auto'" } */
register int y; /* { dg-warning "file-scope declaration of 'y' specifies 'register'" } */ register int y; /* { dg-warning "file-scope declaration of 'y' specifies 'register'" } */
......
...@@ -9,11 +9,11 @@ auto void f0 (void) {} /* { dg-error "function definition declared 'auto'" } */ ...@@ -9,11 +9,11 @@ auto void f0 (void) {} /* { dg-error "function definition declared 'auto'" } */
register void f1 (void) {} /* { dg-error "function definition declared 'register'" } */ register void f1 (void) {} /* { dg-error "function definition declared 'register'" } */
typedef void f2 (void) {} /* { dg-error "function definition declared 'typedef'" } */ typedef void f2 (void) {} /* { dg-error "function definition declared 'typedef'" } */
void f3 (auto int); /* { dg-error "storage class specified for parameter 'type name'" } */ void f3 (auto int); /* { dg-error "storage class specified for unnamed parameter" } */
void f4 (extern int); /* { dg-error "storage class specified for parameter 'type name'" } */ void f4 (extern int); /* { dg-error "storage class specified for unnamed parameter" } */
void f5 (register int); void f5 (register int);
void f6 (static int); /* { dg-error "storage class specified for parameter 'type name'" } */ void f6 (static int); /* { dg-error "storage class specified for unnamed parameter" } */
void f7 (typedef int); /* { dg-error "storage class specified for parameter 'type name'" } */ void f7 (typedef int); /* { dg-error "storage class specified for unnamed parameter" } */
auto int x; /* { dg-error "file-scope declaration of 'x' specifies 'auto'" } */ auto int x; /* { dg-error "file-scope declaration of 'x' specifies 'auto'" } */
register int y; /* { dg-error "file-scope declaration of 'y' specifies 'register'" } */ register int y; /* { dg-error "file-scope declaration of 'y' specifies 'register'" } */
......
...@@ -10,11 +10,11 @@ auto void f0 (void) {} /* { dg-warning "function definition declared 'auto'" } * ...@@ -10,11 +10,11 @@ auto void f0 (void) {} /* { dg-warning "function definition declared 'auto'" } *
register void f1 (void) {} /* { dg-error "function definition declared 'register'" } */ register void f1 (void) {} /* { dg-error "function definition declared 'register'" } */
typedef void f2 (void) {} /* { dg-error "function definition declared 'typedef'" } */ typedef void f2 (void) {} /* { dg-error "function definition declared 'typedef'" } */
void f3 (auto int); /* { dg-error "storage class specified for parameter 'type name'" } */ void f3 (auto int); /* { dg-error "storage class specified for unnamed parameter" } */
void f4 (extern int); /* { dg-error "storage class specified for parameter 'type name'" } */ void f4 (extern int); /* { dg-error "storage class specified for unnamed parameter" } */
void f5 (register int); void f5 (register int);
void f6 (static int); /* { dg-error "storage class specified for parameter 'type name'" } */ void f6 (static int); /* { dg-error "storage class specified for unnamed parameter" } */
void f7 (typedef int); /* { dg-error "storage class specified for parameter 'type name'" } */ void f7 (typedef int); /* { dg-error "storage class specified for unnamed parameter" } */
auto int x; /* { dg-error "file-scope declaration of 'x' specifies 'auto'" } */ auto int x; /* { dg-error "file-scope declaration of 'x' specifies 'auto'" } */
register int y; register int y;
......
/* Verify diagnostics for extended identifiers refer to UCNs (in the C
locale). Test #pragma pack diagnostics. */
/* { dg-do compile { target *-*-linux* *-*-cygwin* powerpc*-*-eabi* } } */
/* { dg-options "-std=gnu99 -fextended-identifiers" } */
#pragma pack(push)
#pragma pack(pop, \u00f3) /* { dg-warning "pop, \\\\U000000f3.*push, \\\\U000000f3" } */
#pragma pack(\u00e7) /* { dg-warning "unknown action '\\\\U000000e7'" } */
/* Verify diagnostics for extended identifiers refer to UCNs (in the C
locale). Further tests of C front-end diagnostics. */
/* { dg-do compile } */
/* { dg-options "-std=gnu99 -fextended-identifiers -Wvla" } */
int a __attribute__((__mode__(\u00e9))); /* { dg-error "unknown machine mode '\\\\U000000e9'" } */
struct s1 { int \u00e9 : 0; }; /* { dg-error "zero width for bit-field '\\\\U000000e9'" } */
void f (int b) { int \u00e9[b]; } /* { dg-warning "variable length array '\\\\U000000e9'" } */
void g (static int \u00e9); /* { dg-error "storage class specified for parameter '\\\\U000000e9'" } */
struct s2 { int \u00e1; } \u00e9 = { { 0 } }; /* { dg-warning "braces around scalar initializer" } */
/* { dg-warning "near initialization for '\\\\U000000e9\\.\\\\U000000e1'" "UCN diag" { target *-*-* } 13 } */
/* Test __func__ with extended identifiers and character set
conversions. */
/* { dg-do run } */
/* { dg-xfail-if "" { "powerpc-ibm-aix*" } { "*" } { "" } } */
/* { dg-options "-std=c99 -fextended-identifiers -fexec-charset=ISO-8859-1" } */
/* { dg-require-iconv "ISO-8859-1" } */
extern int strcmp (const char *, const char *);
extern void abort (void);
extern void exit (int);
void
\u00e9 (void)
{
if (strcmp (__func__, "\u00e9") != 0)
abort ();
}
int
main (void)
{
\u00e9 ();
exit (0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment