/* Call-backs for C++ error reporting.
This code is non-reentrant.
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002,
- 2003, 2004 Free Software Foundation, Inc.
+ 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
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 *);
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))
{
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;
}
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);
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);
}
}
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
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:
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:
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;
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
}
case TYPENAME_TYPE:
pp_cxx_cv_qualifier_seq (cxx_pp, t);
- pp_cxx_identifier (cxx_pp,
- TYPENAME_IS_ENUM_P (t) ? "enum"
+ pp_cxx_identifier (cxx_pp,
+ TYPENAME_IS_ENUM_P (t) ? "enum"
: TYPENAME_IS_CLASS_P (t) ? "class"
: "typename");
dump_typename (t, 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, "<anonymous>");
+ pp_identifier (cxx_pp, "<anonymous>");
else
- pp_printf (pp_base (cxx_pp), "<anonymous %s>", variety);
+ pp_printf (pp_base (cxx_pp), "<anonymous %s>", 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.
Arrays must also do this for DECL nodes, like int a[], and for things like
int *[]&. */
-static void
+static void
dump_type_prefix (tree t, int flags)
{
if (TYPE_PTRMEMFUNC_P (t))
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;
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);
}
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);
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);
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;
{
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);
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;
}
}
&& TREE_CODE (TREE_TYPE (t)) == TEMPLATE_TYPE_PARM)
/* Say `class T' not just `T'. */
pp_cxx_identifier (cxx_pp, "class");
-
+
dump_type (TREE_TYPE (t), flags);
break;
}
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:
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, "<unnamed>");
- 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, "<unnamed>");
+ else
+ pp_cxx_tree_identifier (cxx_pp, DECL_NAME (t));
+ }
break;
case SCOPE_REF:
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;
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;
}
-
+
/* If there's only one function, just treat it like an ordinary
FUNCTION_DECL. */
t = OVL_CURRENT (t);
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:
case TEMPLATE_ID_EXPR:
{
tree name = TREE_OPERAND (t, 0);
-
+
if (is_overloaded_fn (name))
name = DECL_NAME (get_first_fn (name));
dump_decl (name, 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:
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))
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
/* 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);
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);
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);
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);
}
}
if (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (args))
args = TREE_VEC_ELT (args, TREE_VEC_LENGTH (args) - 1);
-
+
len = TREE_VEC_LENGTH (args);
for (ix = 0; ix != len; ix++)
- {
- tree arg = TREE_VEC_ELT (args, ix);
-
- if (ix)
- pp_separate_with_comma (cxx_pp);
-
- if (!arg)
- pp_identifier (cxx_pp, "<template parameter error>");
- else
- dump_template_argument (arg, flags);
- }
+ {
+ tree arg = TREE_VEC_ELT (args, ix);
+
+ if (ix)
+ pp_separate_with_comma (cxx_pp);
+
+ if (!arg)
+ pp_identifier (cxx_pp, "<template parameter error>");
+ else
+ dump_template_argument (arg, flags);
+ }
}
else if (primary)
{
len = parms ? TREE_VEC_LENGTH (parms) : 0;
for (ix = 0; ix != len; ix++)
- {
- tree parm = TREE_VALUE (TREE_VEC_ELT (parms, ix));
+ {
+ tree parm = TREE_VALUE (TREE_VEC_ELT (parms, ix));
- if (ix)
- pp_separate_with_comma (cxx_pp);
+ if (ix)
+ pp_separate_with_comma (cxx_pp);
- dump_decl (parm, flags & ~TFF_DECL_SPECIFIERS);
- }
+ dump_decl (parm, flags & ~TFF_DECL_SPECIFIERS);
+ }
}
pp_cxx_end_template_argument_list (cxx_pp);
}
{
if (t == 0)
return;
-
+
switch (TREE_CODE (t))
{
case VAR_DECL:
if (PAREN_STRING_LITERAL_P (t))
pp_cxx_right_paren (cxx_pp);
break;
-
+
case INTEGER_CST:
case REAL_CST:
pp_c_constant (pp_c_base (cxx_pp), t);
if (TREE_HAS_CONSTRUCTOR (t))
{
pp_cxx_identifier (cxx_pp, "new");
- pp_cxx_whitespace (cxx_pp);
+ pp_cxx_whitespace (cxx_pp);
dump_type (TREE_TYPE (TREE_TYPE (t)), flags);
}
else
- dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
+ dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
break;
case AGGR_INIT_EXPR:
tree type = TREE_OPERAND (t, 1);
tree init = TREE_OPERAND (t, 2);
if (NEW_EXPR_USE_GLOBAL (t))
- pp_cxx_colon_colon (cxx_pp);
+ pp_cxx_colon_colon (cxx_pp);
pp_cxx_identifier (cxx_pp, "new");
if (TREE_OPERAND (t, 0))
{
pp_cxx_left_paren (cxx_pp);
dump_expr_list (TREE_OPERAND (t, 0), flags);
- pp_cxx_right_paren (cxx_pp);
- pp_cxx_whitespace (cxx_pp);
+ pp_cxx_right_paren (cxx_pp);
+ pp_cxx_whitespace (cxx_pp);
}
if (TREE_CODE (type) == ARRAY_REF)
type = build_cplus_array_type
(TREE_OPERAND (type, 0),
- build_index_type (fold (build2 (MINUS_EXPR, integer_type_node,
- TREE_OPERAND (type, 1),
- integer_one_node))));
+ build_index_type (fold_build2 (MINUS_EXPR, integer_type_node,
+ TREE_OPERAND (type, 1),
+ integer_one_node)));
dump_type (type, flags);
if (init)
{
{
ob = TREE_OPERAND (ob, 0);
if (TREE_CODE (ob) != PARM_DECL
- || strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this"))
+ || (DECL_NAME (ob)
+ && strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this")))
{
dump_expr (ob, flags | TFF_EXPR_IN_PARENS);
pp_cxx_arrow (cxx_pp);
pp_cxx_right_bracket (cxx_pp);
break;
- case CONVERT_EXPR:
- if (TREE_TYPE (t) && VOID_TYPE_P (TREE_TYPE (t)))
- {
- pp_cxx_left_paren (cxx_pp);
- dump_type (TREE_TYPE (t), flags);
- pp_cxx_right_paren (cxx_pp);
- dump_expr (TREE_OPERAND (t, 0), flags);
- }
- else
- dump_unary_op ("+", t, flags);
+ case UNARY_PLUS_EXPR:
+ dump_unary_op ("+", t, flags);
break;
case ADDR_EXPR:
if (TREE_CODE (next) == FUNCTION_TYPE)
{
if (flags & TFF_EXPR_IN_PARENS)
- pp_cxx_left_paren (cxx_pp);
+ pp_cxx_left_paren (cxx_pp);
pp_cxx_star (cxx_pp);
dump_expr (TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS);
if (flags & TFF_EXPR_IN_PARENS)
- pp_cxx_right_paren (cxx_pp);
+ pp_cxx_right_paren (cxx_pp);
break;
}
/* Else fall through. */
break;
case NOP_EXPR:
+ case CONVERT_EXPR:
{
tree op = TREE_OPERAND (t, 0);
-
+
if (!same_type_p (TREE_TYPE (op), TREE_TYPE (t)))
{
/* It is a cast, but we cannot tell whether it is a
dump_expr (op, flags);
break;
}
-
+
case CONSTRUCTOR:
if (TREE_TYPE (t) && TYPE_PTRMEMFUNC_P (TREE_TYPE (t)))
{
if (integer_zerop (idx))
{
/* A NULL pointer-to-member constant. */
- pp_cxx_left_paren (cxx_pp);
- pp_cxx_left_paren (cxx_pp);
+ pp_cxx_left_paren (cxx_pp);
+ pp_cxx_left_paren (cxx_pp);
dump_type (TREE_TYPE (t), flags);
- pp_cxx_right_paren (cxx_pp);
- pp_character (cxx_pp, '0');
- pp_cxx_right_paren (cxx_pp);
+ pp_cxx_right_paren (cxx_pp);
+ pp_character (cxx_pp, '0');
+ pp_cxx_right_paren (cxx_pp);
break;
}
else if (host_integerp (idx, 0))
if (virtuals)
{
dump_expr (BV_FN (virtuals),
- flags | TFF_EXPR_IN_PARENS);
+ flags | TFF_EXPR_IN_PARENS);
break;
}
}
if (TREE_TYPE (t) && !CONSTRUCTOR_ELTS (t))
{
dump_type (TREE_TYPE (t), 0);
- pp_cxx_left_paren (cxx_pp);
- pp_cxx_right_paren (cxx_pp);
+ pp_cxx_left_paren (cxx_pp);
+ pp_cxx_right_paren (cxx_pp);
}
else
{
- pp_cxx_left_brace (cxx_pp);
+ pp_cxx_left_brace (cxx_pp);
dump_expr_list (CONSTRUCTOR_ELTS (t), flags);
- pp_cxx_right_brace (cxx_pp);
+ pp_cxx_right_brace (cxx_pp);
}
-
+
break;
case OFFSET_REF:
/* A::f */
dump_expr (t, flags | TFF_EXPR_IN_PARENS);
else if (BASELINK_P (t))
- dump_expr (OVL_CURRENT (BASELINK_FUNCTIONS (t)),
+ dump_expr (OVL_CURRENT (BASELINK_FUNCTIONS (t)),
flags | TFF_EXPR_IN_PARENS);
else
dump_decl (t, flags);
if (TREE_CODE (ob) == INDIRECT_REF)
{
dump_expr (TREE_OPERAND (ob, 0), flags | TFF_EXPR_IN_PARENS);
- pp_cxx_arrow (cxx_pp);
- pp_cxx_star (cxx_pp);
+ pp_cxx_arrow (cxx_pp);
+ pp_cxx_star (cxx_pp);
}
else
{
dump_expr (ob, flags | TFF_EXPR_IN_PARENS);
- pp_cxx_dot (cxx_pp);
- pp_cxx_star (cxx_pp);
+ pp_cxx_dot (cxx_pp);
+ pp_cxx_star (cxx_pp);
}
dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
}
{
pp_cxx_left_paren (cxx_pp);
dump_type (TREE_TYPE (t), flags);
- pp_cxx_right_paren (cxx_pp);
- pp_cxx_left_paren (cxx_pp);
+ pp_cxx_right_paren (cxx_pp);
+ pp_cxx_left_paren (cxx_pp);
dump_expr_list (TREE_OPERAND (t, 0), flags);
pp_cxx_right_paren (cxx_pp);
}
case SIZEOF_EXPR:
case ALIGNOF_EXPR:
if (TREE_CODE (t) == SIZEOF_EXPR)
- pp_cxx_identifier (cxx_pp, "sizeof");
+ pp_cxx_identifier (cxx_pp, "sizeof");
else
{
gcc_assert (TREE_CODE (t) == ALIGNOF_EXPR);
if (TYPE_P (TREE_OPERAND (t, 0)))
dump_type (TREE_OPERAND (t, 0), flags);
else
- dump_expr (TREE_OPERAND (t, 0), flags);
+ dump_expr (TREE_OPERAND (t, 0), flags);
pp_cxx_right_paren (cxx_pp);
break;
t = TYPE_MAIN_DECL (t);
else if (TREE_CODE (t) == OVERLOAD)
t = OVL_FUNCTION (t);
-
+
return DECL_SOURCE_LOCATION (t);
}
static void
cp_diagnostic_starter (diagnostic_context *context,
- diagnostic_info *diagnostic)
+ diagnostic_info *diagnostic)
{
diagnostic_report_current_module (context);
cp_print_error_function (context, diagnostic);
static void
cp_diagnostic_finalizer (diagnostic_context *context,
- diagnostic_info *diagnostic ATTRIBUTE_UNUSED)
+ diagnostic_info *diagnostic ATTRIBUTE_UNUSED)
{
pp_base_destroy_prefix (context->printer);
}
a diagnostic message. Called from cp_diagnostic_starter. */
static void
cp_print_error_function (diagnostic_context *context,
- diagnostic_info *diagnostic)
+ diagnostic_info *diagnostic)
{
if (diagnostic_last_function_changed (context))
{
pp_base_set_prefix (context->printer, new_prefix);
if (current_function_decl == NULL)
- pp_base_string (context->printer, "At global scope:");
+ pp_base_string (context->printer, "At global scope:");
else
- pp_printf (context->printer, "In %s %qs:",
- function_category (current_function_decl),
- cxx_printable_name (current_function_decl, 2));
+ pp_printf (context->printer, "In %s %qs:",
+ function_category (current_function_decl),
+ cxx_printable_name (current_function_decl, 2));
pp_base_newline (context->printer);
diagnostic_set_last_function (context);
if (DECL_FUNCTION_MEMBER_P (fn))
{
if (DECL_STATIC_FUNCTION_P (fn))
- return "static member function";
+ return "static member function";
else if (DECL_COPY_CONSTRUCTOR_P (fn))
- return "copy constructor";
+ return "copy constructor";
else if (DECL_CONSTRUCTOR_P (fn))
- return "constructor";
+ return "constructor";
else if (DECL_DESTRUCTOR_P (fn))
- return "destructor";
+ return "destructor";
else
- return "member function";
+ return "member function";
}
else
return "function";
{
tree p = current_instantiation ();
location_t location = input_location;
-
+
if (p)
{
if (current_function_decl != TINST_DECL (p)
else
{
if (current_function_decl == TINST_DECL (p))
- /* Avoid redundancy with the the "In function" line. */;
+ /* Avoid redundancy with the "In function" line. */;
else
pp_verbatim (context->printer,
- "%s: In instantiation of %qs:\n",
+ "%s: In instantiation of %qs:\n",
LOCATION_FILE (location),
- decl_as_string (TINST_DECL (p),
- TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
+ decl_as_string (TINST_DECL (p),
+ TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
location = TINST_LOCATION (p);
p = TREE_CHAIN (p);
/* Same as above but less verbose. */
static void
print_instantiation_partial_context (diagnostic_context *context,
- tree t, location_t loc)
+ tree t, location_t loc)
{
expanded_location xloc;
for (; ; t = TREE_CHAIN (t))
if (t == NULL_TREE)
break;
pp_verbatim (context->printer, "%s:%d: instantiated from %qs\n",
- xloc.file, xloc.line,
- decl_as_string (TINST_DECL (t),
- TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
+ xloc.file, xloc.line,
+ decl_as_string (TINST_DECL (t),
+ TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
loc = TINST_LOCATION (t);
}
pp_verbatim (context->printer, "%s:%d: instantiated from here\n",
- xloc.file, xloc.line);
+ xloc.file, xloc.line);
}
/* Called from cp_thing to print the template context for an error. */
switch (*text->format_spec)
{
case 'A': result = args_to_string (next_tree, verbose); break;
- case 'C': result = code_to_string (next_tcode); break;
+ case 'C': result = code_to_string (next_tcode); break;
case 'D': result = decl_to_string (next_tree, verbose); break;
- case 'E': result = expr_to_string (next_tree); break;
+ case 'E': result = expr_to_string (next_tree); break;
case 'F': result = fndecl_to_string (next_tree, verbose); break;
- case 'L': result = language_to_string (next_lang); break;
- case 'O': result = op_to_string (next_tcode); break;
- case 'P': result = parm_to_string (next_int); break;
- case 'Q': result = assop_to_string (next_tcode); break;
+ case 'L': result = language_to_string (next_lang); break;
+ case 'O': result = op_to_string (next_tcode); break;
+ case 'P': result = parm_to_string (next_int); break;
+ case 'Q': result = assop_to_string (next_tcode); break;
case 'T': result = type_to_string (next_tree, verbose); break;
case 'V': result = cv_to_string (next_tree, verbose); break;
-
+
default:
return false;
}
behavior of cp_*_at. */
static tree
-locate_error (const char *msgid, va_list ap)
+locate_error (const char *gmsgid, va_list ap)
{
tree here = 0, t;
int plus = 0;
const char *f;
- for (f = msgid; *f; f++)
+ for (f = gmsgid; *f; f++)
{
plus = 0;
if (*f == '%')
{
- if (*++f == 'q')
- ++f; /* ignore quoting flag. */
+ if (*++f == 'q')
+ ++f; /* ignore quoting flag. */
if (*f == '+')
- {
- ++f;
- plus = 1;
- }
+ {
+ ++f;
+ plus = 1;
+ }
if (*f == '#')
f++;
void
-cp_error_at (const char *msgid, ...)
+cp_error_at (const char *gmsgid, ...)
{
tree here;
diagnostic_info diagnostic;
va_list ap;
- va_start (ap, msgid);
- here = locate_error (msgid, ap);
+ va_start (ap, gmsgid);
+ here = locate_error (gmsgid, ap);
va_end (ap);
- va_start (ap, msgid);
- diagnostic_set_info (&diagnostic, msgid, &ap,
- input_location, DK_ERROR);
+ va_start (ap, gmsgid);
+ diagnostic_set_info (&diagnostic, gmsgid, &ap,
+ input_location, DK_ERROR);
cp_diagnostic_starter (global_dc, &diagnostic);
- diagnostic_set_info (&diagnostic, msgid, &ap,
- location_of (here), DK_ERROR);
+ diagnostic_set_info (&diagnostic, gmsgid, &ap,
+ location_of (here), DK_ERROR);
report_diagnostic (&diagnostic);
va_end (ap);
}
void
-cp_warning_at (const char *msgid, ...)
+cp_warning_at (const char *gmsgid, ...)
{
tree here;
diagnostic_info diagnostic;
va_list ap;
- va_start (ap, msgid);
- here = locate_error (msgid, ap);
+ va_start (ap, gmsgid);
+ here = locate_error (gmsgid, ap);
va_end (ap);
- va_start (ap, msgid);
- diagnostic_set_info (&diagnostic, msgid, &ap,
- location_of (here), DK_WARNING);
+ va_start (ap, gmsgid);
+ diagnostic_set_info (&diagnostic, gmsgid, &ap,
+ location_of (here), DK_WARNING);
report_diagnostic (&diagnostic);
va_end (ap);
}
void
-cp_pedwarn_at (const char *msgid, ...)
+cp_pedwarn_at (const char *gmsgid, ...)
{
tree here;
diagnostic_info diagnostic;
va_list ap;
- va_start (ap, msgid);
- here = locate_error (msgid, ap);
+ va_start (ap, gmsgid);
+ here = locate_error (gmsgid, ap);
va_end (ap);
- va_start (ap, msgid);
- diagnostic_set_info (&diagnostic, msgid, &ap,
- location_of (here), pedantic_error_kind());
+ va_start (ap, gmsgid);
+ diagnostic_set_info (&diagnostic, gmsgid, &ap,
+ location_of (here), pedantic_error_kind());
report_diagnostic (&diagnostic);
va_end (ap);
}