* parser.c (cp_parser_name_lookup_error,
cp_parser_diagnose_invalid_type_name,
cp_parser_primary_expression, cp_parser_unqualified_id,
cp_parser_nested_name_specifier_opt,
cp_parser_labeled_statement,
cp_parser_jump_statement, cp_parser_simple_declaration,
cp_parser_decl_specifier_seq, cp_parser_mem_initializer_id,
cp_parser_type_parameter, cp_parser_template_id,
cp_parser_template_name, cp_parser_direct_declarator,
cp_parser_parameter_declaration_list, cp_parser_class_head,
cp_parser_base_specifier, cp_parser_lookup_name,
cp_parser_late_parsing_default_args,
cp_parser_optional_template_keyword
cp_parser_elaborated_type_specifier,
cp_parser_check_class_key,
cp_parser_check_access_in_redeclaration): Use quoting marks.
* name-lookup.c (supplement_binding, pushdecl,
check_for_out_of_scope_variable,
validate_nonmember_using_decl,
do_nonmember_using_decl, lookup_tag, set_decl_namespace,
push_namespace, do_namespace_alias, do_using_directive,
ambiguous_decl, lookup_namespace_name, add_function):
Likewise.
* method.c (use_thunk): Likewise.
* lex.c (unqualified_name_lookup_error,
unqualified_fn_lookup_error): Likewise.
testsuite/
merlin[1:17]% cd build
~
merlin[1:17]% ls
~/build
3 4 4.0.0 c++0x r tree
merlin[1:17]% cd 4.0.0
~/build
merlin[1:17]% cd gcc
~/build/4.0.0
merlin[1:17]% make check-g++
~/build/4.0.0/gcc
(rootme=`${PWDCMD-pwd}`; export rootme; \
srcdir=`cd /home/gdr/redhat/egcs/gcc; ${PWDCMD-pwd}` ; export srcdir ;
\
cd testsuite; \
EXPECT=`if [ -f ${rootme}/../expect/expect ] ; then echo
${rootme}/../expect/expect ; else echo expect ; fi` ; export EXPECT ;
\
if [ -f ${rootme}/../expect/expect ] ; then \
TCL_LIBRARY=`cd .. ; cd /home/gdr/redhat/egcs/gcc/../tcl/library ;
${PWDCMD-pwd}` ; \
export TCL_LIBRARY ; fi ; \
`if [ -f ${srcdir}/../dejagnu/runtest ] ; then echo
${srcdir}/../dejagnu/runtest ; else echo runtest; fi` --tool g++ )
Test Run By gdr on Tue Oct 5 01:18:04 2004
Native configuration is i686-pc-linux-gnu
=== g++ tests ===
Schedule of variations:
unix
Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file
for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for
target.
Using /home/gdr/redhat/egcs/gcc/testsuite/config/default.exp as
tool-and-target-specific interface file.
Running /home/gdr/redhat/egcs/gcc/testsuite/g++.dg/bprob/bprob.exp ...
Running /home/gdr/redhat/egcs/gcc/testsuite/g++.dg/charset/charset.exp
...
Running /home/gdr/redhat/egcs/gcc/testsuite/g++.dg/compat/compat.exp
...
Running /home/gdr/redhat/egcs/gcc/testsuite/g++.dg/debug/debug.exp ...
Running /home/gdr/redhat/egcs/gcc/testsuite/g++.dg/dg.exp ...
FAIL: g++.dg/other/classkey1.C (test for errors, line 9)
FAIL: g++.dg/other/classkey1.C (test for errors, line 11)
FAIL: g++.dg/other/classkey1.C (test for errors, line 14)
FAIL: g++.dg/other/classkey1.C (test for errors, line 17)
FAIL: g++.dg/other/classkey1.C (test for excess errors)
FAIL: g++.dg/parse/error15.C (test for errors, line 13)
FAIL: g++.dg/parse/error15.C (test for errors, line 14)
FAIL: g++.dg/parse/error15.C (test for errors, line 15)
FAIL: g++.dg/parse/error15.C (test for errors, line 21)
FAIL: g++.dg/parse/error15.C (test for errors, line 22)
FAIL: g++.dg/parse/error15.C (test for errors, line 23)
FAIL: g++.dg/parse/error15.C (test for errors, line 31)
FAIL: g++.dg/parse/error15.C (test for errors, line 32)
FAIL: g++.dg/parse/error15.C (test for errors, line 33)
FAIL: g++.dg/parse/error15.C (test for excess errors)
XPASS: g++.dg/rtti/tinfo1.C scan-assembler _ZTIP9CTemplateIhE:
XPASS: g++.dg/rtti/tinfo1.C scan-assembler-not .globl[
\t]+_ZTIP9CTemplateIhE
XPASS: g++.dg/rtti/tinfo1.C scan-assembler-not
.section[^\n\r]*_ZTIP9CTemplateIhE[^\n\r]*
FAIL: g++.dg/template/meminit2.C (test for errors, line 10)
FAIL: g++.dg/template/meminit2.C (test for errors, line 11)
FAIL: g++.dg/template/meminit2.C (test for excess errors)
Running /home/gdr/redhat/egcs/gcc/testsuite/g++.dg/gcov/gcov.exp ...
FAIL: 102:is -:should be 1
FAIL: g++.dg/gcov/gcov-1.C gcov: 1 failures in line counts, 0 in
branch percentamerlin[1:27]% make check-g++
~/build/4.0.0/gcc
(rootme=`${PWDCMD-pwd}`; export rootme; \
srcdir=`cd /home/gdr/redhat/egcs/gcc; ${PWDCMD-pwd}` ; export srcdir ;
\
cd testsuite; \
EXPECT=`if [ -f ${rootme}/../expect/expect ] ; then echo
${rootme}/../expect/expect ; else echo expect ; fi` ; export EXPECT ;
\
if [ -f ${rootme}/../expect/expect ] ; then \
TCL_LIBRARY=`cd .. ; cd /home/gdr/redhat/egcs/gcc/../tcl/library ;
${PWDCMD-pwd}` ; \
export TCL_LIBRARY ; fi ; \
`if [ -f ${srcdir}/../dejagnu/runtest ] ; then echo
${srcdir}/../dejagnu/runtest ; else echo runtest; fi` --tool g++ )
Test Run By gdr on Tue Oct 5 01:27:39 2004
Native configuration is i686-pc-linux-gnu
=== g++ tests ===
Schedule of variations:
unix
Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file
for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for
tar method.c
cfns.gperf cxx-pretty-print.c method.c.~1.315.~
cfns.h cxx-pretty-print.h name-lookup.c
ChangeLog decl2.c name-lookup.c.~1.85.~
ChangeLog.1 decl.c name-lookup.h
ChangeLog.~1.4404.~ decl.h NEWS
ChangeLog.2 dump.c operators.def
ChangeLog.3 error.c optimize.c
ChangeLog.egcs except.c parser.c
ChangeLog.tree-ssa expr.c parser.c.~1.258.~
class.c friend.c pt.c
config-lang.in g++spec.c ptree.c
cp-gimplify.c init.c repo.c
cp-lang.c init.c.~1.396.~ rtti.c
cp-objcp-common.c lang-specs.h search.c
cp-objcp-common.h lex.c semantics.c
cp-tree.def lex.c.~1.349.~ tree.c
cp-tree.h Make-lang.in typeck2.c
CVS mangle.c typeck.c
merlin[7:37]% cvs -z9 diff -p > ~/d-5.patch
~/redhat/egcs/gcc/cp
Enter passphrase for RSA key '/home/gdr/.ssh/identity': cvs [diff
aborted]: received interrupt signal
merlin[7:37]% cvs -z9 diff -p > ~/d-5.patch
~/redhat/egcs/gcc/cp
Warning: Remote host denied X11 forwarding.
Warning: Remote host denied authentication agent forwarding.
cvs diff: Diffing .
merlin[7:38]% l ~/d-5.patch
~/redhat/egcs/gcc/cp
merlin[7:39]% cvs -z9 diff -p > ~/d-5.patch
~/redhat/egcs/gcc/cp
Warning: Remote host denied X11 forwarding.
Warning: Remote host denied authentication agent forwarding.
cvs diff: Diffing .
merlin[7:40]% l ~/d-5.patch
~/redhat/egcs/gcc/cp
You have new mail.
merlin[8:21]% cvs -z9 commit
~/redhat/egcs/gcc/cp
merlin[8:21]% cd .
~/redhat/egcs/gcc/cp
merlin[8:21]% cvs -z9 commit cp testsuite
~/redhat/egcs/gcc/cp
cvs commit: nothing known about `cp'
cvs commit: nothing known about `testsuite'
cvs [commit aborted]: correct above errors first!
merlin[8:21]% cd ..
~/redhat/egcs/gcc/cp
merlin[8:21]% cvs -z9 commit cp testsuite
~/redhat/egcs/gcc
cvs commit: Examining cp
cvs commit: Examining testsuite
cvs commit: Examining testsuite/ada
cvs commit: Examining testsuite/ada/acats
cvs commit: Examining testsuite/ada/acats/support
cvs commit: Examining testsuite/ada/acats/tests
cvs commit: Examining testsuite/ada/acats/tests/a
cvs commit: Examining testsuite/ada/acats/tests/c2
cvs commit: Examining testsuite/ada/acats/tests/c3
cvs commit: Examining testsuite/ada/acats/tests/c4
cvs commit: Examining testsuite/ada/acats/tests/c5
cvs commit: Examining testsuite/ada/acats/tests/c6
cvs commit: Examining testsuite/ada/acats/tests/c7
cvs commit: Examining testsuite/ada/acats/tests/c8
cvs commit: Examining testsuite/ada/acats/tests/c9
cvs commit: Examining testsuite/ada/acats/tests/ca
cvs commit: Examining testsuite/ada/acats/tests/cb
cvs commit: Examining testsuite/ada/acats/tests/cc
cvs commit: Examining testsuite/ada/acats/tests/cd
cvs commit: Examining testsuite/ada/acats/tests/ce
cvs commit: Examining testsuite/ada/acats/tests/cxa
cvs commit: Examining testsuite/ada/acats/tests/cxb
cvs commit: Examining testsuite/ada/acats/tests/cxf
cvs commit: Examining testsuite/ada/acats/tests/cxg
cvs commit: Examining testsuite/ada/acats/tests/cxh
cvs commit: Examining testsuite/ada/acats/tests/cz
cvs commit: Examining testsuite/ada/acats/tests/d
cvs commit: Examining testsuite/ada/acats/tests/e
cvs commit: Examining testsuite/ada/acats/tests/gcc
cvs commit: Examining testsuite/ada/acats/tests/l
cvs commit: Examining testsuite/config
cvs commit: Examining testsuite/consistency.vlad
cvs commit: Examining testsuite/consistency.vlad/layout
cvs commit: Examining
testsuite/consistency.vlad/layout/i960-97r2-results
cvs commit: Examining testsuite/g++.dg
cvs commit: Examining testsuite/g++.dg/abi
cvs commit: Examining testsuite/g++.dg/bprob
cvs commit: Examining testsuite/g++.dg/charset
cvs commit: Examining testsuite/g++.dg/compat
cvs commit: Examining testsuite/g++.dg/compat/abi
cvs commit: Examinin
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88552
138bc75d-0d04-0410-961f-
82ee72b054a4
2004-10-04 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert diagnostics to use quoting flag q 4/n
+ * parser.c (cp_parser_name_lookup_error,
+ cp_parser_diagnose_invalid_type_name,
+ cp_parser_primary_expression, cp_parser_unqualified_id,
+ cp_parser_nested_name_specifier_opt, cp_parser_labeled_statement,
+ cp_parser_jump_statement, cp_parser_simple_declaration,
+ cp_parser_decl_specifier_seq, cp_parser_mem_initializer_id,
+ cp_parser_type_parameter, cp_parser_template_id,
+ cp_parser_template_name, cp_parser_direct_declarator,
+ cp_parser_parameter_declaration_list, cp_parser_class_head,
+ cp_parser_base_specifier, cp_parser_lookup_name,
+ cp_parser_late_parsing_default_args,
+ cp_parser_optional_template_keyword
+ cp_parser_elaborated_type_specifier, cp_parser_check_class_key,
+ cp_parser_check_access_in_redeclaration): Use quoting marks.
+
+ * name-lookup.c (supplement_binding, pushdecl,
+ check_for_out_of_scope_variable, validate_nonmember_using_decl,
+ do_nonmember_using_decl, lookup_tag, set_decl_namespace,
+ push_namespace, do_namespace_alias, do_using_directive,
+ ambiguous_decl, lookup_namespace_name, add_function): Likewise.
+
+ * method.c (use_thunk): Likewise.
+
+ * lex.c (unqualified_name_lookup_error,
+ unqualified_fn_lookup_error): Likewise.
+
+2004-10-04 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ Convert diagnostics to use quoting flag q 4/n
* except.c (decl_is_java_type, build_throw,
is_admissible_throw_operand, check_handlers_1, check_handlers):
Use quoting formats.
if (IDENTIFIER_OPNAME_P (name))
{
if (name != ansi_opname (ERROR_MARK))
- error ("`%D' not defined", name);
+ error ("%qD not defined", name);
}
else
{
- error ("`%D' was not declared in this scope", name);
+ error ("%qD was not declared in this scope", name);
/* Prevent repeated error messages by creating a VAR_DECL with
this NAME in the innermost block scope. */
if (current_function_decl)
Note that we have the exact wording of the following message in
the manual (trouble.texi, node "Name lookup"), so they need to
be kept in synch. */
- pedwarn ("there are no arguments to `%D' that depend on a template "
- "parameter, so a declaration of `%D' must be available",
+ pedwarn ("there are no arguments to %qD that depend on a template "
+ "parameter, so a declaration of %qD must be available",
name, name);
if (!flag_permissive)
doesn't work for varargs. */
if (varargs_function_p (function))
- error ("generic thunk code fails for method `%#D' which uses `...'",
+ error ("generic thunk code fails for method %q#D which uses %<...%>",
function);
DECL_RESULT (thunk_fndecl) = NULL_TREE;
if (CP_TYPE_CONST_P (TREE_TYPE (field)))
{
- error ("non-static const member `%#D', can't use default assignment operator", field);
+ error ("non-static const member %q#D, can't use default "
+ "assignment operator", field);
continue;
}
else if (TREE_CODE (TREE_TYPE (field)) == REFERENCE_TYPE)
{
- error ("non-static reference member `%#D', can't use default assignment operator", field);
+ error ("non-static reference member %q#D, can't use "
+ "default assignment operator", field);
continue;
}
ok = false;
else
{
- error ("declaration of `%#D'", decl);
- cp_error_at ("conflicts with previous declaration `%#D'", bval);
+ error ("declaration of %q#D", decl);
+ cp_error_at ("conflicts with previous declaration %q#D", bval);
ok = false;
}
else if (t == wchar_decl_node)
{
if (pedantic && ! DECL_IN_SYSTEM_HEADER (x))
- pedwarn ("redeclaration of `wchar_t' as `%T'",
- TREE_TYPE (x));
+ pedwarn ("redeclaration of %<wchar_t%> as %qT",
+ TREE_TYPE (x));
/* Throw away the redeclaration. */
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
[basic.start.main]
This function shall not be overloaded. */
- cp_error_at ("invalid redeclaration of `%D'", t);
- error ("as `%D'", x);
+ cp_error_at ("invalid redeclaration of %qD", t);
+ error ("as %qD", x);
/* We don't try to push this declaration since that
causes a crash. */
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, x);
&& TREE_CODE (decl) == TREE_CODE (x)
&& !same_type_p (TREE_TYPE (x), TREE_TYPE (decl)))
{
- pedwarn ("type mismatch with previous external decl of `%#D'", x);
- cp_pedwarn_at ("previous external decl of `%#D'", decl);
+ pedwarn ("type mismatch with previous external decl of %q#D", x);
+ cp_pedwarn_at ("previous external decl of %q#D", decl);
}
}
/* OK */;
else
{
- warning ("extern declaration of `%#D' doesn't match", x);
- cp_warning_at ("global declaration `%#D'", oldglobal);
+ warning ("extern declaration of %q#D doesn't match", x);
+ cp_warning_at ("global declaration %q#D", oldglobal);
}
}
/* If we have a local external declaration,
/* ARM $8.3 */
if (b->kind == sk_function_parms)
{
- error ("declaration of '%#D' shadows a parameter", x);
+ error ("declaration of %q#D shadows a parameter", x);
err = true;
}
}
if (warn_shadow && !err)
{
- warning ("declaration of '%#D' shadows a parameter", x);
+ warning ("declaration of %q#D shadows a parameter", x);
warning ("%Jshadowed declaration is here", oldlocal);
}
}
if (member && !TREE_STATIC (member))
{
/* Location of previous decl is not useful in this case. */
- warning ("declaration of '%D' shadows a member of 'this'",
+ warning ("declaration of %qD shadows a member of 'this'",
x);
}
else if (oldlocal != NULL_TREE
&& TREE_CODE (oldlocal) == VAR_DECL)
{
- warning ("declaration of '%D' shadows a previous local", x);
+ warning ("declaration of %qD shadows a previous local", x);
warning ("%Jshadowed declaration is here", oldlocal);
}
else if (oldglobal != NULL_TREE
&& TREE_CODE (oldglobal) == VAR_DECL)
/* XXX shadow warnings in outer-more namespaces */
{
- warning ("declaration of '%D' shadows a global declaration",
+ warning ("declaration of %qD shadows a global declaration",
x);
warning ("%Jshadowed declaration is here", oldglobal);
}
{
if (!DECL_ERROR_REPORTED (decl))
{
- warning ("name lookup of `%D' changed",
- DECL_NAME (decl));
- cp_warning_at (" matches this `%D' under ISO standard rules",
+ warning ("name lookup of %qD changed", DECL_NAME (decl));
+ cp_warning_at (" matches this %qD under ISO standard rules",
shadowed);
- cp_warning_at (" matches this `%D' under old rules", decl);
+ cp_warning_at (" matches this %qD under old rules", decl);
DECL_ERROR_REPORTED (decl) = 1;
}
return shadowed;
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (decl)))
{
- error ("name lookup of `%D' changed for new ISO `for' scoping",
+ error ("name lookup of %qD changed for new ISO %<for%> scoping",
DECL_NAME (decl));
- cp_error_at (" cannot use obsolete binding at `%D' because it has a destructor", decl);
+ cp_error_at (" cannot use obsolete binding at %qD because "
+ "it has a destructor", decl);
return error_mark_node;
}
else
{
- pedwarn ("name lookup of `%D' changed for new ISO `for' scoping",
+ pedwarn ("name lookup of %qD changed for new ISO %<for%> scoping",
DECL_NAME (decl));
- cp_pedwarn_at (" using obsolete binding at `%D'", decl);
+ cp_pedwarn_at (" using obsolete binding at %qD", decl);
}
return decl;
&& !(flags & PUSH_USING)
&& compparms (TYPE_ARG_TYPES (TREE_TYPE (fn)),
TYPE_ARG_TYPES (TREE_TYPE (decl))))
- error ("`%#D' conflicts with previous using declaration `%#D'",
- decl, fn);
+ error ("%q#D conflicts with previous using declaration %q#D",
+ decl, fn);
if (duplicate_decls (decl, fn) == fn)
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, fn);
old = NULL_TREE;
else
{
- cp_error_at ("previous non-function declaration `%#D'", old);
- error ("conflicts with function declaration `%#D'", decl);
+ cp_error_at ("previous non-function declaration %q#D", old);
+ error ("conflicts with function declaration %q#D", decl);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
}
}
member-declaration. */
if (TYPE_P (scope))
{
- error ("`%T' is not a namespace", scope);
+ error ("%qT is not a namespace", scope);
return NULL_TREE;
}
else if (scope == error_mark_node)
{
/* 7.3.3/5
A using-declaration shall not name a template-id. */
- error ("a using-declaration cannot specify a template-id. Try `using %D'", name);
+ error ("a using-declaration cannot specify a template-id. "
+ "Try %<using %D%>", name);
return NULL_TREE;
}
if (TREE_CODE (decl) == NAMESPACE_DECL)
{
- error ("namespace `%D' not allowed in using-declaration", decl);
+ error ("namespace %qD not allowed in using-declaration", decl);
return NULL_TREE;
}
{
/* It's a nested name with template parameter dependent scope.
This can only be using-declaration for class member. */
- error ("`%T' is not a namespace", TREE_OPERAND (decl, 0));
+ error ("%qT is not a namespace", TREE_OPERAND (decl, 0));
return NULL_TREE;
}
if (!decls.value && !decls.type)
{
- error ("`%D' not declared", name);
+ error ("%qD not declared", name);
return;
}
if (oldval && !is_overloaded_fn (oldval))
{
if (!DECL_IMPLICIT_TYPEDEF_P (oldval))
- error ("`%D' is already declared in this scope", name);
+ error ("%qD is already declared in this scope", name);
oldval = NULL_TREE;
}
{
/* If the OLD_FN was really declared, the
declarations don't match. */
- error ("`%D' is already declared in this scope", name);
+ error ("%qD is already declared in this scope", name);
break;
}
{
*newval = decls.value;
if (oldval && !decls_match (*newval, oldval))
- error ("`%D' is already declared in this scope", name);
+ error ("%qD is already declared in this scope", name);
}
*newtype = decls.type;
if (oldtype && *newtype && !same_type_p (oldtype, *newtype))
{
- error ("using declaration `%D' introduced ambiguous type `%T'",
- name, oldtype);
+ error ("using declaration %qD introduced ambiguous type %qT",
+ name, oldtype);
return;
}
}
&& (form == ENUMERAL_TYPE
|| TREE_CODE (old) == ENUMERAL_TYPE))
{
- error ("`%#D' redeclared as %C", old, form);
+ error ("%q#D redeclared as %C", old, form);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
}
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, old);
&& (form == ENUMERAL_TYPE || code == ENUMERAL_TYPE))
{
/* Definition isn't the kind we were looking for. */
- error ("`%#D' redeclared as %C", entry->type, form);
+ error ("%q#D redeclared as %C", entry->type, form);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
}
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, entry->type);
tree scope = context_for_name_lookup (x);
if (TYPE_P (scope) && same_type_p (scope, current_class_type))
{
- error ("`%D' has the same name as the class in which it is "
+ error ("%qD has the same name as the class in which it is "
"declared",
x);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, false);
else
return;
complain:
- error ("`%D' should have been declared inside `%D'",
- decl, scope);
+ error ("%qD should have been declared inside %qD", decl, scope);
}
/* Return the namespace where the current declaration is declared. */
need_new = 0;
if (DECL_NAMESPACE_ALIAS (d))
{
- error ("namespace alias `%D' not allowed here, assuming `%D'",
- d, DECL_NAMESPACE_ALIAS (d));
+ error ("namespace alias %qD not allowed here, assuming %qD",
+ d, DECL_NAMESPACE_ALIAS (d));
d = DECL_NAMESPACE_ALIAS (d);
}
}
if (TREE_CODE (namespace) != NAMESPACE_DECL)
{
/* The parser did not find it, so it's not there. */
- error ("unknown namespace `%D'", namespace);
+ error ("unknown namespace %qD", namespace);
return;
}
{
/* Lookup in lexer did not find a namespace. */
if (!processing_template_decl)
- error ("namespace `%T' undeclared", namespace);
+ error ("namespace %qT undeclared", namespace);
return;
}
if (TREE_CODE (namespace) != NAMESPACE_DECL)
{
if (!processing_template_decl)
- error ("`%T' is not a namespace", namespace);
+ error ("%qT is not a namespace", namespace);
return;
}
namespace = ORIGINAL_NAMESPACE (namespace);
DECL_NAMESPACE_ASSOCIATIONS (namespace));
}
else
- warning ("`%D' attribute directive ignored", name);
+ warning ("%qD attribute directive ignored", name);
}
}
repeat ourselves. */
if (old->value != error_mark_node)
{
- error ("use of `%D' is ambiguous", name);
- cp_error_at (" first declared as `%#D' here",
- old->value);
+ error ("use of %qD is ambiguous", name);
+ cp_error_at (" first declared as %q#D here", old->value);
}
- cp_error_at (" also declared as `%#D' here", val);
+ cp_error_at (" also declared as %q#D here", val);
}
old->value = error_mark_node;
}
{
if (flags & LOOKUP_COMPLAIN)
{
- error ("`%D' denotes an ambiguous type",name);
+ error ("%qD denotes an ambiguous type",name);
error ("%J first type here", TYPE_MAIN_DECL (old->type));
error ("%J other type here", TYPE_MAIN_DECL (type));
}
{
/* This happens for A::B where B is a template, and there are no
template arguments. */
- error ("invalid use of `%D'", name);
+ error ("invalid use of %qD", name);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
}
TREE_OPERAND (template_id, 1));
else
{
- error ("`%D::%D' is not a template",
- namespace, name);
+ error ("%<%D::%D%> is not a template", namespace, name);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
}
}
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
}
- error ("`%D' undeclared in namespace `%D'", name, namespace);
+ error ("%qD undeclared in namespace %qD", name, namespace);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
}
{
fn = f1; f1 = f2; f2 = fn;
}
- cp_error_at ("`%D' is not a function,", f1);
- cp_error_at (" conflict with `%D'", f2);
- error (" in call to `%D'", k->name);
+ cp_error_at ("%qD is not a function,", f1);
+ cp_error_at (" conflict with %qD", f2);
+ error (" in call to %qD", k->name);
return true;
}
if (decl == error_mark_node)
{
if (parser->scope && parser->scope != global_namespace)
- error ("`%D::%D' has not been declared",
+ error ("%<%D::%D%> has not been declared",
parser->scope, name);
else if (parser->scope == global_namespace)
- error ("`::%D' has not been declared", name);
+ error ("%<::%D%> has not been declared", name);
else if (parser->object_scope
&& !CLASS_TYPE_P (parser->object_scope))
- error ("request for member `%D' in non-class type `%T'",
+ error ("request for member %qD in non-class type %qT",
name, parser->object_scope);
else if (parser->object_scope)
- error ("`%T::%D' has not been declared",
+ error ("%<%T::%D%> has not been declared",
parser->object_scope, name);
else
error ("`%D' has not been declared", name);
}
else if (parser->scope && parser->scope != global_namespace)
- error ("`%D::%D' %s", parser->scope, name, desired);
+ error ("%<%D::%D%> %s", parser->scope, name, desired);
else if (parser->scope == global_namespace)
- error ("`::%D' %s", name, desired);
+ error ("%<::%D%> %s", name, desired);
else
- error ("`%D' %s", name, desired);
+ error ("%qD %s", name, desired);
}
/* If we are parsing tentatively, remember that an error has occurred
if (cp_lexer_next_token_is (parser->lexer, CPP_LESS))
{
if (TYPE_P (type))
- error ("`%T' is not a template", type);
+ error ("%qT is not a template", type);
else if (TREE_CODE (type) == IDENTIFIER_NODE)
- error ("`%E' is not a template", type);
+ error ("%qE is not a template", type);
else
error ("invalid template-id");
/* Remember the location of the invalid "<". */
/* If the lookup found a template-name, it means that the user forgot
to specify an argument list. Emit an useful error message. */
if (TREE_CODE (decl) == TEMPLATE_DECL)
- error ("invalid use of template-name `%E' without an argument list",
+ error ("invalid use of template-name %qE without an argument list",
decl);
else if (!parser->scope)
{
/* Issue an error message. */
- error ("`%E' does not name a type", id);
+ error ("%qE does not name a type", id);
/* If we're in a template class, it's possible that the user was
referring to a type from a base class. For example:
else
{
if (TREE_CODE (parser->scope) == NAMESPACE_DECL)
- error ("`%E' in namespace `%E' does not name a type",
+ error ("%qE in namespace %qE does not name a type",
id, parser->scope);
else if (TYPE_P (parser->scope))
- error ("`%E' in class `%T' does not name a type",
- id, parser->scope);
+ error ("q%E in class %qT does not name a type", id, parser->scope);
else
gcc_unreachable ();
}
cp_lexer_consume_token (parser->lexer);
if (parser->local_variables_forbidden_p)
{
- error ("`this' may not be used in this context");
+ error ("%<this%> may not be used in this context");
return error_mark_node;
}
/* Pointers cannot appear in constant-expressions. */
decl = check_for_out_of_scope_variable (decl);
if (local_variable_p (decl))
{
- error ("local variable `%D' may not appear in this context",
+ error ("local variable %qD may not appear in this context",
decl);
return error_mark_node;
}
if (declarator_p
&& !DECL_IMPLICIT_TYPEDEF_P (type_decl)
&& !DECL_SELF_REFERENCE_P (type_decl))
- error ("typedef-name `%D' used as destructor declarator",
+ error ("typedef-name %qD used as destructor declarator",
type_decl);
return build_nt (BIT_NOT_EXPR, TREE_TYPE (type_decl));
decl = cp_parser_lookup_name_simple (parser, token->value);
if (TREE_CODE (decl) == TEMPLATE_DECL)
- error ("`%D' used without template parameters",
- decl);
+ error ("%qD used without template parameters", decl);
else
cp_parser_name_lookup_error
(parser, token->value, decl,
/*complain=*/true);
if (!expression)
{
- error ("expression in new-declarator must have integral or enumeration type");
+ error ("expression in new-declarator must have integral "
+ "or enumeration type");
expression = error_mark_node;
}
}
expr_hi = NULL_TREE;
if (!parser->in_switch_statement_p)
- error ("case label `%E' not within a switch statement", expr);
+ error ("case label %qE not within a switch statement", expr);
else
statement = finish_case_label (expr, expr_hi);
}
}
else
statement = finish_break_stmt ();
- cp_parser_require (parser, CPP_SEMICOLON, "`;'");
+ cp_parser_require (parser, CPP_SEMICOLON, "%<;%>");
break;
case RID_CONTINUE:
}
else
statement = finish_continue_stmt ();
- cp_parser_require (parser, CPP_SEMICOLON, "`;'");
+ cp_parser_require (parser, CPP_SEMICOLON, "%<;%>");
break;
case RID_RETURN:
/* Build the return-statement. */
statement = finish_return_stmt (expr);
/* Look for the final `;'. */
- cp_parser_require (parser, CPP_SEMICOLON, "`;'");
+ cp_parser_require (parser, CPP_SEMICOLON, "%<;%>");
}
break;
else
finish_goto_stmt (cp_parser_identifier (parser));
/* Look for the final `;'. */
- cp_parser_require (parser, CPP_SEMICOLON, "`;'");
+ cp_parser_require (parser, CPP_SEMICOLON, "%<;%>");
break;
default:
if (decl != error_mark_node
|| (cp_parser_parsing_tentatively (parser)
&& !cp_parser_committed_to_tentative_parse (parser)))
- cp_parser_error (parser, "expected `,' or `;'");
+ cp_parser_error (parser, "expected %<,%> or %<;%>");
/* Skip tokens until we reach the end of the statement. */
cp_parser_skip_to_end_of_statement (parser);
/* If the next token is now a `;', consume it. */
friend */
case RID_FRIEND:
if (decl_specs->specs[(int) ds_friend]++)
- error ("duplicate `friend'");
+ error ("duplicate %<friend%>");
/* Consume the token. */
cp_lexer_consume_token (parser->lexer);
break;
/* `typename' is not allowed in this context ([temp.res]). */
if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TYPENAME))
{
- error ("keyword `typename' not allowed in this context (a qualified "
+ error ("keyword %<typename%> not allowed in this context (a qualified "
"member initializer is implicitly a type)");
cp_lexer_consume_token (parser->lexer);
}
/* Consume the `export' token. */
cp_lexer_consume_token (parser->lexer);
/* Warn that we do not support `export'. */
- warning ("keyword `export' not implemented, and will be ignored");
+ warning ("keyword %<export%> not implemented, and will be ignored");
}
cp_parser_template_declaration_after_export (parser, member_p);
default:
/* Anything else is an error. */
cp_parser_error (parser,
- "expected `class', `typename', or `template'");
+ "expected %<class%>, %<typename%>, or %<template%>");
parameter = error_mark_node;
}
and return simply an error. Maybe this is not a template-id
after all. */
next_token_2->type = CPP_COLON;
- cp_parser_error (parser, "expected `<'");
+ cp_parser_error (parser, "expected %<<%>");
pop_deferring_access_checks ();
return error_mark_node;
}
/* Otherwise, emit an error about the invalid digraph, but continue
parsing because we got our argument list. */
- pedwarn ("`<::' cannot begin a template-argument list");
- inform ("`<:' is an alternate spelling for `['. Insert whitespace "
- "between `<' and `::'");
+ pedwarn ("%<<::%> cannot begin a template-argument list");
+ inform ("%<<:%> is an alternate spelling for %<[%>. Insert whitespace "
+ "between %<<%> and %<::%>");
if (!flag_permissive)
{
static bool hint;
if (!hint)
{
- inform ("(if you use `-fpermissive' G++ will accept your code)");
+ inform ("(if you use -fpermissive G++ will accept your code)");
hint = true;
}
}
ptrdiff_t start;
cp_token* token;
/* Explain what went wrong. */
- error ("non-template `%D' used as template", identifier);
- inform ("use `%T::template %D' to indicate that it is a template",
+ error ("non-template %qD used as template", identifier);
+ inform ("use %<%T::template %D%> to indicate that it is a template",
parser->scope, identifier);
/* If parsing tentatively, find the location of the "<"
token. */
tag_type = typename_type;
/* The `typename' keyword is only allowed in templates. */
if (!processing_template_decl)
- pedwarn ("using `typename' outside of template");
+ pedwarn ("using %<typename%> outside of template");
}
/* Otherwise it must be a class-key. */
else
/*only_current_p=*/false);
/* If that failed, the declarator is invalid. */
if (type == error_mark_node)
- error ("`%T::%D' is not a type",
+ error ("%<%T::%D%> is not a type",
TYPE_CONTEXT (scope),
TYPE_IDENTIFIER (scope));
/* Build a new DECLARATOR. */
&& CLASSTYPE_USE_TEMPLATE (TREE_TYPE (unqualified_name)))
{
error ("invalid use of constructor as a template");
- inform ("use `%T::%D' instead of `%T::%T' to name the "
- "constructor in a qualified name", class_type,
+ inform ("use %<%T::%D%> instead of %<%T::%T%> to name "
+ "the constructor in a qualified name",
+ class_type,
DECL_NAME (TYPE_TI_TEMPLATE (class_type)),
class_type, class_type);
}
}
else
{
- cp_parser_error (parser, "expected `,' or `...'");
+ cp_parser_error (parser, "expected %<,%> or %<...%>");
if (!cp_parser_parsing_tentatively (parser)
|| cp_parser_committed_to_tentative_parse (parser))
cp_parser_skip_to_closing_parenthesis (parser,
xref_tag, since that has irreversible side-effects. */
if (!cp_parser_next_token_starts_class_definition_p (parser))
{
- cp_parser_error (parser, "expected `{' or `:'");
+ cp_parser_error (parser, "expected %<{%> or %<:%>");
return error_mark_node;
}
class was originally declared, the program is invalid. */
if (scope && !is_ancestor (scope, nested_name_specifier))
{
- error ("declaration of `%D' in `%D' which does not "
- "enclose `%D'", type, scope, nested_name_specifier);
+ error ("declaration of %qD in %qD which does not enclose %qD",
+ type, scope, nested_name_specifier);
type = NULL_TREE;
goto done;
}
&& parser->num_template_parameter_lists == 0
&& template_id_p)
{
- error ("an explicit specialization must be preceded by 'template <>'");
+ error ("an explicit specialization must be preceded by %<template <>%>");
invalid_explicit_specialization_p = true;
/* Take the same action that would have been taken by
cp_parser_explicit_specialization. */
else if (cp_lexer_next_token_is_not (parser->lexer,
CPP_SEMICOLON))
{
- cp_parser_error (parser, "expected `;'");
+ cp_parser_error (parser, "expected %<;%>");
/* Skip tokens until we find a `;'. */
cp_parser_skip_to_end_of_statement (parser);
if (virtual_p && !duplicate_virtual_error_issued_p)
{
cp_parser_error (parser,
- "`virtual' specified more than once in base-specified");
+ "%<virtual%> specified more than once in base-specified");
duplicate_virtual_error_issued_p = true;
}
if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TYPENAME))
{
if (!processing_template_decl)
- error ("keyword `typename' not allowed outside of templates");
+ error ("keyword %<typename%> not allowed outside of templates");
else
- error ("keyword `typename' not allowed in this context "
+ error ("keyword %<typename%> not allowed in this context "
"(the base class is implicitly a type)");
cp_lexer_consume_token (parser->lexer);
}
cp_parser_error, so we incorporate its actions directly. */
if (!cp_parser_simulate_error (parser))
{
- error ("reference to `%D' is ambiguous", name);
+ error ("reference to %qD is ambiguous", name);
print_candidates (decl);
}
return error_mark_node;
there was extra junk after the end of the default
argument. */
if (!cp_lexer_next_token_is (parser->lexer, CPP_EOF))
- cp_parser_error (parser, "expected `,'");
+ cp_parser_error (parser, "expected %<,%>");
/* Revert to the main lexer. */
cp_parser_pop_lexer (parser);
cp_parser_check_class_key (enum tag_types class_key, tree type)
{
if ((TREE_CODE (type) == UNION_TYPE) != (class_key == union_type))
- pedwarn ("`%s' tag used in naming `%#T'",
+ pedwarn ("%qs tag used in naming %q#T",
class_key == union_type ? "union"
: class_key == record_type ? "struct" : "class",
type);
This applies to nested classes and nested class templates.
[class.mem/1]. */
-static void cp_parser_check_access_in_redeclaration (tree decl)
+static void
+cp_parser_check_access_in_redeclaration (tree decl)
{
if (!CLASS_TYPE_P (TREE_TYPE (decl)))
return;
!= (current_access_specifier == access_private_node))
|| (TREE_PROTECTED (decl)
!= (current_access_specifier == access_protected_node)))
- error ("%D redeclared with different access", decl);
+ error ("%qD redeclared with different access", decl);
}
/* Look for the `template' keyword, as a syntactic disambiguator.
template and what is not. */
if (!processing_template_decl)
{
- error ("`template' (as a disambiguator) is only allowed "
+ error ("%<template%> (as a disambiguator) is only allowed "
"within templates");
/* If this part of the token stream is rescanned, the same
error message would be generated. So, we purge the token
+2004-10-05 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * g++.dg/other/classkey1.C: Adjust quoting marks.
+ * g++.dg/parse/error15.C: Likewise.
+ * g++.dg/template/meminit2.C (int>): Likewise.
+
2004-10-04 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/17283
// PR 775. Some mismatches which were broken.
template <class T> struct A {};
-union A<int> a; // { dg-error "`union' tag" "" }
+union A<int> a; // { dg-error "'union' tag" "" }
-template <> union A<float> {}; // { dg-error "`union' tag" "" }
+template <> union A<float> {}; // { dg-error "'union' tag" "" }
struct B {};
-union B b; // { dg-error "`union' tag" "" }
+union B b; // { dg-error "'union' tag" "" }
union C {};
-class C c; // { dg-error "`class' tag" "" }
+class C c; // { dg-error "'class' tag" "" }
}
N::A f2; // { dg-error "without an argument list" }
-N::INVALID f3; // { dg-error "in namespace `N' does not name a type" }
-N::C::INVALID f4; // { dg-error "in class `N::C' does not name a type" }
-N::K f6; // { dg-error "in namespace `N' does not name a type" }
+N::INVALID f3; // { dg-error "in namespace 'N' does not name a type" }
+N::C::INVALID f4; // { dg-error "in class 'N::C' does not name a type" }
+N::K f6; // { dg-error "in namespace 'N' does not name a type" }
typename N::A f7; // { dg-error "without an argument list|outside of template" }
struct B
{
N::A f2; // { dg-error "without an argument list" }
- N::INVALID f3; // { dg-error "in namespace `N' does not name a type" }
- N::C::INVALID f4; // { dg-error "in class `N::C' does not name a type" }
- N::K f6; // { dg-error "in namespace `N' does not name a type" }
+ N::INVALID f3; // { dg-error "in namespace 'N' does not name a type" }
+ N::C::INVALID f4; // { dg-error "in class 'N::C' does not name a type" }
+ N::K f6; // { dg-error "in namespace 'N' does not name a type" }
typename N::A f7; // { dg-error "without an argument list|outside of template" }
};
struct C
{
N::A f2; // { dg-error "without an argument list" }
- N::INVALID f3; // { dg-error "in namespace `N' does not name a type" }
- N::C::INVALID f4; // { dg-error "in class `N::C' does not name a type" }
- N::K f6; // { dg-error "in namespace `N' does not name a type" }
+ N::INVALID f3; // { dg-error "in namespace 'N' does not name a type" }
+ N::C::INVALID f4; // { dg-error "in class 'N::C' does not name a type" }
+ N::K f6; // { dg-error "in namespace 'N' does not name a type" }
typename N::A f7; // { dg-error "without an argument list" }
};
};
template <typename T>
-struct A : typename O<T>::template I<int> { // { dg-error "keyword `typename' not allowed" }
- A() : typename O<T>::template I<int>() // { dg-error "keyword `typename' not allowed" }
+struct A : typename O<T>::template I<int> { // { dg-error "keyword 'typename' not allowed" }
+ A() : typename O<T>::template I<int>() // { dg-error "keyword 'typename' not allowed" }
{};
};