Convert diagnostics to use quoting flag q 3/n
cp/ Convert diagnostics to use quoting flag q 3/n * decl.c (pop_label, duplicate_decls, redeclaration_error_message, redeclaration_error_message, lookup_label, check_goto, make_typename_type, make_unbound_class_template, fixup_anonymous_aggr, check_tag_decl, start_decl, start_decl_1, grok_reference_init, layout_var_decl, maybe_commonize_var, check_for_uninitialized_const_var, reshape_init_array, reshape_init, check_initializer, cp_finish_decl, member_function_or_else, bad_specifiers, grokfndecl, grokvardecl, check_static_variable_definition, compute_array_index_type, create_array_type_for_decl, check_special_function_return_type, grokdeclarator, check_default_argument, grokparms, grok_ctor_properties, grok_op_properties, check_elaborated_type_specifier, xref_tag, finish_enum, build_enumerator, check_function_type, start_preparsed_function, store_parm_decls): Use quoting formats. * decl2.c (grok_array_decl, delete_sanity, check_member_template, check_java_method, check_classfn, finish_static_data_member_decl, grokfield, grokbitfield, grok_function_init, build_anon_union_vars, coerce_new_type, coerce_delete_type, check_default_args): Likewise. * parser.c (cp_parser_decl_specifier_seq): Likewise. testsuite/ * g++.dg/template/local1.C: Adjust quoting marks in testing for diagnostics. * g++.dg/tls/diag-2.C: Likewise. * g++.dg/other/error8.C: Likewise. From-SVN: r88478
This commit is contained in:
parent
b9e6959bf6
commit
2d01edd760
|
@ -1,3 +1,28 @@
|
|||
2004-10-03 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||
|
||||
Convert diagnostics to use quoting flag q 3/n
|
||||
* decl.c (pop_label, duplicate_decls, redeclaration_error_message,
|
||||
redeclaration_error_message, lookup_label, check_goto,
|
||||
make_typename_type, make_unbound_class_template,
|
||||
fixup_anonymous_aggr, check_tag_decl, start_decl, start_decl_1,
|
||||
grok_reference_init, layout_var_decl, maybe_commonize_var,
|
||||
check_for_uninitialized_const_var, reshape_init_array,
|
||||
reshape_init, check_initializer, cp_finish_decl,
|
||||
member_function_or_else, bad_specifiers, grokfndecl, grokvardecl,
|
||||
check_static_variable_definition, compute_array_index_type,
|
||||
create_array_type_for_decl, check_special_function_return_type,
|
||||
grokdeclarator, check_default_argument, grokparms,
|
||||
grok_ctor_properties, grok_op_properties,
|
||||
check_elaborated_type_specifier, xref_tag, finish_enum,
|
||||
build_enumerator, check_function_type, start_preparsed_function,
|
||||
store_parm_decls): Use quoting formats.
|
||||
* decl2.c (grok_array_decl, delete_sanity, check_member_template,
|
||||
check_java_method, check_classfn, finish_static_data_member_decl,
|
||||
grokfield, grokbitfield, grok_function_init,
|
||||
build_anon_union_vars, coerce_new_type, coerce_delete_type,
|
||||
check_default_args): Likewise.
|
||||
* parser.c (cp_parser_decl_specifier_seq): Likewise.
|
||||
|
||||
2004-10-03 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||
|
||||
Convert diagnostics to use quoting flag q 2/n
|
||||
|
|
658
gcc/cp/decl.c
658
gcc/cp/decl.c
File diff suppressed because it is too large
Load Diff
|
@ -378,8 +378,8 @@ grok_array_decl (tree array_expr, tree index_exp)
|
|||
array_expr = p2, index_exp = i1;
|
||||
else
|
||||
{
|
||||
error ("invalid types `%T[%T]' for array subscript",
|
||||
type, TREE_TYPE (index_exp));
|
||||
error ("invalid types %<%T[%T]%> for array subscript",
|
||||
type, TREE_TYPE (index_exp));
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -423,14 +423,14 @@ delete_sanity (tree exp, tree size, bool doing_vec, int use_global_delete)
|
|||
/* An array can't have been allocated by new, so complain. */
|
||||
if (TREE_CODE (exp) == VAR_DECL
|
||||
&& TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE)
|
||||
warning ("deleting array `%#D'", exp);
|
||||
warning ("deleting array %q#D", exp);
|
||||
|
||||
t = build_expr_type_conversion (WANT_POINTER, exp, true);
|
||||
|
||||
if (t == NULL_TREE || t == error_mark_node)
|
||||
{
|
||||
error ("type `%#T' argument given to `delete', expected pointer",
|
||||
TREE_TYPE (exp));
|
||||
error ("type %q#T argument given to %<delete%>, expected pointer",
|
||||
TREE_TYPE (exp));
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -441,14 +441,15 @@ delete_sanity (tree exp, tree size, bool doing_vec, int use_global_delete)
|
|||
/* You can't delete functions. */
|
||||
if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
|
||||
{
|
||||
error ("cannot delete a function. Only pointer-to-objects are valid arguments to `delete'");
|
||||
error ("cannot delete a function. Only pointer-to-objects are "
|
||||
"valid arguments to %<delete%>");
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
/* Deleting ptr to void is undefined behavior [expr.delete/3]. */
|
||||
if (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE)
|
||||
{
|
||||
warning ("deleting `%T' is undefined", type);
|
||||
warning ("deleting %qT is undefined", type);
|
||||
doing_vec = 0;
|
||||
}
|
||||
|
||||
|
@ -484,8 +485,8 @@ check_member_template (tree tmpl)
|
|||
/* 14.5.2.2 [temp.mem]
|
||||
|
||||
A local class shall not have member templates. */
|
||||
error ("invalid declaration of member template `%#D' in local class",
|
||||
decl);
|
||||
error ("invalid declaration of member template %q#D in local class",
|
||||
decl);
|
||||
|
||||
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl))
|
||||
{
|
||||
|
@ -493,7 +494,7 @@ check_member_template (tree tmpl)
|
|||
|
||||
A member function template shall not be virtual. */
|
||||
error
|
||||
("invalid use of `virtual' in template declaration of `%#D'",
|
||||
("invalid use of %<virtual%> in template declaration of %q#D",
|
||||
decl);
|
||||
DECL_VIRTUAL_P (decl) = 0;
|
||||
}
|
||||
|
@ -503,7 +504,7 @@ check_member_template (tree tmpl)
|
|||
DECL_IGNORED_P (tmpl) = 1;
|
||||
}
|
||||
else
|
||||
error ("template declaration of `%#D'", decl);
|
||||
error ("template declaration of %q#D", decl);
|
||||
}
|
||||
|
||||
/* Return true iff TYPE is a valid Java parameter or return type. */
|
||||
|
@ -552,8 +553,8 @@ check_java_method (tree method)
|
|||
|
||||
if (!acceptable_java_type (ret_type))
|
||||
{
|
||||
error ("Java method '%D' has non-Java return type `%T'",
|
||||
method, ret_type);
|
||||
error ("Java method %qD has non-Java return type %qT",
|
||||
method, ret_type);
|
||||
jerr = true;
|
||||
}
|
||||
|
||||
|
@ -568,8 +569,8 @@ check_java_method (tree method)
|
|||
tree type = TREE_VALUE (arg_types);
|
||||
if (!acceptable_java_type (type))
|
||||
{
|
||||
error ("Java method '%D' has non-Java parameter type `%T'",
|
||||
method, type);
|
||||
error ("Java method %qD has non-Java parameter type %qT",
|
||||
method, type);
|
||||
jerr = true;
|
||||
}
|
||||
}
|
||||
|
@ -715,7 +716,7 @@ check_classfn (tree ctype, tree function, tree template_parms)
|
|||
else if (!COMPLETE_TYPE_P (ctype))
|
||||
cxx_incomplete_type_error (function, ctype);
|
||||
else
|
||||
error ("no `%#D' member function declared in class `%T'",
|
||||
error ("no %q#D member function declared in class %qT",
|
||||
function, ctype);
|
||||
|
||||
/* If we did not find the method in the class, add it to avoid
|
||||
|
@ -778,7 +779,7 @@ finish_static_data_member_decl (tree decl, tree init, tree asmspec_tree,
|
|||
note_vague_linkage_var (decl);
|
||||
|
||||
if (LOCAL_CLASS_P (current_class_type))
|
||||
pedwarn ("local class `%#T' shall not have static data member `%#D'",
|
||||
pedwarn ("local class %q#T shall not have static data member %q#D",
|
||||
current_class_type, decl);
|
||||
|
||||
/* Static consts need not be initialized in the class definition. */
|
||||
|
@ -853,7 +854,7 @@ grokfield (const cp_declarator *declarator,
|
|||
|
||||
if (TREE_CODE (value) == TYPE_DECL && init)
|
||||
{
|
||||
error ("typedef `%D' is initialized (use __typeof__ instead)", value);
|
||||
error ("typedef %qD is initialized (use __typeof__ instead)", value);
|
||||
init = NULL_TREE;
|
||||
}
|
||||
|
||||
|
@ -870,8 +871,8 @@ grokfield (const cp_declarator *declarator,
|
|||
if (DECL_NAME (value) != NULL_TREE
|
||||
&& IDENTIFIER_POINTER (DECL_NAME (value))[0] == '_'
|
||||
&& ! strcmp (IDENTIFIER_POINTER (DECL_NAME (value)), "_vptr"))
|
||||
error ("member `%D' conflicts with virtual function table field name",
|
||||
value);
|
||||
error ("member %qD conflicts with virtual function table field name",
|
||||
value);
|
||||
|
||||
/* Stash away type declarations. */
|
||||
if (TREE_CODE (value) == TYPE_DECL)
|
||||
|
@ -887,8 +888,7 @@ grokfield (const cp_declarator *declarator,
|
|||
|
||||
if (DECL_IN_AGGR_P (value))
|
||||
{
|
||||
error ("`%D' is already defined in `%T'", value,
|
||||
DECL_CONTEXT (value));
|
||||
error ("%qD is already defined in %qT", value, DECL_CONTEXT (value));
|
||||
return void_type_node;
|
||||
}
|
||||
|
||||
|
@ -1008,7 +1008,7 @@ grokbitfield (const cp_declarator *declarator,
|
|||
|
||||
if (TREE_CODE (value) == TYPE_DECL)
|
||||
{
|
||||
error ("cannot declare `%D' to be a bit-field type", value);
|
||||
error ("cannot declare %qD to be a bit-field type", value);
|
||||
return NULL_TREE;
|
||||
}
|
||||
|
||||
|
@ -1018,21 +1018,21 @@ grokbitfield (const cp_declarator *declarator,
|
|||
check here. */
|
||||
if (TREE_CODE (value) == FUNCTION_DECL)
|
||||
{
|
||||
error ("cannot declare bit-field `%D' with function type",
|
||||
error ("cannot declare bit-field %qD with function type",
|
||||
DECL_NAME (value));
|
||||
return NULL_TREE;
|
||||
}
|
||||
|
||||
if (DECL_IN_AGGR_P (value))
|
||||
{
|
||||
error ("`%D' is already defined in the class %T", value,
|
||||
DECL_CONTEXT (value));
|
||||
error ("%qD is already defined in the class %qT", value,
|
||||
DECL_CONTEXT (value));
|
||||
return void_type_node;
|
||||
}
|
||||
|
||||
if (TREE_STATIC (value))
|
||||
{
|
||||
error ("static member `%D' cannot be a bit-field", value);
|
||||
error ("static member %qD cannot be a bit-field", value);
|
||||
return NULL_TREE;
|
||||
}
|
||||
cp_finish_decl (value, NULL_TREE, NULL_TREE, 0);
|
||||
|
@ -1091,11 +1091,11 @@ grok_function_init (tree decl, tree init)
|
|||
tree type = TREE_TYPE (decl);
|
||||
|
||||
if (TREE_CODE (type) == FUNCTION_TYPE)
|
||||
error ("initializer specified for non-member function `%D'", decl);
|
||||
error ("initializer specified for non-member function %qD", decl);
|
||||
else if (integer_zerop (init))
|
||||
DECL_PURE_VIRTUAL_P (decl) = 1;
|
||||
else
|
||||
error ("invalid initializer for virtual method `%D'", decl);
|
||||
error ("invalid initializer for virtual method %qD", decl);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1140,16 +1140,16 @@ build_anon_union_vars (tree object)
|
|||
continue;
|
||||
if (TREE_CODE (field) != FIELD_DECL)
|
||||
{
|
||||
cp_pedwarn_at ("\
|
||||
`%#D' invalid; an anonymous union can only have non-static data members",
|
||||
cp_pedwarn_at ("%q#D invalid; an anonymous union can only "
|
||||
"have non-static data members",
|
||||
field);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (TREE_PRIVATE (field))
|
||||
cp_pedwarn_at ("private member `%#D' in anonymous union", field);
|
||||
cp_pedwarn_at ("private member %q#D in anonymous union", field);
|
||||
else if (TREE_PROTECTED (field))
|
||||
cp_pedwarn_at ("protected member `%#D' in anonymous union", field);
|
||||
cp_pedwarn_at ("protected member %q#D in anonymous union", field);
|
||||
|
||||
if (processing_template_decl)
|
||||
ref = build_min_nt (COMPONENT_REF, object,
|
||||
|
@ -1239,7 +1239,10 @@ coerce_new_type (tree type)
|
|||
gcc_assert (TREE_CODE (type) == FUNCTION_TYPE);
|
||||
|
||||
if (!same_type_p (TREE_TYPE (type), ptr_type_node))
|
||||
e = 1, error ("`operator new' must return type `%T'", ptr_type_node);
|
||||
{
|
||||
e = 1;
|
||||
error ("%<operator new%> must return type %qT", ptr_type_node);
|
||||
}
|
||||
|
||||
if (!args || args == void_list_node
|
||||
|| !same_type_p (TREE_VALUE (args), size_type_node))
|
||||
|
@ -1247,7 +1250,8 @@ coerce_new_type (tree type)
|
|||
e = 2;
|
||||
if (args && args != void_list_node)
|
||||
args = TREE_CHAIN (args);
|
||||
pedwarn ("`operator new' takes type `size_t' (`%T') as first parameter", size_type_node);
|
||||
pedwarn ("%<operator new%> takes type %<size_t%> (%qT) "
|
||||
"as first parameter", size_type_node);
|
||||
}
|
||||
switch (e)
|
||||
{
|
||||
|
@ -1273,7 +1277,10 @@ coerce_delete_type (tree type)
|
|||
gcc_assert (TREE_CODE (type) == FUNCTION_TYPE);
|
||||
|
||||
if (!same_type_p (TREE_TYPE (type), void_type_node))
|
||||
e = 1, error ("`operator delete' must return type `%T'", void_type_node);
|
||||
{
|
||||
e = 1;
|
||||
error ("%<operator delete%> must return type %qT", void_type_node);
|
||||
}
|
||||
|
||||
if (!args || args == void_list_node
|
||||
|| !same_type_p (TREE_VALUE (args), ptr_type_node))
|
||||
|
@ -1281,7 +1288,8 @@ coerce_delete_type (tree type)
|
|||
e = 2;
|
||||
if (args && args != void_list_node)
|
||||
args = TREE_CHAIN (args);
|
||||
error ("`operator delete' takes type `%T' as first parameter", ptr_type_node);
|
||||
error ("%<operator delete%> takes type %qT as first parameter",
|
||||
ptr_type_node);
|
||||
}
|
||||
switch (e)
|
||||
{
|
||||
|
@ -3167,7 +3175,7 @@ check_default_args (tree x)
|
|||
saw_def = true;
|
||||
else if (saw_def)
|
||||
{
|
||||
cp_error_at ("default argument missing for parameter %P of `%+#D'",
|
||||
cp_error_at ("default argument missing for parameter %P of %q+#D",
|
||||
i, x);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -7157,7 +7157,7 @@ cp_parser_decl_specifier_seq (cp_parser* parser,
|
|||
cp_lexer_consume_token (parser->lexer);
|
||||
if (decl_specs->specs[(int) ds_thread])
|
||||
{
|
||||
error ("`__thread' before `static'");
|
||||
error ("%<__thread%> before %<static%>");
|
||||
decl_specs->specs[(int) ds_thread] = 0;
|
||||
}
|
||||
cp_parser_set_storage_class (decl_specs, sc_static);
|
||||
|
@ -7167,7 +7167,7 @@ cp_parser_decl_specifier_seq (cp_parser* parser,
|
|||
cp_lexer_consume_token (parser->lexer);
|
||||
if (decl_specs->specs[(int) ds_thread])
|
||||
{
|
||||
error ("`__thread' before `extern'");
|
||||
error ("%<__thread%> before %<extern%>");
|
||||
decl_specs->specs[(int) ds_thread] = 0;
|
||||
}
|
||||
cp_parser_set_storage_class (decl_specs, sc_extern);
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2004-10-03 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||
|
||||
* g++.dg/template/local1.C: Adjust quoting marks in
|
||||
testing for diagnostics.
|
||||
* g++.dg/tls/diag-2.C: Likewise.
|
||||
* g++.dg/other/error8.C: Likewise.
|
||||
|
||||
2004-10-03 Andrew Pinski <pinskia@physics.uc.edu>
|
||||
|
||||
PR c/17178
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
void foo(void)
|
||||
{
|
||||
union { int alpha; int beta; }; // { dg-error "previous declaration of `int alpha'" }
|
||||
union { int alpha; int beta; }; // { dg-error "previous declaration of 'int alpha'" }
|
||||
double alpha; // { dg-error "redeclared" }
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ template<class T> void A::f()
|
|||
struct B
|
||||
{
|
||||
void g() {}
|
||||
static int x; // { dg-error "static.*`int A::f\\(\\)::B::x'" "" }
|
||||
static int x; // { dg-error "static.*int A::f\\(\\)::B::x" "" }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
/* Invalid __thread specifiers. */
|
||||
|
||||
__thread extern int g1; /* { dg-error "`__thread' before `extern'" } */
|
||||
__thread static int g2; /* { dg-error "`__thread' before `static'" } */
|
||||
__thread __thread int g3; /* { dg-error "duplicate `__thread'" } */
|
||||
__thread extern int g1; /* { dg-error "'__thread' before 'extern'" } */
|
||||
__thread static int g2; /* { dg-error "'__thread' before 'static'" } */
|
||||
__thread __thread int g3; /* { dg-error "duplicate '__thread'" } */
|
||||
typedef __thread int g4; /* { dg-error "multiple storage classes" } */
|
||||
|
||||
void foo()
|
||||
{
|
||||
__thread int l1; /* { dg-error "implicitly auto and declared `__thread'" } */
|
||||
__thread int l1; /* { dg-error "implicitly auto and declared '__thread'" } */
|
||||
auto __thread int l2; /* { dg-error "multiple storage classes" } */
|
||||
__thread extern int l3; /* { dg-error "`__thread' before `extern'" } */
|
||||
__thread extern int l3; /* { dg-error "'__thread' before 'extern'" } */
|
||||
register __thread int l4; /* { dg-error "multiple storage classes" } */
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue