From 653e540576c50568687d95e09f5f3322fc15e227 Mon Sep 17 00:00:00 2001 From: mrs Date: Wed, 15 Jun 2005 00:41:35 +0000 Subject: Canonicalize whitespace. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100965 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/error.c | 394 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 197 insertions(+), 197 deletions(-) (limited to 'gcc/cp/error.c') diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 5ed081833af..c247c97c61e 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -81,7 +81,7 @@ static const char *function_category (tree); static void maybe_print_instantiation_context (diagnostic_context *); static void print_instantiation_full_context (diagnostic_context *); static void print_instantiation_partial_context (diagnostic_context *, - tree, location_t); + tree, location_t); static void cp_diagnostic_starter (diagnostic_context *, diagnostic_info *); static void cp_diagnostic_finalizer (diagnostic_context *, diagnostic_info *); static void cp_print_error_function (diagnostic_context *, diagnostic_info *); @@ -114,10 +114,10 @@ dump_scope (tree scope, int flags) if (TREE_CODE (scope) == NAMESPACE_DECL) { if (scope != global_namespace) - { - dump_decl (scope, f); - pp_cxx_colon_colon (cxx_pp); - } + { + dump_decl (scope, f); + pp_cxx_colon_colon (cxx_pp); + } } else if (AGGREGATE_TYPE_P (scope)) { @@ -155,7 +155,7 @@ dump_template_argument_list (tree args, int flags) for (i = 0; i< n; ++i) { if (need_comma) - pp_separate_with_comma (cxx_pp); + pp_separate_with_comma (cxx_pp); dump_template_argument (TREE_VEC_ELT (args, i), flags); need_comma = 1; } @@ -172,15 +172,15 @@ dump_template_parameter (tree parm, int flags) if (TREE_CODE (p) == TYPE_DECL) { if (flags & TFF_DECL_SPECIFIERS) - { - pp_cxx_identifier (cxx_pp, "class"); - if (DECL_NAME (p)) - pp_cxx_tree_identifier (cxx_pp, DECL_NAME (p)); - } + { + pp_cxx_identifier (cxx_pp, "class"); + if (DECL_NAME (p)) + pp_cxx_tree_identifier (cxx_pp, DECL_NAME (p)); + } else if (DECL_NAME (p)) - pp_cxx_tree_identifier (cxx_pp, DECL_NAME (p)); + pp_cxx_tree_identifier (cxx_pp, DECL_NAME (p)); else - pp_cxx_canonical_template_parameter (cxx_pp, TREE_TYPE (p)); + pp_cxx_canonical_template_parameter (cxx_pp, TREE_TYPE (p)); } else dump_decl (p, flags | TFF_DECL_SPECIFIERS); @@ -191,9 +191,9 @@ dump_template_parameter (tree parm, int flags) pp_equal (cxx_pp); pp_cxx_whitespace (cxx_pp); if (TREE_CODE (p) == TYPE_DECL || TREE_CODE (p) == TEMPLATE_DECL) - dump_type (a, flags & ~TFF_CHASE_TYPEDEF); + dump_type (a, flags & ~TFF_CHASE_TYPEDEF); else - dump_expr (a, flags | TFF_EXPR_IN_PARENS); + dump_expr (a, flags | TFF_EXPR_IN_PARENS); } } @@ -228,9 +228,9 @@ dump_template_bindings (tree parms, tree args) if (need_comma) pp_separate_with_comma (cxx_pp); dump_template_parameter (TREE_VEC_ELT (p, i), TFF_PLAIN_IDENTIFIER); - pp_cxx_whitespace (cxx_pp); - pp_equal (cxx_pp); - pp_cxx_whitespace (cxx_pp); + pp_cxx_whitespace (cxx_pp); + pp_equal (cxx_pp); + pp_cxx_whitespace (cxx_pp); if (arg) dump_template_argument (arg, TFF_PLAIN_IDENTIFIER); else @@ -283,11 +283,11 @@ dump_type (tree t, int flags) case TYPE_DECL: if (flags & TFF_CHASE_TYPEDEF) - { - dump_type (DECL_ORIGINAL_TYPE (t) - ? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t), flags); - break; - } + { + dump_type (DECL_ORIGINAL_TYPE (t) + ? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t), flags); + break; + } /* Else fall through. */ case TEMPLATE_DECL: @@ -309,7 +309,7 @@ dump_type (tree t, int flags) if (TYPE_IDENTIFIER (t)) pp_cxx_tree_identifier (cxx_pp, TYPE_IDENTIFIER (t)); else - pp_cxx_canonical_template_parameter (cxx_pp, t); + pp_cxx_canonical_template_parameter (cxx_pp, t); break; case BOUND_TEMPLATE_TEMPLATE_PARM: @@ -318,7 +318,7 @@ dump_type (tree t, int flags) pp_cxx_cv_qualifier_seq (cxx_pp, t); pp_cxx_tree_identifier (cxx_pp, TYPE_IDENTIFIER (t)); pp_cxx_begin_template_argument_list (cxx_pp); - dump_template_argument_list (args, flags); + dump_template_argument_list (args, flags); pp_cxx_end_template_argument_list (cxx_pp); } break; @@ -328,8 +328,8 @@ dump_type (tree t, int flags) if (TYPE_IDENTIFIER (t)) pp_cxx_tree_identifier (cxx_pp, TYPE_IDENTIFIER (t)); else - pp_cxx_canonical_template_parameter - (cxx_pp, TEMPLATE_TYPE_PARM_INDEX (t)); + pp_cxx_canonical_template_parameter + (cxx_pp, TEMPLATE_TYPE_PARM_INDEX (t)); break; /* This is not always necessary for pointers and such, but doing this @@ -436,38 +436,38 @@ dump_aggr_type (tree t, int flags) { typdef = !DECL_ARTIFICIAL (name); tmplate = !typdef && TREE_CODE (t) != ENUMERAL_TYPE - && TYPE_LANG_SPECIFIC (t) && CLASSTYPE_TEMPLATE_INFO (t) - && (CLASSTYPE_TEMPLATE_SPECIALIZATION (t) - || TREE_CODE (CLASSTYPE_TI_TEMPLATE (t)) != TEMPLATE_DECL - || DECL_TEMPLATE_SPECIALIZATION (CLASSTYPE_TI_TEMPLATE (t)) - || PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t))); + && TYPE_LANG_SPECIFIC (t) && CLASSTYPE_TEMPLATE_INFO (t) + && (CLASSTYPE_TEMPLATE_SPECIALIZATION (t) + || TREE_CODE (CLASSTYPE_TI_TEMPLATE (t)) != TEMPLATE_DECL + || DECL_TEMPLATE_SPECIALIZATION (CLASSTYPE_TI_TEMPLATE (t)) + || PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t))); dump_scope (CP_DECL_CONTEXT (name), flags | TFF_SCOPE); if (tmplate) - { - /* Because the template names are mangled, we have to locate - the most general template, and use that name. */ - tree tpl = CLASSTYPE_TI_TEMPLATE (t); - - while (DECL_TEMPLATE_INFO (tpl)) - tpl = DECL_TI_TEMPLATE (tpl); - name = tpl; - } + { + /* Because the template names are mangled, we have to locate + the most general template, and use that name. */ + tree tpl = CLASSTYPE_TI_TEMPLATE (t); + + while (DECL_TEMPLATE_INFO (tpl)) + tpl = DECL_TI_TEMPLATE (tpl); + name = tpl; + } name = DECL_NAME (name); } if (name == 0 || ANON_AGGRNAME_P (name)) { if (flags & TFF_CLASS_KEY_OR_ENUM) - pp_identifier (cxx_pp, ""); + pp_identifier (cxx_pp, ""); else - pp_printf (pp_base (cxx_pp), "", variety); + pp_printf (pp_base (cxx_pp), "", variety); } else pp_cxx_tree_identifier (cxx_pp, name); if (tmplate) dump_template_parms (TYPE_TEMPLATE_INFO (t), - !CLASSTYPE_USE_TEMPLATE (t), - flags & ~TFF_TEMPLATE_HEADER); + !CLASSTYPE_USE_TEMPLATE (t), + flags & ~TFF_TEMPLATE_HEADER); } /* Dump into the obstack the initial part of the output for a given type. @@ -504,8 +504,8 @@ dump_type_prefix (tree t, int flags) pp_cxx_left_paren (cxx_pp); } pp_character (cxx_pp, "&*"[TREE_CODE (t) == POINTER_TYPE]); - pp_base (cxx_pp)->padding = pp_before; - pp_cxx_cv_qualifier_seq (cxx_pp, t); + pp_base (cxx_pp)->padding = pp_before; + pp_cxx_cv_qualifier_seq (cxx_pp, t); } break; @@ -514,9 +514,9 @@ dump_type_prefix (tree t, int flags) dump_type_prefix (TREE_TYPE (t), flags); if (TREE_CODE (t) == OFFSET_TYPE) /* pmfs deal with this in d_t_p */ { - pp_maybe_space (cxx_pp); - if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE) - pp_cxx_left_paren (cxx_pp); + pp_maybe_space (cxx_pp); + if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE) + pp_cxx_left_paren (cxx_pp); dump_type (TYPE_OFFSET_BASETYPE (t), flags); pp_cxx_colon_colon (cxx_pp); } @@ -526,7 +526,7 @@ dump_type_prefix (tree t, int flags) break; /* Can only be reached through function pointer -- this would not be - correct if FUNCTION_DECLs used it. */ + correct if FUNCTION_DECLs used it. */ case FUNCTION_TYPE: dump_type_prefix (TREE_TYPE (t), flags); pp_maybe_space (cxx_pp); @@ -601,7 +601,7 @@ dump_type_suffix (tree t, int flags) case METHOD_TYPE: { tree arg; - pp_cxx_right_paren (cxx_pp); + pp_cxx_right_paren (cxx_pp); arg = TYPE_ARG_TYPES (t); if (TREE_CODE (t) == METHOD_TYPE) arg = TREE_CHAIN (arg); @@ -611,10 +611,10 @@ dump_type_suffix (tree t, int flags) dump_parameters (arg, flags & ~TFF_FUNCTION_DEFAULT_ARGUMENTS); if (TREE_CODE (t) == METHOD_TYPE) - pp_cxx_cv_qualifier_seq - (cxx_pp, TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t)))); - else - pp_cxx_cv_qualifier_seq(cxx_pp, t); + pp_cxx_cv_qualifier_seq + (cxx_pp, TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t)))); + else + pp_cxx_cv_qualifier_seq(cxx_pp, t); dump_exception_spec (TYPE_RAISES_EXCEPTIONS (t), flags); dump_type_suffix (TREE_TYPE (t), flags); break; @@ -627,15 +627,15 @@ dump_type_suffix (tree t, int flags) { if (host_integerp (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0)) pp_wide_integer - (cxx_pp, tree_low_cst (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0) + 1); + (cxx_pp, tree_low_cst (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0) + 1); else if (TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (t))) == MINUS_EXPR) dump_expr (TREE_OPERAND (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0), - flags & ~TFF_EXPR_IN_PARENS); + flags & ~TFF_EXPR_IN_PARENS); else dump_expr (fold (cp_build_binary_op (PLUS_EXPR, TYPE_MAX_VALUE (TYPE_DOMAIN (t)), integer_one_node)), - flags & ~TFF_EXPR_IN_PARENS); + flags & ~TFF_EXPR_IN_PARENS); } pp_cxx_right_bracket (cxx_pp); dump_type_suffix (TREE_TYPE (t), flags); @@ -666,7 +666,7 @@ dump_type_suffix (tree t, int flags) pp_unsupported_tree (cxx_pp, t); case ERROR_MARK: /* Don't mark it here, we should have already done in - dump_type_prefix. */ + dump_type_prefix. */ break; } } @@ -730,7 +730,7 @@ dump_decl (tree t, int flags) pp_cxx_identifier (cxx_pp, "typedef"); dump_simple_decl (t, DECL_ORIGINAL_TYPE (t) ? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t), - flags); + flags); break; case VAR_DECL: @@ -755,15 +755,15 @@ dump_decl (tree t, int flags) case NAMESPACE_DECL: if (flags & TFF_DECL_SPECIFIERS) - pp_cxx_declaration (cxx_pp, t); + pp_cxx_declaration (cxx_pp, t); else - { - dump_scope (CP_DECL_CONTEXT (t), flags); - if (DECL_NAME (t) == NULL_TREE) - pp_identifier (cxx_pp, ""); - else - pp_cxx_tree_identifier (cxx_pp, DECL_NAME (t)); - } + { + dump_scope (CP_DECL_CONTEXT (t), flags); + if (DECL_NAME (t) == NULL_TREE) + pp_identifier (cxx_pp, ""); + else + pp_cxx_tree_identifier (cxx_pp, DECL_NAME (t)); + } break; case SCOPE_REF: @@ -786,7 +786,7 @@ dump_decl (tree t, int flags) case BIT_NOT_EXPR: /* This is a pseudo destructor call which has not been folded into - a PSEUDO_DTOR_EXPR yet. */ + a PSEUDO_DTOR_EXPR yet. */ pp_cxx_complement (cxx_pp); dump_type (TREE_OPERAND (t, 0), flags); break; @@ -816,12 +816,12 @@ dump_decl (tree t, int flags) if (DECL_CLASS_SCOPE_P (t)) { dump_type (DECL_CONTEXT (t), flags); - pp_cxx_colon_colon (cxx_pp); + pp_cxx_colon_colon (cxx_pp); } else if (DECL_CONTEXT (t)) { dump_decl (DECL_CONTEXT (t), flags); - pp_cxx_colon_colon (cxx_pp); + pp_cxx_colon_colon (cxx_pp); } dump_decl (DECL_NAME (t), flags); break; @@ -838,7 +838,7 @@ dump_decl (tree t, int flags) else if (DECL_GLOBAL_CTOR_P (t) || DECL_GLOBAL_DTOR_P (t)) dump_global_iord (t); else - dump_function_decl (t, flags); + dump_function_decl (t, flags); break; case TEMPLATE_DECL: @@ -893,9 +893,9 @@ dump_decl (tree t, int flags) case TEMPLATE_TYPE_PARM: if (flags & TFF_DECL_SPECIFIERS) - pp_cxx_declaration (cxx_pp, t); + pp_cxx_declaration (cxx_pp, t); else - pp_type_id (cxx_pp, t); + pp_type_id (cxx_pp, t); break; default: @@ -921,28 +921,28 @@ dump_template_decl (tree t, int flags) if (flags & TFF_TEMPLATE_HEADER) { for (parms = orig_parms = nreverse (orig_parms); - parms; - parms = TREE_CHAIN (parms)) - { + parms; + parms = TREE_CHAIN (parms)) + { tree inner_parms = INNERMOST_TEMPLATE_PARMS (parms); - int len = TREE_VEC_LENGTH (inner_parms); + int len = TREE_VEC_LENGTH (inner_parms); - pp_cxx_identifier (cxx_pp, "template"); - pp_cxx_begin_template_argument_list (cxx_pp); + pp_cxx_identifier (cxx_pp, "template"); + pp_cxx_begin_template_argument_list (cxx_pp); /* If we've shown the template prefix, we'd better show the parameters' and decl's type too. */ flags |= TFF_DECL_SPECIFIERS; - for (i = 0; i < len; i++) - { - if (i) - pp_separate_with_comma (cxx_pp); - dump_template_parameter (TREE_VEC_ELT (inner_parms, i), flags); - } - pp_cxx_end_template_argument_list (cxx_pp); - pp_cxx_whitespace (cxx_pp); - } + for (i = 0; i < len; i++) + { + if (i) + pp_separate_with_comma (cxx_pp); + dump_template_parameter (TREE_VEC_ELT (inner_parms, i), flags); + } + pp_cxx_end_template_argument_list (cxx_pp); + pp_cxx_whitespace (cxx_pp); + } nreverse(orig_parms); if (DECL_TEMPLATE_TEMPLATE_PARM_P (t)) @@ -952,8 +952,8 @@ dump_template_decl (tree t, int flags) if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == TYPE_DECL) dump_type (TREE_TYPE (t), - ((flags & ~TFF_CLASS_KEY_OR_ENUM) | TFF_TEMPLATE_NAME - | (flags & TFF_DECL_SPECIFIERS ? TFF_CLASS_KEY_OR_ENUM : 0))); + ((flags & ~TFF_CLASS_KEY_OR_ENUM) | TFF_TEMPLATE_NAME + | (flags & TFF_DECL_SPECIFIERS ? TFF_CLASS_KEY_OR_ENUM : 0))); else if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == VAR_DECL) dump_decl (DECL_TEMPLATE_RESULT (t), flags | TFF_TEMPLATE_NAME); else @@ -1026,7 +1026,7 @@ dump_function_decl (tree t, int flags) /* Print the return type? */ if (show_return) show_return = !DECL_CONV_FN_P (t) && !DECL_CONSTRUCTOR_P (t) - && !DECL_DESTRUCTOR_P (t); + && !DECL_DESTRUCTOR_P (t); if (show_return) dump_type_prefix (TREE_TYPE (fntype), flags); @@ -1046,17 +1046,17 @@ dump_function_decl (tree t, int flags) dump_parameters (parmtypes, flags); if (TREE_CODE (fntype) == METHOD_TYPE) - { - pp_base (cxx_pp)->padding = pp_before; - pp_cxx_cv_qualifier_seq - (cxx_pp, TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fntype)))); - } + { + pp_base (cxx_pp)->padding = pp_before; + pp_cxx_cv_qualifier_seq + (cxx_pp, TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fntype)))); + } if (flags & TFF_EXCEPTION_SPECIFICATION) - { - pp_base (cxx_pp)->padding = pp_before; - dump_exception_spec (TYPE_RAISES_EXCEPTIONS (fntype), flags); - } + { + pp_base (cxx_pp)->padding = pp_before; + dump_exception_spec (TYPE_RAISES_EXCEPTIONS (fntype), flags); + } if (show_return) dump_type_suffix (TREE_TYPE (fntype), flags); @@ -1089,22 +1089,22 @@ dump_parameters (tree parmtypes, int flags) parmtypes = TREE_CHAIN (parmtypes)) { if (!first) - pp_separate_with_comma (cxx_pp); + pp_separate_with_comma (cxx_pp); first = 0; if (!parmtypes) - { - pp_cxx_identifier (cxx_pp, "..."); - break; - } + { + pp_cxx_identifier (cxx_pp, "..."); + break; + } dump_type (TREE_VALUE (parmtypes), flags); if ((flags & TFF_FUNCTION_DEFAULT_ARGUMENTS) && TREE_PURPOSE (parmtypes)) - { - pp_cxx_whitespace (cxx_pp); - pp_equal (cxx_pp); - pp_cxx_whitespace (cxx_pp); - dump_expr (TREE_PURPOSE (parmtypes), flags | TFF_EXPR_IN_PARENS); - } + { + pp_cxx_whitespace (cxx_pp); + pp_equal (cxx_pp); + pp_cxx_whitespace (cxx_pp); + dump_expr (TREE_PURPOSE (parmtypes), flags | TFF_EXPR_IN_PARENS); + } } pp_cxx_right_paren (cxx_pp); @@ -1121,14 +1121,14 @@ dump_exception_spec (tree t, int flags) pp_cxx_whitespace (cxx_pp); pp_cxx_left_paren (cxx_pp); if (TREE_VALUE (t) != NULL_TREE) - while (1) - { - dump_type (TREE_VALUE (t), flags); - t = TREE_CHAIN (t); - if (!t) - break; - pp_separate_with_comma (cxx_pp); - } + while (1) + { + dump_type (TREE_VALUE (t), flags); + t = TREE_CHAIN (t); + if (!t) + break; + pp_separate_with_comma (cxx_pp); + } pp_cxx_right_paren (cxx_pp); } } @@ -1218,17 +1218,17 @@ dump_template_parms (tree info, int primary, int flags) len = TREE_VEC_LENGTH (args); for (ix = 0; ix != len; ix++) - { - tree arg = TREE_VEC_ELT (args, ix); + { + tree arg = TREE_VEC_ELT (args, ix); - if (ix) - pp_separate_with_comma (cxx_pp); + if (ix) + pp_separate_with_comma (cxx_pp); - if (!arg) - pp_identifier (cxx_pp, "