Commit 2a13a625 by Gabriel Dos Reis Committed by Gabriel Dos Reis

Convert diagnostics to use quoting flag q 4/n

        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.

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

From-SVN: r88552
parent c4ad648e
2004-10-04 Gabriel Dos Reis <gdr@integrable-solutions.net> 2004-10-04 Gabriel Dos Reis <gdr@integrable-solutions.net>
Convert diagnostics to use quoting flag q 4/n 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, * except.c (decl_is_java_type, build_throw,
is_admissible_throw_operand, check_handlers_1, check_handlers): is_admissible_throw_operand, check_handlers_1, check_handlers):
Use quoting formats. Use quoting formats.
......
...@@ -566,11 +566,11 @@ unqualified_name_lookup_error (tree name) ...@@ -566,11 +566,11 @@ unqualified_name_lookup_error (tree name)
if (IDENTIFIER_OPNAME_P (name)) if (IDENTIFIER_OPNAME_P (name))
{ {
if (name != ansi_opname (ERROR_MARK)) if (name != ansi_opname (ERROR_MARK))
error ("`%D' not defined", name); error ("%qD not defined", name);
} }
else 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 /* Prevent repeated error messages by creating a VAR_DECL with
this NAME in the innermost block scope. */ this NAME in the innermost block scope. */
if (current_function_decl) if (current_function_decl)
...@@ -607,8 +607,8 @@ unqualified_fn_lookup_error (tree name) ...@@ -607,8 +607,8 @@ unqualified_fn_lookup_error (tree name)
Note that we have the exact wording of the following message in Note that we have the exact wording of the following message in
the manual (trouble.texi, node "Name lookup"), so they need to the manual (trouble.texi, node "Name lookup"), so they need to
be kept in synch. */ be kept in synch. */
pedwarn ("there are no arguments to `%D' that depend on a template " pedwarn ("there are no arguments to %qD that depend on a template "
"parameter, so a declaration of `%D' must be available", "parameter, so a declaration of %qD must be available",
name, name); name, name);
if (!flag_permissive) if (!flag_permissive)
......
...@@ -440,7 +440,7 @@ use_thunk (tree thunk_fndecl, bool emit_p) ...@@ -440,7 +440,7 @@ use_thunk (tree thunk_fndecl, bool emit_p)
doesn't work for varargs. */ doesn't work for varargs. */
if (varargs_function_p (function)) 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); function);
DECL_RESULT (thunk_fndecl) = NULL_TREE; DECL_RESULT (thunk_fndecl) = NULL_TREE;
...@@ -649,12 +649,14 @@ do_build_assign_ref (tree fndecl) ...@@ -649,12 +649,14 @@ do_build_assign_ref (tree fndecl)
if (CP_TYPE_CONST_P (TREE_TYPE (field))) 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; continue;
} }
else if (TREE_CODE (TREE_TYPE (field)) == REFERENCE_TYPE) 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; continue;
} }
......
...@@ -574,8 +574,8 @@ supplement_binding (cxx_binding *binding, tree decl) ...@@ -574,8 +574,8 @@ supplement_binding (cxx_binding *binding, tree decl)
ok = false; ok = false;
else else
{ {
error ("declaration of `%#D'", decl); error ("declaration of %q#D", decl);
cp_error_at ("conflicts with previous declaration `%#D'", bval); cp_error_at ("conflicts with previous declaration %q#D", bval);
ok = false; ok = false;
} }
...@@ -759,8 +759,8 @@ pushdecl (tree x) ...@@ -759,8 +759,8 @@ pushdecl (tree x)
else if (t == wchar_decl_node) else if (t == wchar_decl_node)
{ {
if (pedantic && ! DECL_IN_SYSTEM_HEADER (x)) if (pedantic && ! DECL_IN_SYSTEM_HEADER (x))
pedwarn ("redeclaration of `wchar_t' as `%T'", pedwarn ("redeclaration of %<wchar_t%> as %qT",
TREE_TYPE (x)); TREE_TYPE (x));
/* Throw away the redeclaration. */ /* Throw away the redeclaration. */
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
...@@ -791,8 +791,8 @@ pushdecl (tree x) ...@@ -791,8 +791,8 @@ pushdecl (tree x)
[basic.start.main] [basic.start.main]
This function shall not be overloaded. */ This function shall not be overloaded. */
cp_error_at ("invalid redeclaration of `%D'", t); cp_error_at ("invalid redeclaration of %qD", t);
error ("as `%D'", x); error ("as %qD", x);
/* We don't try to push this declaration since that /* We don't try to push this declaration since that
causes a crash. */ causes a crash. */
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, x); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, x);
...@@ -880,8 +880,8 @@ pushdecl (tree x) ...@@ -880,8 +880,8 @@ pushdecl (tree x)
&& TREE_CODE (decl) == TREE_CODE (x) && TREE_CODE (decl) == TREE_CODE (x)
&& !same_type_p (TREE_TYPE (x), TREE_TYPE (decl))) && !same_type_p (TREE_TYPE (x), TREE_TYPE (decl)))
{ {
pedwarn ("type mismatch with previous external decl of `%#D'", x); pedwarn ("type mismatch with previous external decl of %q#D", x);
cp_pedwarn_at ("previous external decl of `%#D'", decl); cp_pedwarn_at ("previous external decl of %q#D", decl);
} }
} }
...@@ -963,8 +963,8 @@ pushdecl (tree x) ...@@ -963,8 +963,8 @@ pushdecl (tree x)
/* OK */; /* OK */;
else else
{ {
warning ("extern declaration of `%#D' doesn't match", x); warning ("extern declaration of %q#D doesn't match", x);
cp_warning_at ("global declaration `%#D'", oldglobal); cp_warning_at ("global declaration %q#D", oldglobal);
} }
} }
/* If we have a local external declaration, /* If we have a local external declaration,
...@@ -1000,14 +1000,14 @@ pushdecl (tree x) ...@@ -1000,14 +1000,14 @@ pushdecl (tree x)
/* ARM $8.3 */ /* ARM $8.3 */
if (b->kind == sk_function_parms) 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; err = true;
} }
} }
if (warn_shadow && !err) 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); warning ("%Jshadowed declaration is here", oldlocal);
} }
} }
...@@ -1032,20 +1032,20 @@ pushdecl (tree x) ...@@ -1032,20 +1032,20 @@ pushdecl (tree x)
if (member && !TREE_STATIC (member)) if (member && !TREE_STATIC (member))
{ {
/* Location of previous decl is not useful in this case. */ /* 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); x);
} }
else if (oldlocal != NULL_TREE else if (oldlocal != NULL_TREE
&& TREE_CODE (oldlocal) == VAR_DECL) && 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); warning ("%Jshadowed declaration is here", oldlocal);
} }
else if (oldglobal != NULL_TREE else if (oldglobal != NULL_TREE
&& TREE_CODE (oldglobal) == VAR_DECL) && TREE_CODE (oldglobal) == VAR_DECL)
/* XXX shadow warnings in outer-more namespaces */ /* XXX shadow warnings in outer-more namespaces */
{ {
warning ("declaration of '%D' shadows a global declaration", warning ("declaration of %qD shadows a global declaration",
x); x);
warning ("%Jshadowed declaration is here", oldglobal); warning ("%Jshadowed declaration is here", oldglobal);
} }
...@@ -1161,11 +1161,10 @@ check_for_out_of_scope_variable (tree decl) ...@@ -1161,11 +1161,10 @@ check_for_out_of_scope_variable (tree decl)
{ {
if (!DECL_ERROR_REPORTED (decl)) if (!DECL_ERROR_REPORTED (decl))
{ {
warning ("name lookup of `%D' changed", warning ("name lookup of %qD changed", DECL_NAME (decl));
DECL_NAME (decl)); cp_warning_at (" matches this %qD under ISO standard rules",
cp_warning_at (" matches this `%D' under ISO standard rules",
shadowed); 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; DECL_ERROR_REPORTED (decl) = 1;
} }
return shadowed; return shadowed;
...@@ -1183,16 +1182,17 @@ check_for_out_of_scope_variable (tree decl) ...@@ -1183,16 +1182,17 @@ check_for_out_of_scope_variable (tree decl)
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (decl))) 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)); 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; return error_mark_node;
} }
else 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)); DECL_NAME (decl));
cp_pedwarn_at (" using obsolete binding at `%D'", decl); cp_pedwarn_at (" using obsolete binding at %qD", decl);
} }
return decl; return decl;
...@@ -2023,8 +2023,8 @@ push_overloaded_decl (tree decl, int flags) ...@@ -2023,8 +2023,8 @@ push_overloaded_decl (tree decl, int flags)
&& !(flags & PUSH_USING) && !(flags & PUSH_USING)
&& compparms (TYPE_ARG_TYPES (TREE_TYPE (fn)), && compparms (TYPE_ARG_TYPES (TREE_TYPE (fn)),
TYPE_ARG_TYPES (TREE_TYPE (decl)))) TYPE_ARG_TYPES (TREE_TYPE (decl))))
error ("`%#D' conflicts with previous using declaration `%#D'", error ("%q#D conflicts with previous using declaration %q#D",
decl, fn); decl, fn);
if (duplicate_decls (decl, fn) == fn) if (duplicate_decls (decl, fn) == fn)
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, fn); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, fn);
...@@ -2035,8 +2035,8 @@ push_overloaded_decl (tree decl, int flags) ...@@ -2035,8 +2035,8 @@ push_overloaded_decl (tree decl, int flags)
old = NULL_TREE; old = NULL_TREE;
else else
{ {
cp_error_at ("previous non-function declaration `%#D'", old); cp_error_at ("previous non-function declaration %q#D", old);
error ("conflicts with function declaration `%#D'", decl); error ("conflicts with function declaration %q#D", decl);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
} }
} }
...@@ -2114,7 +2114,7 @@ validate_nonmember_using_decl (tree decl, tree scope, tree name) ...@@ -2114,7 +2114,7 @@ validate_nonmember_using_decl (tree decl, tree scope, tree name)
member-declaration. */ member-declaration. */
if (TYPE_P (scope)) if (TYPE_P (scope))
{ {
error ("`%T' is not a namespace", scope); error ("%qT is not a namespace", scope);
return NULL_TREE; return NULL_TREE;
} }
else if (scope == error_mark_node) else if (scope == error_mark_node)
...@@ -2124,13 +2124,14 @@ validate_nonmember_using_decl (tree decl, tree scope, tree name) ...@@ -2124,13 +2124,14 @@ validate_nonmember_using_decl (tree decl, tree scope, tree name)
{ {
/* 7.3.3/5 /* 7.3.3/5
A using-declaration shall not name a template-id. */ 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; return NULL_TREE;
} }
if (TREE_CODE (decl) == NAMESPACE_DECL) 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; return NULL_TREE;
} }
...@@ -2138,7 +2139,7 @@ validate_nonmember_using_decl (tree decl, tree scope, tree name) ...@@ -2138,7 +2139,7 @@ validate_nonmember_using_decl (tree decl, tree scope, tree name)
{ {
/* It's a nested name with template parameter dependent scope. /* It's a nested name with template parameter dependent scope.
This can only be using-declaration for class member. */ 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; return NULL_TREE;
} }
...@@ -2166,7 +2167,7 @@ do_nonmember_using_decl (tree scope, tree name, tree oldval, tree oldtype, ...@@ -2166,7 +2167,7 @@ do_nonmember_using_decl (tree scope, tree name, tree oldval, tree oldtype,
if (!decls.value && !decls.type) if (!decls.value && !decls.type)
{ {
error ("`%D' not declared", name); error ("%qD not declared", name);
return; return;
} }
...@@ -2178,7 +2179,7 @@ do_nonmember_using_decl (tree scope, tree name, tree oldval, tree oldtype, ...@@ -2178,7 +2179,7 @@ do_nonmember_using_decl (tree scope, tree name, tree oldval, tree oldtype,
if (oldval && !is_overloaded_fn (oldval)) if (oldval && !is_overloaded_fn (oldval))
{ {
if (!DECL_IMPLICIT_TYPEDEF_P (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; oldval = NULL_TREE;
} }
...@@ -2220,7 +2221,7 @@ do_nonmember_using_decl (tree scope, tree name, tree oldval, tree oldtype, ...@@ -2220,7 +2221,7 @@ do_nonmember_using_decl (tree scope, tree name, tree oldval, tree oldtype,
{ {
/* If the OLD_FN was really declared, the /* If the OLD_FN was really declared, the
declarations don't match. */ declarations don't match. */
error ("`%D' is already declared in this scope", name); error ("%qD is already declared in this scope", name);
break; break;
} }
...@@ -2257,14 +2258,14 @@ do_nonmember_using_decl (tree scope, tree name, tree oldval, tree oldtype, ...@@ -2257,14 +2258,14 @@ do_nonmember_using_decl (tree scope, tree name, tree oldval, tree oldtype,
{ {
*newval = decls.value; *newval = decls.value;
if (oldval && !decls_match (*newval, oldval)) 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; *newtype = decls.type;
if (oldtype && *newtype && !same_type_p (oldtype, *newtype)) if (oldtype && *newtype && !same_type_p (oldtype, *newtype))
{ {
error ("using declaration `%D' introduced ambiguous type `%T'", error ("using declaration %qD introduced ambiguous type %qT",
name, oldtype); name, oldtype);
return; return;
} }
} }
...@@ -2431,7 +2432,7 @@ lookup_tag (enum tree_code form, tree name, ...@@ -2431,7 +2432,7 @@ lookup_tag (enum tree_code form, tree name,
&& (form == ENUMERAL_TYPE && (form == ENUMERAL_TYPE
|| TREE_CODE (old) == 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, NULL_TREE);
} }
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, old); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, old);
...@@ -2450,7 +2451,7 @@ lookup_tag (enum tree_code form, tree name, ...@@ -2450,7 +2451,7 @@ lookup_tag (enum tree_code form, tree name,
&& (form == ENUMERAL_TYPE || code == ENUMERAL_TYPE)) && (form == ENUMERAL_TYPE || code == ENUMERAL_TYPE))
{ {
/* Definition isn't the kind we were looking for. */ /* 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, NULL_TREE);
} }
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, entry->type); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, entry->type);
...@@ -2818,7 +2819,7 @@ push_class_level_binding (tree name, tree x) ...@@ -2818,7 +2819,7 @@ push_class_level_binding (tree name, tree x)
tree scope = context_for_name_lookup (x); tree scope = context_for_name_lookup (x);
if (TYPE_P (scope) && same_type_p (scope, current_class_type)) 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", "declared",
x); x);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, false); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, false);
...@@ -3039,8 +3040,7 @@ set_decl_namespace (tree decl, tree scope, bool friendp) ...@@ -3039,8 +3040,7 @@ set_decl_namespace (tree decl, tree scope, bool friendp)
else else
return; return;
complain: complain:
error ("`%D' should have been declared inside `%D'", error ("%qD should have been declared inside %qD", decl, scope);
decl, scope);
} }
/* Return the namespace where the current declaration is declared. */ /* Return the namespace where the current declaration is declared. */
...@@ -3102,8 +3102,8 @@ push_namespace (tree name) ...@@ -3102,8 +3102,8 @@ push_namespace (tree name)
need_new = 0; need_new = 0;
if (DECL_NAMESPACE_ALIAS (d)) if (DECL_NAMESPACE_ALIAS (d))
{ {
error ("namespace alias `%D' not allowed here, assuming `%D'", error ("namespace alias %qD not allowed here, assuming %qD",
d, DECL_NAMESPACE_ALIAS (d)); d, DECL_NAMESPACE_ALIAS (d));
d = DECL_NAMESPACE_ALIAS (d); d = DECL_NAMESPACE_ALIAS (d);
} }
} }
...@@ -3217,7 +3217,7 @@ do_namespace_alias (tree alias, tree namespace) ...@@ -3217,7 +3217,7 @@ do_namespace_alias (tree alias, tree namespace)
if (TREE_CODE (namespace) != NAMESPACE_DECL) if (TREE_CODE (namespace) != NAMESPACE_DECL)
{ {
/* The parser did not find it, so it's not there. */ /* The parser did not find it, so it's not there. */
error ("unknown namespace `%D'", namespace); error ("unknown namespace %qD", namespace);
return; return;
} }
...@@ -3377,13 +3377,13 @@ do_using_directive (tree namespace) ...@@ -3377,13 +3377,13 @@ do_using_directive (tree namespace)
{ {
/* Lookup in lexer did not find a namespace. */ /* Lookup in lexer did not find a namespace. */
if (!processing_template_decl) if (!processing_template_decl)
error ("namespace `%T' undeclared", namespace); error ("namespace %qT undeclared", namespace);
return; return;
} }
if (TREE_CODE (namespace) != NAMESPACE_DECL) if (TREE_CODE (namespace) != NAMESPACE_DECL)
{ {
if (!processing_template_decl) if (!processing_template_decl)
error ("`%T' is not a namespace", namespace); error ("%qT is not a namespace", namespace);
return; return;
} }
namespace = ORIGINAL_NAMESPACE (namespace); namespace = ORIGINAL_NAMESPACE (namespace);
...@@ -3428,7 +3428,7 @@ parse_using_directive (tree namespace, tree attribs) ...@@ -3428,7 +3428,7 @@ parse_using_directive (tree namespace, tree attribs)
DECL_NAMESPACE_ASSOCIATIONS (namespace)); DECL_NAMESPACE_ASSOCIATIONS (namespace));
} }
else else
warning ("`%D' attribute directive ignored", name); warning ("%qD attribute directive ignored", name);
} }
} }
...@@ -3562,11 +3562,10 @@ ambiguous_decl (tree name, struct scope_binding *old, cxx_binding *new, ...@@ -3562,11 +3562,10 @@ ambiguous_decl (tree name, struct scope_binding *old, cxx_binding *new,
repeat ourselves. */ repeat ourselves. */
if (old->value != error_mark_node) if (old->value != error_mark_node)
{ {
error ("use of `%D' is ambiguous", name); error ("use of %qD is ambiguous", name);
cp_error_at (" first declared as `%#D' here", cp_error_at (" first declared as %q#D here", old->value);
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; old->value = error_mark_node;
} }
...@@ -3581,7 +3580,7 @@ ambiguous_decl (tree name, struct scope_binding *old, cxx_binding *new, ...@@ -3581,7 +3580,7 @@ ambiguous_decl (tree name, struct scope_binding *old, cxx_binding *new,
{ {
if (flags & LOOKUP_COMPLAIN) 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 first type here", TYPE_MAIN_DECL (old->type));
error ("%J other type here", TYPE_MAIN_DECL (type)); error ("%J other type here", TYPE_MAIN_DECL (type));
} }
...@@ -3647,7 +3646,7 @@ lookup_namespace_name (tree namespace, tree name) ...@@ -3647,7 +3646,7 @@ lookup_namespace_name (tree namespace, tree name)
{ {
/* This happens for A::B where B is a template, and there are no /* This happens for A::B where B is a template, and there are no
template arguments. */ template arguments. */
error ("invalid use of `%D'", name); error ("invalid use of %qD", name);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
} }
...@@ -3687,8 +3686,7 @@ lookup_namespace_name (tree namespace, tree name) ...@@ -3687,8 +3686,7 @@ lookup_namespace_name (tree namespace, tree name)
TREE_OPERAND (template_id, 1)); TREE_OPERAND (template_id, 1));
else else
{ {
error ("`%D::%D' is not a template", error ("%<%D::%D%> is not a template", namespace, name);
namespace, name);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
} }
} }
...@@ -3704,7 +3702,7 @@ lookup_namespace_name (tree namespace, tree name) ...@@ -3704,7 +3702,7 @@ lookup_namespace_name (tree namespace, tree name)
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val); 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); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
} }
...@@ -4241,9 +4239,9 @@ add_function (struct arg_lookup *k, tree fn) ...@@ -4241,9 +4239,9 @@ add_function (struct arg_lookup *k, tree fn)
{ {
fn = f1; f1 = f2; f2 = fn; fn = f1; f1 = f2; f2 = fn;
} }
cp_error_at ("`%D' is not a function,", f1); cp_error_at ("%qD is not a function,", f1);
cp_error_at (" conflict with `%D'", f2); cp_error_at (" conflict with %qD", f2);
error (" in call to `%D'", k->name); error (" in call to %qD", k->name);
return true; return true;
} }
......
...@@ -1872,26 +1872,26 @@ cp_parser_name_lookup_error (cp_parser* parser, ...@@ -1872,26 +1872,26 @@ cp_parser_name_lookup_error (cp_parser* parser,
if (decl == error_mark_node) if (decl == error_mark_node)
{ {
if (parser->scope && parser->scope != global_namespace) if (parser->scope && parser->scope != global_namespace)
error ("`%D::%D' has not been declared", error ("%<%D::%D%> has not been declared",
parser->scope, name); parser->scope, name);
else if (parser->scope == global_namespace) 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 else if (parser->object_scope
&& !CLASS_TYPE_P (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); name, parser->object_scope);
else if (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); parser->object_scope, name);
else else
error ("`%D' has not been declared", name); error ("`%D' has not been declared", name);
} }
else if (parser->scope && parser->scope != global_namespace) 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) else if (parser->scope == global_namespace)
error ("`::%D' %s", name, desired); error ("%<::%D%> %s", name, desired);
else else
error ("`%D' %s", name, desired); error ("%qD %s", name, desired);
} }
/* If we are parsing tentatively, remember that an error has occurred /* If we are parsing tentatively, remember that an error has occurred
...@@ -1962,9 +1962,9 @@ cp_parser_check_for_invalid_template_id (cp_parser* parser, ...@@ -1962,9 +1962,9 @@ cp_parser_check_for_invalid_template_id (cp_parser* parser,
if (cp_lexer_next_token_is (parser->lexer, CPP_LESS)) if (cp_lexer_next_token_is (parser->lexer, CPP_LESS))
{ {
if (TYPE_P (type)) 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) else if (TREE_CODE (type) == IDENTIFIER_NODE)
error ("`%E' is not a template", type); error ("%qE is not a template", type);
else else
error ("invalid template-id"); error ("invalid template-id");
/* Remember the location of the invalid "<". */ /* Remember the location of the invalid "<". */
...@@ -2031,12 +2031,12 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree scope, tree id) ...@@ -2031,12 +2031,12 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree scope, tree id)
/* If the lookup found a template-name, it means that the user forgot /* If the lookup found a template-name, it means that the user forgot
to specify an argument list. Emit an useful error message. */ to specify an argument list. Emit an useful error message. */
if (TREE_CODE (decl) == TEMPLATE_DECL) 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); decl);
else if (!parser->scope) else if (!parser->scope)
{ {
/* Issue an error message. */ /* 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 /* If we're in a template class, it's possible that the user was
referring to a type from a base class. For example: referring to a type from a base class. For example:
...@@ -2082,11 +2082,10 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree scope, tree id) ...@@ -2082,11 +2082,10 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree scope, tree id)
else else
{ {
if (TREE_CODE (parser->scope) == NAMESPACE_DECL) 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); id, parser->scope);
else if (TYPE_P (parser->scope)) else if (TYPE_P (parser->scope))
error ("`%E' in class `%T' does not name a type", error ("q%E in class %qT does not name a type", id, parser->scope);
id, parser->scope);
else else
gcc_unreachable (); gcc_unreachable ();
} }
...@@ -2816,7 +2815,7 @@ cp_parser_primary_expression (cp_parser *parser, ...@@ -2816,7 +2815,7 @@ cp_parser_primary_expression (cp_parser *parser,
cp_lexer_consume_token (parser->lexer); cp_lexer_consume_token (parser->lexer);
if (parser->local_variables_forbidden_p) 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; return error_mark_node;
} }
/* Pointers cannot appear in constant-expressions. */ /* Pointers cannot appear in constant-expressions. */
...@@ -2951,7 +2950,7 @@ cp_parser_primary_expression (cp_parser *parser, ...@@ -2951,7 +2950,7 @@ cp_parser_primary_expression (cp_parser *parser,
decl = check_for_out_of_scope_variable (decl); decl = check_for_out_of_scope_variable (decl);
if (local_variable_p (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); decl);
return error_mark_node; return error_mark_node;
} }
...@@ -3316,7 +3315,7 @@ cp_parser_unqualified_id (cp_parser* parser, ...@@ -3316,7 +3315,7 @@ cp_parser_unqualified_id (cp_parser* parser,
if (declarator_p if (declarator_p
&& !DECL_IMPLICIT_TYPEDEF_P (type_decl) && !DECL_IMPLICIT_TYPEDEF_P (type_decl)
&& !DECL_SELF_REFERENCE_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); type_decl);
return build_nt (BIT_NOT_EXPR, TREE_TYPE (type_decl)); return build_nt (BIT_NOT_EXPR, TREE_TYPE (type_decl));
...@@ -3522,8 +3521,7 @@ cp_parser_nested_name_specifier_opt (cp_parser *parser, ...@@ -3522,8 +3521,7 @@ cp_parser_nested_name_specifier_opt (cp_parser *parser,
decl = cp_parser_lookup_name_simple (parser, token->value); decl = cp_parser_lookup_name_simple (parser, token->value);
if (TREE_CODE (decl) == TEMPLATE_DECL) if (TREE_CODE (decl) == TEMPLATE_DECL)
error ("`%D' used without template parameters", error ("%qD used without template parameters", decl);
decl);
else else
cp_parser_name_lookup_error cp_parser_name_lookup_error
(parser, token->value, decl, (parser, token->value, decl,
...@@ -5051,7 +5049,8 @@ cp_parser_direct_new_declarator (cp_parser* parser) ...@@ -5051,7 +5049,8 @@ cp_parser_direct_new_declarator (cp_parser* parser)
/*complain=*/true); /*complain=*/true);
if (!expression) 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; expression = error_mark_node;
} }
} }
...@@ -5987,7 +5986,7 @@ cp_parser_labeled_statement (cp_parser* parser, tree in_statement_expr) ...@@ -5987,7 +5986,7 @@ cp_parser_labeled_statement (cp_parser* parser, tree in_statement_expr)
expr_hi = NULL_TREE; expr_hi = NULL_TREE;
if (!parser->in_switch_statement_p) 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 else
statement = finish_case_label (expr, expr_hi); statement = finish_case_label (expr, expr_hi);
} }
...@@ -6493,7 +6492,7 @@ cp_parser_jump_statement (cp_parser* parser) ...@@ -6493,7 +6492,7 @@ cp_parser_jump_statement (cp_parser* parser)
} }
else else
statement = finish_break_stmt (); statement = finish_break_stmt ();
cp_parser_require (parser, CPP_SEMICOLON, "`;'"); cp_parser_require (parser, CPP_SEMICOLON, "%<;%>");
break; break;
case RID_CONTINUE: case RID_CONTINUE:
...@@ -6504,7 +6503,7 @@ cp_parser_jump_statement (cp_parser* parser) ...@@ -6504,7 +6503,7 @@ cp_parser_jump_statement (cp_parser* parser)
} }
else else
statement = finish_continue_stmt (); statement = finish_continue_stmt ();
cp_parser_require (parser, CPP_SEMICOLON, "`;'"); cp_parser_require (parser, CPP_SEMICOLON, "%<;%>");
break; break;
case RID_RETURN: case RID_RETURN:
...@@ -6520,7 +6519,7 @@ cp_parser_jump_statement (cp_parser* parser) ...@@ -6520,7 +6519,7 @@ cp_parser_jump_statement (cp_parser* parser)
/* Build the return-statement. */ /* Build the return-statement. */
statement = finish_return_stmt (expr); statement = finish_return_stmt (expr);
/* Look for the final `;'. */ /* Look for the final `;'. */
cp_parser_require (parser, CPP_SEMICOLON, "`;'"); cp_parser_require (parser, CPP_SEMICOLON, "%<;%>");
} }
break; break;
...@@ -6539,7 +6538,7 @@ cp_parser_jump_statement (cp_parser* parser) ...@@ -6539,7 +6538,7 @@ cp_parser_jump_statement (cp_parser* parser)
else else
finish_goto_stmt (cp_parser_identifier (parser)); finish_goto_stmt (cp_parser_identifier (parser));
/* Look for the final `;'. */ /* Look for the final `;'. */
cp_parser_require (parser, CPP_SEMICOLON, "`;'"); cp_parser_require (parser, CPP_SEMICOLON, "%<;%>");
break; break;
default: default:
...@@ -6997,7 +6996,7 @@ cp_parser_simple_declaration (cp_parser* parser, ...@@ -6997,7 +6996,7 @@ cp_parser_simple_declaration (cp_parser* parser,
if (decl != error_mark_node if (decl != error_mark_node
|| (cp_parser_parsing_tentatively (parser) || (cp_parser_parsing_tentatively (parser)
&& !cp_parser_committed_to_tentative_parse (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. */ /* Skip tokens until we reach the end of the statement. */
cp_parser_skip_to_end_of_statement (parser); cp_parser_skip_to_end_of_statement (parser);
/* If the next token is now a `;', consume it. */ /* If the next token is now a `;', consume it. */
...@@ -7105,7 +7104,7 @@ cp_parser_decl_specifier_seq (cp_parser* parser, ...@@ -7105,7 +7104,7 @@ cp_parser_decl_specifier_seq (cp_parser* parser,
friend */ friend */
case RID_FRIEND: case RID_FRIEND:
if (decl_specs->specs[(int) ds_friend]++) if (decl_specs->specs[(int) ds_friend]++)
error ("duplicate `friend'"); error ("duplicate %<friend%>");
/* Consume the token. */ /* Consume the token. */
cp_lexer_consume_token (parser->lexer); cp_lexer_consume_token (parser->lexer);
break; break;
...@@ -7679,7 +7678,7 @@ cp_parser_mem_initializer_id (cp_parser* parser) ...@@ -7679,7 +7678,7 @@ cp_parser_mem_initializer_id (cp_parser* parser)
/* `typename' is not allowed in this context ([temp.res]). */ /* `typename' is not allowed in this context ([temp.res]). */
if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TYPENAME)) 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)"); "member initializer is implicitly a type)");
cp_lexer_consume_token (parser->lexer); cp_lexer_consume_token (parser->lexer);
} }
...@@ -8041,7 +8040,7 @@ cp_parser_template_declaration (cp_parser* parser, bool member_p) ...@@ -8041,7 +8040,7 @@ cp_parser_template_declaration (cp_parser* parser, bool member_p)
/* Consume the `export' token. */ /* Consume the `export' token. */
cp_lexer_consume_token (parser->lexer); cp_lexer_consume_token (parser->lexer);
/* Warn that we do not support `export'. */ /* 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); cp_parser_template_declaration_after_export (parser, member_p);
...@@ -8294,7 +8293,7 @@ cp_parser_type_parameter (cp_parser* parser) ...@@ -8294,7 +8293,7 @@ cp_parser_type_parameter (cp_parser* parser)
default: default:
/* Anything else is an error. */ /* Anything else is an error. */
cp_parser_error (parser, cp_parser_error (parser,
"expected `class', `typename', or `template'"); "expected %<class%>, %<typename%>, or %<template%>");
parameter = error_mark_node; parameter = error_mark_node;
} }
...@@ -8408,21 +8407,21 @@ cp_parser_template_id (cp_parser *parser, ...@@ -8408,21 +8407,21 @@ cp_parser_template_id (cp_parser *parser,
and return simply an error. Maybe this is not a template-id and return simply an error. Maybe this is not a template-id
after all. */ after all. */
next_token_2->type = CPP_COLON; next_token_2->type = CPP_COLON;
cp_parser_error (parser, "expected `<'"); cp_parser_error (parser, "expected %<<%>");
pop_deferring_access_checks (); pop_deferring_access_checks ();
return error_mark_node; return error_mark_node;
} }
/* Otherwise, emit an error about the invalid digraph, but continue /* Otherwise, emit an error about the invalid digraph, but continue
parsing because we got our argument list. */ parsing because we got our argument list. */
pedwarn ("`<::' cannot begin a template-argument list"); pedwarn ("%<<::%> cannot begin a template-argument list");
inform ("`<:' is an alternate spelling for `['. Insert whitespace " inform ("%<<:%> is an alternate spelling for %<[%>. Insert whitespace "
"between `<' and `::'"); "between %<<%> and %<::%>");
if (!flag_permissive) if (!flag_permissive)
{ {
static bool hint; static bool hint;
if (!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; hint = true;
} }
} }
...@@ -8597,8 +8596,8 @@ cp_parser_template_name (cp_parser* parser, ...@@ -8597,8 +8596,8 @@ cp_parser_template_name (cp_parser* parser,
ptrdiff_t start; ptrdiff_t start;
cp_token* token; cp_token* token;
/* Explain what went wrong. */ /* Explain what went wrong. */
error ("non-template `%D' used as template", identifier); error ("non-template %qD used as template", identifier);
inform ("use `%T::template %D' to indicate that it is a template", inform ("use %<%T::template %D%> to indicate that it is a template",
parser->scope, identifier); parser->scope, identifier);
/* If parsing tentatively, find the location of the "<" /* If parsing tentatively, find the location of the "<"
token. */ token. */
...@@ -9625,7 +9624,7 @@ cp_parser_elaborated_type_specifier (cp_parser* parser, ...@@ -9625,7 +9624,7 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
tag_type = typename_type; tag_type = typename_type;
/* The `typename' keyword is only allowed in templates. */ /* The `typename' keyword is only allowed in templates. */
if (!processing_template_decl) if (!processing_template_decl)
pedwarn ("using `typename' outside of template"); pedwarn ("using %<typename%> outside of template");
} }
/* Otherwise it must be a class-key. */ /* Otherwise it must be a class-key. */
else else
...@@ -11068,7 +11067,7 @@ cp_parser_direct_declarator (cp_parser* parser, ...@@ -11068,7 +11067,7 @@ cp_parser_direct_declarator (cp_parser* parser,
/*only_current_p=*/false); /*only_current_p=*/false);
/* If that failed, the declarator is invalid. */ /* If that failed, the declarator is invalid. */
if (type == error_mark_node) if (type == error_mark_node)
error ("`%T::%D' is not a type", error ("%<%T::%D%> is not a type",
TYPE_CONTEXT (scope), TYPE_CONTEXT (scope),
TYPE_IDENTIFIER (scope)); TYPE_IDENTIFIER (scope));
/* Build a new DECLARATOR. */ /* Build a new DECLARATOR. */
...@@ -11114,8 +11113,9 @@ cp_parser_direct_declarator (cp_parser* parser, ...@@ -11114,8 +11113,9 @@ cp_parser_direct_declarator (cp_parser* parser,
&& CLASSTYPE_USE_TEMPLATE (TREE_TYPE (unqualified_name))) && CLASSTYPE_USE_TEMPLATE (TREE_TYPE (unqualified_name)))
{ {
error ("invalid use of constructor as a template"); error ("invalid use of constructor as a template");
inform ("use `%T::%D' instead of `%T::%T' to name the " inform ("use %<%T::%D%> instead of %<%T::%T%> to name "
"constructor in a qualified name", class_type, "the constructor in a qualified name",
class_type,
DECL_NAME (TYPE_TI_TEMPLATE (class_type)), DECL_NAME (TYPE_TI_TEMPLATE (class_type)),
class_type, class_type); class_type, class_type);
} }
...@@ -11626,7 +11626,7 @@ cp_parser_parameter_declaration_list (cp_parser* parser, bool *is_error) ...@@ -11626,7 +11626,7 @@ cp_parser_parameter_declaration_list (cp_parser* parser, bool *is_error)
} }
else else
{ {
cp_parser_error (parser, "expected `,' or `...'"); cp_parser_error (parser, "expected %<,%> or %<...%>");
if (!cp_parser_parsing_tentatively (parser) if (!cp_parser_parsing_tentatively (parser)
|| cp_parser_committed_to_tentative_parse (parser)) || cp_parser_committed_to_tentative_parse (parser))
cp_parser_skip_to_closing_parenthesis (parser, cp_parser_skip_to_closing_parenthesis (parser,
...@@ -12595,7 +12595,7 @@ cp_parser_class_head (cp_parser* parser, ...@@ -12595,7 +12595,7 @@ cp_parser_class_head (cp_parser* parser,
xref_tag, since that has irreversible side-effects. */ xref_tag, since that has irreversible side-effects. */
if (!cp_parser_next_token_starts_class_definition_p (parser)) 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; return error_mark_node;
} }
...@@ -12620,8 +12620,8 @@ cp_parser_class_head (cp_parser* parser, ...@@ -12620,8 +12620,8 @@ cp_parser_class_head (cp_parser* parser,
class was originally declared, the program is invalid. */ class was originally declared, the program is invalid. */
if (scope && !is_ancestor (scope, nested_name_specifier)) if (scope && !is_ancestor (scope, nested_name_specifier))
{ {
error ("declaration of `%D' in `%D' which does not " error ("declaration of %qD in %qD which does not enclose %qD",
"enclose `%D'", type, scope, nested_name_specifier); type, scope, nested_name_specifier);
type = NULL_TREE; type = NULL_TREE;
goto done; goto done;
} }
...@@ -12644,7 +12644,7 @@ cp_parser_class_head (cp_parser* parser, ...@@ -12644,7 +12644,7 @@ cp_parser_class_head (cp_parser* parser,
&& parser->num_template_parameter_lists == 0 && parser->num_template_parameter_lists == 0
&& template_id_p) && 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; invalid_explicit_specialization_p = true;
/* Take the same action that would have been taken by /* Take the same action that would have been taken by
cp_parser_explicit_specialization. */ cp_parser_explicit_specialization. */
...@@ -13179,7 +13179,7 @@ cp_parser_member_declaration (cp_parser* parser) ...@@ -13179,7 +13179,7 @@ cp_parser_member_declaration (cp_parser* parser)
else if (cp_lexer_next_token_is_not (parser->lexer, else if (cp_lexer_next_token_is_not (parser->lexer,
CPP_SEMICOLON)) CPP_SEMICOLON))
{ {
cp_parser_error (parser, "expected `;'"); cp_parser_error (parser, "expected %<;%>");
/* Skip tokens until we find a `;'. */ /* Skip tokens until we find a `;'. */
cp_parser_skip_to_end_of_statement (parser); cp_parser_skip_to_end_of_statement (parser);
...@@ -13364,7 +13364,7 @@ cp_parser_base_specifier (cp_parser* parser) ...@@ -13364,7 +13364,7 @@ cp_parser_base_specifier (cp_parser* parser)
if (virtual_p && !duplicate_virtual_error_issued_p) if (virtual_p && !duplicate_virtual_error_issued_p)
{ {
cp_parser_error (parser, 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; duplicate_virtual_error_issued_p = true;
} }
...@@ -13406,9 +13406,9 @@ cp_parser_base_specifier (cp_parser* parser) ...@@ -13406,9 +13406,9 @@ cp_parser_base_specifier (cp_parser* parser)
if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TYPENAME)) if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TYPENAME))
{ {
if (!processing_template_decl) if (!processing_template_decl)
error ("keyword `typename' not allowed outside of templates"); error ("keyword %<typename%> not allowed outside of templates");
else else
error ("keyword `typename' not allowed in this context " error ("keyword %<typename%> not allowed in this context "
"(the base class is implicitly a type)"); "(the base class is implicitly a type)");
cp_lexer_consume_token (parser->lexer); cp_lexer_consume_token (parser->lexer);
} }
...@@ -14243,7 +14243,7 @@ cp_parser_lookup_name (cp_parser *parser, tree name, ...@@ -14243,7 +14243,7 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
cp_parser_error, so we incorporate its actions directly. */ cp_parser_error, so we incorporate its actions directly. */
if (!cp_parser_simulate_error (parser)) if (!cp_parser_simulate_error (parser))
{ {
error ("reference to `%D' is ambiguous", name); error ("reference to %qD is ambiguous", name);
print_candidates (decl); print_candidates (decl);
} }
return error_mark_node; return error_mark_node;
...@@ -15203,7 +15203,7 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn) ...@@ -15203,7 +15203,7 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn)
there was extra junk after the end of the default there was extra junk after the end of the default
argument. */ argument. */
if (!cp_lexer_next_token_is (parser->lexer, CPP_EOF)) 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. */ /* Revert to the main lexer. */
cp_parser_pop_lexer (parser); cp_parser_pop_lexer (parser);
...@@ -15572,7 +15572,7 @@ static void ...@@ -15572,7 +15572,7 @@ static void
cp_parser_check_class_key (enum tag_types class_key, tree type) cp_parser_check_class_key (enum tag_types class_key, tree type)
{ {
if ((TREE_CODE (type) == UNION_TYPE) != (class_key == union_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 == union_type ? "union"
: class_key == record_type ? "struct" : "class", : class_key == record_type ? "struct" : "class",
type); type);
...@@ -15583,7 +15583,8 @@ cp_parser_check_class_key (enum tag_types class_key, tree type) ...@@ -15583,7 +15583,8 @@ cp_parser_check_class_key (enum tag_types class_key, tree type)
This applies to nested classes and nested class templates. This applies to nested classes and nested class templates.
[class.mem/1]. */ [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))) if (!CLASS_TYPE_P (TREE_TYPE (decl)))
return; return;
...@@ -15592,7 +15593,7 @@ static void cp_parser_check_access_in_redeclaration (tree decl) ...@@ -15592,7 +15593,7 @@ static void cp_parser_check_access_in_redeclaration (tree decl)
!= (current_access_specifier == access_private_node)) != (current_access_specifier == access_private_node))
|| (TREE_PROTECTED (decl) || (TREE_PROTECTED (decl)
!= (current_access_specifier == access_protected_node))) != (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. /* Look for the `template' keyword, as a syntactic disambiguator.
...@@ -15609,7 +15610,7 @@ cp_parser_optional_template_keyword (cp_parser *parser) ...@@ -15609,7 +15610,7 @@ cp_parser_optional_template_keyword (cp_parser *parser)
template and what is not. */ template and what is not. */
if (!processing_template_decl) if (!processing_template_decl)
{ {
error ("`template' (as a disambiguator) is only allowed " error ("%<template%> (as a disambiguator) is only allowed "
"within templates"); "within templates");
/* If this part of the token stream is rescanned, the same /* If this part of the token stream is rescanned, the same
error message would be generated. So, we purge the token 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> 2004-10-04 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/17283 PR fortran/17283
......
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
// PR 775. Some mismatches which were broken. // PR 775. Some mismatches which were broken.
template <class T> struct A {}; 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 {}; struct B {};
union B b; // { dg-error "`union' tag" "" } union B b; // { dg-error "'union' tag" "" }
union C {}; union C {};
class C c; // { dg-error "`class' tag" "" } class C c; // { dg-error "'class' tag" "" }
...@@ -10,17 +10,17 @@ namespace N ...@@ -10,17 +10,17 @@ namespace N
} }
N::A f2; // { dg-error "without an argument list" } N::A f2; // { dg-error "without an argument list" }
N::INVALID f3; // { 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::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::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" } typename N::A f7; // { dg-error "without an argument list|outside of template" }
struct B struct B
{ {
N::A f2; // { dg-error "without an argument list" } N::A f2; // { dg-error "without an argument list" }
N::INVALID f3; // { 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::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::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" } typename N::A f7; // { dg-error "without an argument list|outside of template" }
}; };
...@@ -28,9 +28,9 @@ template <int> ...@@ -28,9 +28,9 @@ template <int>
struct C struct C
{ {
N::A f2; // { dg-error "without an argument list" } N::A f2; // { dg-error "without an argument list" }
N::INVALID f3; // { 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::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::K f6; // { dg-error "in namespace 'N' does not name a type" }
typename N::A f7; // { dg-error "without an argument list" } typename N::A f7; // { dg-error "without an argument list" }
}; };
......
...@@ -7,8 +7,8 @@ template <typename K1> struct O { ...@@ -7,8 +7,8 @@ template <typename K1> struct O {
}; };
template <typename T> template <typename T>
struct 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" } A() : typename O<T>::template I<int>() // { dg-error "keyword 'typename' not allowed" }
{}; {};
}; };
......
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