From 4460cef2258096e1ad518654c127eea8ac71fb79 Mon Sep 17 00:00:00 2001 From: Gabriel Dos Reis Date: Sun, 23 May 2004 10:51:45 +0000 Subject: [PATCH] class.c (alter_access): Use %E format specifier to print an identifier node. * class.c (alter_access): Use %E format specifier to print an identifier node. Avoid looking at the IDENTIFIER_POINTER. (push_lang_context): Likewise. * decl.c (lookup_label): Likewise. (grokdeclarator): Likewise. * parser.c (cp_parser_check_for_invalid_template_id):Likewise. * pt.c (do_type_instantiation): Likewise. * tree.c (handle_java_interface_attribute): Likewise. (handle_com_interface_attribute): Likewise. (handle_init_priority_attribute): Likewise. From-SVN: r82161 --- gcc/cp/ChangeLog | 13 +++++++++++++ gcc/cp/class.c | 6 +++--- gcc/cp/decl.c | 20 +++++++++----------- gcc/cp/parser.c | 2 +- gcc/cp/pt.c | 4 ++-- gcc/cp/tree.c | 19 +++++++++---------- 6 files changed, 37 insertions(+), 27 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9af31d52885..3878c7ecff5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,16 @@ +2004-05-23 Gabriel Dos Reis + + * class.c (alter_access): Use %E format specifier to print an + identifier node. Avoid looking at the IDENTIFIER_POINTER. + (push_lang_context): Likewise. + * decl.c (lookup_label): Likewise. + (grokdeclarator): Likewise. + * parser.c (cp_parser_check_for_invalid_template_id): Likewise. + * pt.c (do_type_instantiation): Likewise. + * tree.c (handle_java_interface_attribute): Likewise. + (handle_com_interface_attribute): Likewise. + (handle_init_priority_attribute): Likewise. + 2004-05-22 Mark Mitchell PR c++/15285 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 73828a854e8..47c60e7851d 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1055,8 +1055,8 @@ alter_access (tree t, tree fdecl, tree access) if (TREE_CODE (TREE_TYPE (fdecl)) == FUNCTION_DECL) cp_error_at ("conflicting access specifications for method `%D', ignored", TREE_TYPE (fdecl)); else - error ("conflicting access specifications for field `%s', ignored", - IDENTIFIER_POINTER (DECL_NAME (fdecl))); + error ("conflicting access specifications for field `%E', ignored", + DECL_NAME (fdecl)); } else { @@ -5706,7 +5706,7 @@ push_lang_context (tree name) current_lang_name = name; } else - error ("language string `\"%s\"' not recognized", IDENTIFIER_POINTER (name)); + error ("language string `\"%E\"' not recognized", name); } /* Get out of the current language scope. */ diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index fe04827808e..65e8800beec 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -2066,8 +2066,7 @@ lookup_label (tree id) /* You can't use labels at global scope. */ if (current_function_decl == NULL_TREE) { - error ("label `%s' referenced outside of any function", - IDENTIFIER_POINTER (id)); + error ("label `%E' referenced outside of any function", id); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE); } @@ -6746,7 +6745,7 @@ grokdeclarator (tree declarator, longlong = 1; } else if (RIDBIT_SETP (i, specbits)) - pedwarn ("duplicate `%s'", IDENTIFIER_POINTER (id)); + pedwarn ("duplicate `%E'", id); /* Diagnose "__thread extern" or "__thread static". */ if (RIDBIT_SETP (RID_THREAD, specbits)) @@ -6786,8 +6785,7 @@ grokdeclarator (tree declarator, { tree t = lookup_name (id, 1); if (!t || TREE_CODE (t) != TYPE_DECL) - error ("`%s' fails to be a typedef or built in type", - IDENTIFIER_POINTER (id)); + error ("`%E' fails to be a typedef or built in type", id); else { type = TREE_TYPE (t); @@ -7343,8 +7341,8 @@ grokdeclarator (tree declarator, error ("destructor cannot be static member function"); if (quals) { - error ("destructors may not be `%s'", - IDENTIFIER_POINTER (TREE_VALUE (quals))); + error ("destructors may not be `%E'", + TREE_VALUE (quals)); quals = NULL_TREE; } if (decl_context == FIELD) @@ -7372,8 +7370,8 @@ grokdeclarator (tree declarator, } if (quals) { - error ("constructors may not be `%s'", - IDENTIFIER_POINTER (TREE_VALUE (quals))); + error ("constructors may not be `%E'", + TREE_VALUE (quals)); quals = NULL_TREE; } { @@ -8179,8 +8177,8 @@ grokdeclarator (tree declarator, { if (friendp) { - error ("`%s' is neither function nor member function; cannot be declared friend", - IDENTIFIER_POINTER (declarator)); + error ("`%E' is neither function nor member function; " + "cannot be declared friend", declarator); friendp = 0; } decl = NULL_TREE; diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index fdc171e041f..d26061f87d2 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -1891,7 +1891,7 @@ cp_parser_check_for_invalid_template_id (cp_parser* parser, if (TYPE_P (type)) error ("`%T' is not a template", type); else if (TREE_CODE (type) == IDENTIFIER_NODE) - error ("`%s' is not a template", IDENTIFIER_POINTER (type)); + error ("`%E' is not a template", type); else error ("invalid template-id"); /* Remember the location of the invalid "<". */ diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c506609b7f1..2b124792572 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -10698,8 +10698,8 @@ do_type_instantiation (tree t, tree storage, tsubst_flags_t complain) if (storage != NULL_TREE) { if (pedantic && !in_system_header) - pedwarn("ISO C++ forbids the use of `%s' on explicit instantiations", - IDENTIFIER_POINTER (storage)); + pedwarn("ISO C++ forbids the use of `%E' on explicit instantiations", + storage); if (storage == ridpointers[(int) RID_INLINE]) nomem_p = 1; diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 1e470eb862d..e9bfdb8be9a 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1811,8 +1811,8 @@ handle_java_interface_attribute (tree* node, || !CLASS_TYPE_P (*node) || !TYPE_FOR_JAVA (*node)) { - error ("`%s' attribute can only be applied to Java class definitions", - IDENTIFIER_POINTER (name)); + error ("`%E' attribute can only be applied to Java class definitions", + name); *no_add_attrs = true; return NULL_TREE; } @@ -1840,14 +1840,14 @@ handle_com_interface_attribute (tree* node, || !CLASS_TYPE_P (*node) || *node != TYPE_MAIN_VARIANT (*node)) { - warning ("`%s' attribute can only be applied to class definitions", - IDENTIFIER_POINTER (name)); + warning ("`%E' attribute can only be applied to class definitions", + name); return NULL_TREE; } if (!warned++) - warning ("`%s' is obsolete; g++ vtables are now COM-compatible by default", - IDENTIFIER_POINTER (name)); + warning ("`%E' is obsolete; g++ vtables are now COM-compatible by default", + name); return NULL_TREE; } @@ -1891,8 +1891,8 @@ handle_init_priority_attribute (tree* node, init_priority value, so don't allow it. */ || current_function_decl) { - error ("can only use `%s' attribute on file-scope definitions of objects of class type", - IDENTIFIER_POINTER (name)); + error ("can only use `%E' attribute on file-scope definitions " + "of objects of class type", name); *no_add_attrs = true; return NULL_TREE; } @@ -1919,8 +1919,7 @@ handle_init_priority_attribute (tree* node, } else { - error ("`%s' attribute is not supported on this platform", - IDENTIFIER_POINTER (name)); + error ("`%E' attribute is not supported on this platform", name); *no_add_attrs = true; return NULL_TREE; } -- 2.30.2