diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-05-04 20:24:22 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-05-04 20:24:22 +0000 |
commit | d1dd9ac0caa06afe7e122d1c8012ec6fba5a9b9e (patch) | |
tree | 68743d2b81c50cab3b9196589c419307e1b8b58f | |
parent | c440daea3c9ab8fcebb25371e6808c93abfecf98 (diff) | |
download | gcc-d1dd9ac0caa06afe7e122d1c8012ec6fba5a9b9e.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147108 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/c-common.c | 7 | ||||
-rw-r--r-- | gcc/c-decl.c | 152 | ||||
-rw-r--r-- | gcc/c-parser.c | 4 | ||||
-rw-r--r-- | gcc/c-pragma.c | 6 | ||||
-rw-r--r-- | gcc/c-typeck.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/declspec-10.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/declspec-11.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/declspec-9.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/ucnid-10.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/ucnid-8.c | 14 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/ucnid-9.c | 24 |
13 files changed, 200 insertions, 70 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e2bba67ec2f..98c8052cfa3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +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> * config/rs6000/rs6000.c (rs6000_legitimate_address): Allow diff --git a/gcc/c-common.c b/gcc/c-common.c index ff8e83afdc1..9fa3b96aa61 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -6379,15 +6379,16 @@ handle_mode_attribute (tree *node, tree name, tree args, int ARG_UNUSED (flags), bool *no_add_attrs) { tree type = *node; + tree ident = TREE_VALUE (args); *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); else { int j; - const char *p = IDENTIFIER_POINTER (TREE_VALUE (args)); + const char *p = IDENTIFIER_POINTER (ident); int len = strlen (p); enum machine_mode mode = VOIDmode; tree typefm; @@ -6427,7 +6428,7 @@ handle_mode_attribute (tree *node, tree name, tree args, if (mode == VOIDmode) { - error ("unknown machine mode %qs", p); + error ("unknown machine mode %qE", ident); return NULL_TREE; } diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 88bfa25008e..a851c6de152 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3894,12 +3894,14 @@ flexible_array_type_p (tree type) /* Performs sanity checks on the TYPE and WIDTH of the bit-field NAME, replacing with appropriate values if they are invalid. */ 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; unsigned int max_width; 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 field widths. */ @@ -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. */ 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); @@ -3976,7 +3978,8 @@ warn_variable_length_array (const char *name, tree size) if (const_size) { 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", name); else @@ -3986,7 +3989,8 @@ warn_variable_length_array (const char *name, tree size) else { 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); else pedwarn (input_location, OPT_Wvla, "ISO C90 forbids variable length array"); @@ -3998,7 +4002,7 @@ warn_variable_length_array (const char *name, tree size) { if (name) warning (OPT_Wvla, - "the size of array %qs can" + "the size of array %qE can" "%'t be evaluated", name); else warning (OPT_Wvla, @@ -4008,7 +4012,7 @@ warn_variable_length_array (const char *name, tree size) { if (name) warning (OPT_Wvla, - "variable length array %qs is used", + "variable length array %qE is used", name); else warning (OPT_Wvla, @@ -4098,7 +4102,7 @@ grokdeclarator (const struct c_declarator *declarator, int restrictp; int volatilep; int type_quals = TYPE_UNQUALIFIED; - const char *name, *orig_name; + tree name = NULL_TREE; bool funcdef_flag = false; bool funcdef_syntax = false; int size_varies = 0; @@ -4126,10 +4130,9 @@ grokdeclarator (const struct c_declarator *declarator, funcdef_flag = true, decl_context = NORMAL; /* 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; - name = 0; while (decl) switch (decl->kind) @@ -4147,16 +4150,21 @@ grokdeclarator (const struct c_declarator *declarator, case cdk_id: if (decl->u.id) - name = IDENTIFIER_POINTER (decl->u.id); + name = decl->u.id; decl = 0; break; default: gcc_unreachable (); } - orig_name = name; 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 @@ -4178,7 +4186,10 @@ grokdeclarator (const struct c_declarator *declarator, && current_scope == file_scope && 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; } @@ -4194,9 +4205,16 @@ grokdeclarator (const struct c_declarator *declarator, if ((warn_implicit_int || warn_return_type || flag_isoc99) && funcdef_flag) warn_about_return_type = 1; - else - pedwarn_c99 (input_location, flag_isoc99 ? 0 : OPT_Wimplicit_int, - "type defaults to %<int%> in declaration of %qs", name); + else + { + 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, @@ -4270,11 +4288,17 @@ grokdeclarator (const struct c_declarator *declarator, switch (decl_context) { case FIELD: - error ("storage class specified for structure field %qs", - name); + if (name) + error ("storage class specified for structure field %qE", + name); + else + error ("storage class specified for structure field"); break; 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; default: error ("storage class specified for typename"); @@ -4294,26 +4318,26 @@ grokdeclarator (const struct c_declarator *declarator, /* It is fine to have 'extern const' when compiling at C and C++ intersection. */ if (!(warn_cxx_compat && constp)) - warning (0, "%qs initialized and declared %<extern%>", name); + warning (0, "%qE initialized and declared %<extern%>", name); } else - error ("%qs has both %<extern%> and initializer", name); + error ("%qE has both %<extern%> and initializer", name); } else if (current_scope == file_scope) { 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) pedwarn (input_location, OPT_pedantic, - "file-scope declaration of %qs specifies %<register%>", name); + "file-scope declaration of %qE specifies %<register%>", name); } else { 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) { - error ("function-scope %qs implicitly auto and declared " + error ("function-scope %qE implicitly auto and declared " "%<__thread%>", name); threadp = false; @@ -4407,13 +4431,19 @@ grokdeclarator (const struct c_declarator *declarator, 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; } 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; } @@ -4444,22 +4474,34 @@ grokdeclarator (const struct c_declarator *declarator, 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 = c_fully_fold (size, false, &size_maybe_const); 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) { constant_expression_warning (size); 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; } /* Handle a size folded to an integer constant but @@ -4474,16 +4516,17 @@ grokdeclarator (const struct c_declarator *declarator, if ((decl_context == NORMAL || decl_context == FIELD) && current_scope == file_scope) pedwarn (input_location, 0, - "variably modified %qs at file scope", name); + "variably modified %qE at file scope", + name); else 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) && current_scope == file_scope) { - error ("variably modified %qs at file scope", name); + error ("variably modified %qE at file scope", name); size = integer_one_node; } else @@ -4492,7 +4535,7 @@ grokdeclarator (const struct c_declarator *declarator, nonconstant even if it is (eg) a const variable with known value. */ 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) @@ -4533,7 +4576,10 @@ grokdeclarator (const struct c_declarator *declarator, if (TREE_CODE (itype) == INTEGER_CST && 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; continue; } @@ -4686,12 +4732,20 @@ grokdeclarator (const struct c_declarator *declarator, /* Warn about some types functions can't return. */ 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; } 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; } @@ -4806,7 +4860,7 @@ grokdeclarator (const struct c_declarator *declarator, /* Check the type and width of a bit-field. */ if (bitfield) - check_bitfield_type_and_width (&type, width, orig_name); + check_bitfield_type_and_width (&type, width, name); /* Did array size calculations overflow? */ @@ -4815,7 +4869,10 @@ grokdeclarator (const struct c_declarator *declarator, && TREE_CODE (TYPE_SIZE_UNIT (type)) == INTEGER_CST && 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 crash in tree_low_cst(). */ type = error_mark_node; @@ -4880,7 +4937,7 @@ grokdeclarator (const struct c_declarator *declarator, && !(storage_class == csc_static || storage_class == csc_register))))) { - error ("variable or field %qs declared void", name); + error ("variable or field %qE declared void", name); type = integer_type_node; } @@ -4958,13 +5015,13 @@ grokdeclarator (const struct c_declarator *declarator, 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); } else if (TREE_CODE (type) != ERROR_MARK && !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 = c_build_qualified_type (type, type_quals); @@ -4981,7 +5038,7 @@ grokdeclarator (const struct c_declarator *declarator, { 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) { @@ -4991,10 +5048,11 @@ grokdeclarator (const struct c_declarator *declarator, GCC allows 'auto', perhaps with 'inline', to support nested functions. */ 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) { - error ("invalid storage class for function %qs", name); + error ("invalid storage class for function %qE", name); if (funcdef_flag) storage_class = declspecs->storage_class = csc_none; else diff --git a/gcc/c-parser.c b/gcc/c-parser.c index cdc2cee4f68..6c839e9104c 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -222,8 +222,8 @@ c_lex_one_token (c_parser *parser, c_token *token) { warning_at (token->location, OPT_Wc___compat, - "identifier %qs conflicts with C++ keyword", - IDENTIFIER_POINTER (token->value)); + "identifier %qE conflicts with C++ keyword", + token->value); } else if (c_dialect_objc ()) { diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c index f33ae50f430..64a224f4a28 100644 --- a/gcc/c-pragma.c +++ b/gcc/c-pragma.c @@ -112,8 +112,8 @@ pop_alignment (tree id) } if (entry == NULL) warning (OPT_Wpragmas, "\ -#pragma pack(pop, %s) encountered without matching #pragma pack(push, %s)" - , IDENTIFIER_POINTER (id), IDENTIFIER_POINTER (id)); +#pragma pack(pop, %E) encountered without matching #pragma pack(push, %E)" + , id, id); } entry = alignment_stack->prev; @@ -179,7 +179,7 @@ handle_pragma_pack (cpp_reader * ARG_UNUSED (dummy)) else if (!strcmp (op, "pop")) action = pop; 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) { diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index f00e0dbcf5e..bef5e3814f2 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -5146,7 +5146,9 @@ static void push_member_name (tree decl) { 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); } @@ -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)) == 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 { require_constant_value = 0; require_constant_elements = 0; - locus = "(anonymous)"; + locus = _("(anonymous)"); } constructor_stack = 0; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 842105c63bd..2da28f3e53a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +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> PR c++/28152 diff --git a/gcc/testsuite/gcc.dg/declspec-10.c b/gcc/testsuite/gcc.dg/declspec-10.c index d29fb7ab45a..f938bf10e7a 100644 --- a/gcc/testsuite/gcc.dg/declspec-10.c +++ b/gcc/testsuite/gcc.dg/declspec-10.c @@ -9,11 +9,11 @@ auto void f0 (void) {} /* { dg-warning "function definition declared 'auto'" } * register void f1 (void) {} /* { dg-error "function definition declared 'register'" } */ typedef void f2 (void) {} /* { dg-error "function definition declared 'typedef'" } */ -void f3 (auto int); /* { dg-error "storage class specified for parameter 'type name'" } */ -void f4 (extern 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 unnamed parameter" } */ void f5 (register int); -void f6 (static int); /* { dg-error "storage class specified for parameter 'type name'" } */ -void f7 (typedef 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 unnamed parameter" } */ auto int x; /* { dg-error "file-scope declaration of 'x' specifies 'auto'" } */ register int y; /* { dg-warning "file-scope declaration of 'y' specifies 'register'" } */ diff --git a/gcc/testsuite/gcc.dg/declspec-11.c b/gcc/testsuite/gcc.dg/declspec-11.c index 4204b6f2188..c3fec469a81 100644 --- a/gcc/testsuite/gcc.dg/declspec-11.c +++ b/gcc/testsuite/gcc.dg/declspec-11.c @@ -9,11 +9,11 @@ auto void f0 (void) {} /* { dg-error "function definition declared 'auto'" } */ register void f1 (void) {} /* { dg-error "function definition declared 'register'" } */ typedef void f2 (void) {} /* { dg-error "function definition declared 'typedef'" } */ -void f3 (auto int); /* { dg-error "storage class specified for parameter 'type name'" } */ -void f4 (extern 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 unnamed parameter" } */ void f5 (register int); -void f6 (static int); /* { dg-error "storage class specified for parameter 'type name'" } */ -void f7 (typedef 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 unnamed parameter" } */ auto int x; /* { dg-error "file-scope declaration of 'x' specifies 'auto'" } */ register int y; /* { dg-error "file-scope declaration of 'y' specifies 'register'" } */ diff --git a/gcc/testsuite/gcc.dg/declspec-9.c b/gcc/testsuite/gcc.dg/declspec-9.c index 670fe25cbc1..ece47c66fb1 100644 --- a/gcc/testsuite/gcc.dg/declspec-9.c +++ b/gcc/testsuite/gcc.dg/declspec-9.c @@ -10,11 +10,11 @@ auto void f0 (void) {} /* { dg-warning "function definition declared 'auto'" } * register void f1 (void) {} /* { dg-error "function definition declared 'register'" } */ typedef void f2 (void) {} /* { dg-error "function definition declared 'typedef'" } */ -void f3 (auto int); /* { dg-error "storage class specified for parameter 'type name'" } */ -void f4 (extern 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 unnamed parameter" } */ void f5 (register int); -void f6 (static int); /* { dg-error "storage class specified for parameter 'type name'" } */ -void f7 (typedef 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 unnamed parameter" } */ auto int x; /* { dg-error "file-scope declaration of 'x' specifies 'auto'" } */ register int y; diff --git a/gcc/testsuite/gcc.dg/ucnid-10.c b/gcc/testsuite/gcc.dg/ucnid-10.c new file mode 100644 index 00000000000..39148108b33 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ucnid-10.c @@ -0,0 +1,8 @@ +/* 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'" } */ diff --git a/gcc/testsuite/gcc.dg/ucnid-8.c b/gcc/testsuite/gcc.dg/ucnid-8.c new file mode 100644 index 00000000000..4ec3eeba29f --- /dev/null +++ b/gcc/testsuite/gcc.dg/ucnid-8.c @@ -0,0 +1,14 @@ +/* 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 } */ diff --git a/gcc/testsuite/gcc.dg/ucnid-9.c b/gcc/testsuite/gcc.dg/ucnid-9.c new file mode 100644 index 00000000000..c563b91106d --- /dev/null +++ b/gcc/testsuite/gcc.dg/ucnid-9.c @@ -0,0 +1,24 @@ +/* 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); +} |