(cp_parser_pure_specifier): Likewise.
PR c++/26068
- * parser.c (cp_parser_set_storage_class): Check for
+ * parser.c (cp_parser_set_storage_class): Check for
invalid uses of storage classes on unbraced linkage
specifications.
(cp_parser_decl_specifier_seq): Pass keywords, not storage classes,
(cp_parser_explicit_specialization): Adjust call to
cp_parser_single_declaration.
(cp_parser_init_declarator): Perform template-parameter access
- checks.
+ checks.
(cp_parser_parameter_declaration): Do not defer checks for
template parameter default arguments.
(cp_parser_template_declaration_after_export): Gather access
type.
(build_modify_expr): Remove spurious conversions.
* class.c (layout_class_type): Modify the type of bitfields to
- indicate a limited range.
+ indicate a limited range.
* call.c (standard_conversion): Adjust the type of bitfield
expressions used in an rvalue context.
(build_conditional_expr): Likewise.
-
+
2006-04-22 Kazu Hirata <kazu@codesourcery.com>
* decl.c: Fix comment typos.
set, upon return, to the allocation function called. */
tree
-build_operator_new_call (tree fnname, tree args,
+build_operator_new_call (tree fnname, tree args,
tree *size, tree *cookie_size,
tree *fn)
{
|| (conv3 && conv3->kind == ck_ambig))
{
error ("operands to ?: have different types %qT and %qT",
- arg2_type, arg3_type);
+ arg2_type, arg3_type);
result = error_mark_node;
}
else if (conv2 && (!conv2->bad_p || !conv3))
if (!result_type)
{
- error ("operands to ?: have different types %qT and %qT",
- arg2_type, arg3_type);
+ error ("operands to ?: have different types %qT and %qT",
+ arg2_type, arg3_type);
return error_mark_node;
}
if (warn)
{
warning (OPT_Wsign_promo, "passing %qT chooses %qT over %qT",
- type, type1, type2);
+ type, type1, type2);
warning (OPT_Wsign_promo, " in call to %qD", w->fn);
}
else
400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
400, 400, 400, 400, 400, 400, 400, 400, 0, 0,
- 1, 400, 400, 400, 400, 400, 400, 400, 400, 400,
+ 1, 400, 400, 400, 400, 400, 400, 400, 400, 400,
400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
400, 400, 400, 400, 400, 400, 400, 28, 90, 0,
95, 0, 51, 93, 114, 26, 109, 124, 5, 1,
- 6, 13, 37, 128, 3, 0, 0, 49, 38, 0,
+ 6, 13, 37, 128, 3, 0, 0, 49, 38, 0,
104, 45, 0, 400, 400, 400, 400, 400, 400, 400,
400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
switch (hval)
{
default:
- hval += asso_values[(unsigned char)str[5]+1];
+ hval += asso_values[(unsigned char)str[5]+1];
/*FALLTHROUGH*/
case 5:
- hval += asso_values[(unsigned char)str[4]];
+ hval += asso_values[(unsigned char)str[4]];
/*FALLTHROUGH*/
case 4:
- hval += asso_values[(unsigned char)str[3]];
+ hval += asso_values[(unsigned char)str[3]];
/*FALLTHROUGH*/
case 3:
- hval += asso_values[(unsigned char)str[2]];
+ hval += asso_values[(unsigned char)str[2]];
/*FALLTHROUGH*/
case 2:
- hval += asso_values[(unsigned char)str[1]];
+ hval += asso_values[(unsigned char)str[1]];
/*FALLTHROUGH*/
case 1:
- hval += asso_values[(unsigned char)str[0]];
- break;
+ hval += asso_values[(unsigned char)str[0]];
+ break;
}
return hval + asso_values[(unsigned char)str[len - 1]];
}
register int key = hash (str, len);
if (key <= MAX_HASH_VALUE && key >= 0)
- {
- register int index = lookup[key];
+ {
+ register int index = lookup[key];
- if (index >= 0)
- {
- register const char *s = wordlist[index];
+ if (index >= 0)
+ {
+ register const char *s = wordlist[index];
- if (*str == *s && !strcmp (str + 1, s + 1))
- return s;
- }
- }
+ if (*str == *s && !strcmp (str + 1, s + 1))
+ return s;
+ }
+ }
}
return 0;
}
}
}
- /* A class should never have more than one destructor. */
+ /* A class should never have more than one destructor. */
if (current_fns && DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (method))
return false;
dtor is handled in finish_struct_1. */
if (!TYPE_POLYMORPHIC_P (basetype))
warning (OPT_Weffc__,
- "base class %q#T has a non-virtual destructor", basetype);
+ "base class %q#T has a non-virtual destructor", basetype);
/* If the base class doesn't have copy constructors or
assignment operators that take const references, then the
if (!has_nonprivate_method)
{
warning (OPT_Wctor_dtor_privacy,
- "all member functions in class %qT are private", t);
+ "all member functions in class %qT are private", t);
return;
}
}
if (fn && TREE_PRIVATE (fn))
{
warning (OPT_Wctor_dtor_privacy,
- "%q#T only defines a private destructor and has no friends",
+ "%q#T only defines a private destructor and has no friends",
t);
return;
}
if (nonprivate_ctor == 0)
{
warning (OPT_Wctor_dtor_privacy,
- "%q#T only defines private constructors and has no friends",
+ "%q#T only defines private constructors and has no friends",
t);
return;
}
/* Extract the declared width of the bitfield, which has been
temporarily stashed in DECL_INITIAL. */
w = DECL_INITIAL (field);
- gcc_assert (w != NULL_TREE);
+ gcc_assert (w != NULL_TREE);
/* Remove the bit-field width indicator so that the rest of the
compiler does not treat that value as an initializer. */
DECL_INITIAL (field) = NULL_TREE;
if (! TYPE_HAS_INIT_REF (t))
{
warning (OPT_Weffc__,
- " but does not override %<%T(const %T&)%>", t, t);
+ " but does not override %<%T(const %T&)%>", t, t);
if (!TYPE_HAS_ASSIGN_REF (t))
warning (OPT_Weffc__, " or %<operator=(const %T&)%>", t);
}
else if (! TYPE_HAS_ASSIGN_REF (t))
warning (OPT_Weffc__,
- " but does not override %<operator=(const %T&)%>", t);
+ " but does not override %<operator=(const %T&)%>", t);
}
if (type == error_mark_node)
return 0;
-
+
if (!TYPE_P (type))
{
if (abi_version_at_least (2))
other empty classes might later be placed) or at the end of the
class (where other objects might then be placed, so other empty
subobjects might later overlap). */
- if (is_data_member
+ if (is_data_member
|| !is_empty_class (BINFO_TYPE (type)))
max_offset = sizeof_biggest_empty_class;
else
(binfo, size_diffop (size_zero_node, BINFO_OFFSET (binfo)));
else
warning (OPT_Wabi,
- "offset of empty base %qT may not be ABI-compliant and may"
+ "offset of empty base %qT may not be ABI-compliant and may"
"change in a future version of GCC",
BINFO_TYPE (binfo));
}
CLASSTYPE_NEARLY_EMPTY_P (t) = 0;
else
warning (OPT_Wabi,
- "class %qT will be considered nearly empty in a "
+ "class %qT will be considered nearly empty in a "
"future version of GCC", t);
}
}
bitsize_unit_node),
BINFO_OFFSET (vbase))))
warning (OPT_Wabi,
- "offset of virtual base %qT is not ABI-compliant and "
+ "offset of virtual base %qT is not ABI-compliant and "
"may change in a future version of GCC",
basetype);
/* Versions of G++ before G++ 3.4 did not reset the
DECL_MODE. */
warning (OPT_Wabi,
- "the offset of %qD may not be ABI-compliant and may "
+ "the offset of %qD may not be ABI-compliant and may "
"change in a future version of GCC", field);
}
else
/* The middle end uses the type of expressions to determine the
possible range of expression values. In order to optimize
"x.i > 7" to "false" for a 2-bit bitfield "i", the middle end
- must be made aware of the width of "i", via its type.
+ must be made aware of the width of "i", via its type.
- Because C++ does not have integer types of arbitrary width,
+ Because C++ does not have integer types of arbitrary width,
we must (for the purposes of the front end) convert from the
type assigned here to the declared type of the bitfield
whenever a bitfield expression is used as an rvalue.
ftype = TREE_TYPE (field);
width = tree_low_cst (DECL_SIZE (field), /*unsignedp=*/1);
if (width != TYPE_PRECISION (ftype))
- TREE_TYPE (field)
- = c_build_bitfield_integer_type (width,
+ TREE_TYPE (field)
+ = c_build_bitfield_integer_type (width,
TYPE_UNSIGNED (ftype));
}
TYPE_SIZE_UNIT (base_t) = size_zero_node;
if (warn_abi && !integer_zerop (rli_size_unit_so_far (rli)))
warning (OPT_Wabi,
- "layout of classes derived from empty class %qT "
+ "layout of classes derived from empty class %qT "
"may change in a future version of GCC",
t);
}
splay_tree_delete (empty_base_offsets);
if (CLASSTYPE_EMPTY_P (t)
- && tree_int_cst_lt (sizeof_biggest_empty_class,
+ && tree_int_cst_lt (sizeof_biggest_empty_class,
TYPE_SIZE_UNIT (t)))
sizeof_biggest_empty_class = TYPE_SIZE_UNIT (t);
}
current_class_stack_size *= 2;
current_class_stack
= XRESIZEVEC (struct class_stack_node, current_class_stack,
- current_class_stack_size);
+ current_class_stack_size);
}
/* Insert a new entry on the class stack. */
build_ptrmemfunc_type (build_pointer_type (instantiation_type));
else if (!is_reference)
instantiation_type = build_pointer_type (instantiation_type);
- if (can_convert_arg (target_type, instantiation_type, instantiation,
+ if (can_convert_arg (target_type, instantiation_type, instantiation,
LOOKUP_NORMAL))
matches = tree_cons (instantiation, fn, matches);
}
tree match = most_specialized_instantiation (matches);
if (match != error_mark_node)
- matches = tree_cons (TREE_PURPOSE (match),
- NULL_TREE,
+ matches = tree_cons (TREE_PURPOSE (match),
+ NULL_TREE,
NULL_TREE);
}
}
type = BINFO_TYPE (binfo);
buf = (char *) alloca (sizeof (VFIELD_NAME_FORMAT)
- + TYPE_NAME_LENGTH (type) + 2);
+ + TYPE_NAME_LENGTH (type) + 2);
sprintf (buf, VFIELD_NAME_FORMAT,
IDENTIFIER_POINTER (constructor_name (type)));
return get_identifier (buf);
/* Hook into the middle of gimplifying an OMP_FOR node. This is required
in order to properly gimplify CONTINUE statements. Here we merely
manage the continue stack; the rest of the job is performed by the
- regular gimplifier. */
+ regular gimplifier. */
static enum gimplify_status
cp_gimplify_omp_for (tree *expr_p)
if (is_invisiref_parm (stmt)
/* Don't dereference parms in a thunk, pass the references through. */
&& !(DECL_THUNK_P (current_function_decl)
- && TREE_CODE (stmt) == PARM_DECL))
+ && TREE_CODE (stmt) == PARM_DECL))
{
*stmt_p = convert_from_reference (stmt);
*walk_subtrees = 0;
tree_contains_struct[NAMESPACE_DECL][TS_DECL_WRTL] = 1;
tree_contains_struct[USING_DECL][TS_DECL_WRTL] = 1;
tree_contains_struct[TEMPLATE_DECL][TS_DECL_WRTL] = 1;
-
+
tree_contains_struct[NAMESPACE_DECL][TS_DECL_COMMON] = 1;
tree_contains_struct[USING_DECL][TS_DECL_COMMON] = 1;
tree_contains_struct[TEMPLATE_DECL][TS_DECL_COMMON] = 1;
-
+
tree_contains_struct[NAMESPACE_DECL][TS_DECL_MINIMAL] = 1;
tree_contains_struct[USING_DECL][TS_DECL_MINIMAL] = 1;
tree_contains_struct[TEMPLATE_DECL][TS_DECL_MINIMAL] = 1;
return DECL_EXTERN_C_P (decl);
}
-static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map)))
+static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map)))
htab_t shadowed_var_for_decl;
/* Lookup a shadowed var for FROM, and return it if we find one. */
-tree
+tree
decl_shadowed_for_var_lookup (tree from)
{
struct tree_map *h, in;
in.from = from;
- h = (struct tree_map *) htab_find_with_hash (shadowed_var_for_decl, &in,
- htab_hash_pointer (from));
+ h = (struct tree_map *) htab_find_with_hash (shadowed_var_for_decl, &in,
+ htab_hash_pointer (from));
if (h)
return h->to;
return NULL_TREE;
#define NON_THUNK_FUNCTION_CHECK(NODE) __extension__ \
({ const tree __t = (NODE); \
if (TREE_CODE (__t) != FUNCTION_DECL && \
- TREE_CODE (__t) != TEMPLATE_DECL && __t->decl_common.lang_specific \
+ TREE_CODE (__t) != TEMPLATE_DECL && __t->decl_common.lang_specific \
&& __t->decl_common.lang_specific->decl_flags.thunk_p) \
tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \
__t; })
({ const tree __t = (NODE); \
if (TREE_CODE (__t) != FUNCTION_DECL || !__t->decl_common.lang_specific \
|| !__t->decl_common.lang_specific->decl_flags.thunk_p) \
- tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \
+ tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \
__t; })
#else
#define NON_THUNK_FUNCTION_CHECK(NODE) (NODE)
case, DECL_TEMPLATE_INFO is a TREE_LIST, whose TREE_PURPOSE is the
TEMPLATE_DECL of which this entity is a specialization. The TREE_
TREE_VALUE is the template arguments used to specialize the
- template.
+ template.
In general, DECL_TEMPLATE_INFO is non-NULL only if
DECL_USE_TEMPLATE is nonzero. However, for friends, we sometimes
In this case, S<int>::f is, from the point of view of the compiler,
an instantiation of a template -- but, from the point of view of
the language, each instantiation of S results in a wholly unrelated
- global function f. */
+ global function f. */
#define DECL_TEMPLATE_INFO(NODE) \
(DECL_LANG_SPECIFIC (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK (NODE)) \
->decl_flags.u.template_info)
[basic.types]
An object type is a (possibly cv-qualified) type that is not a
- function type, not a reference type, and not a void type.
+ function type, not a reference type, and not a void type.
Keep these checks in ascending order, for speed. */
#define TYPE_OBJ_P(NODE) \
#define OMP_FOR_GIMPLIFYING_P(NODE) \
(TREE_LANG_FLAG_0 (OMP_FOR_CHECK (NODE)))
-/* A language-specific token attached to the OpenMP data clauses to
+/* A language-specific token attached to the OpenMP data clauses to
hold code (or code fragments) related to ctors, dtors, and op=.
See semantics.c for details. */
#define CP_OMP_CLAUSE_INFO(NODE) \
TREE_TYPE (OMP_CLAUSE_RANGE_CHECK (NODE, OMP_CLAUSE_PRIVATE, \
- OMP_CLAUSE_COPYPRIVATE))
+ OMP_CLAUSE_COPYPRIVATE))
/* These macros provide convenient access to the various _STMT nodes
created when parsing template declarations. */
extern void set_linkage_according_to_type (tree, tree);
extern void determine_key_method (tree);
extern void check_for_override (tree, tree);
-extern void push_class_stack (void);
-extern void pop_class_stack (void);
+extern void push_class_stack (void);
+extern void pop_class_stack (void);
/* in cvt.c */
extern tree convert_to_reference (tree, tree, int, int, tree);
extern tree build_ptrmemfunc_type (tree);
extern tree build_ptrmem_type (tree, tree);
/* the grokdeclarator prototype is in decl.h */
-extern tree build_this_parm (tree, cp_cv_quals);
+extern tree build_this_parm (tree, cp_cv_quals);
extern int copy_fn_p (tree);
extern tree get_scope_of_declarator (const cp_declarator *);
extern void grok_special_member_properties (tree);
/* in decl2.c */
extern bool check_java_method (tree);
-extern tree build_memfn_type (tree, tree, cp_cv_quals);
+extern tree build_memfn_type (tree, tree, cp_cv_quals);
extern void maybe_retrofit_in_chrg (tree);
extern void maybe_make_one_only (tree);
extern void grokclassfn (tree, tree,
extern void mark_needed (tree);
extern bool decl_needed_p (tree);
extern void note_vague_linkage_fn (tree);
-extern tree build_artificial_parm (tree, tree);
+extern tree build_artificial_parm (tree, tree);
/* in error.c */
extern void init_error (void);
extern void pop_deferring_access_checks (void);
extern tree get_deferred_access_checks (void);
extern void pop_to_parent_deferring_access_checks (void);
-extern void perform_access_checks (tree);
+extern void perform_access_checks (tree);
extern void perform_deferred_access_checks (void);
extern void perform_or_defer_access_check (tree, tree);
extern int stmts_are_full_exprs_p (void);
extern tree finish_base_specifier (tree, tree, bool);
extern void finish_member_declaration (tree);
extern void qualified_name_lookup_error (tree, tree, tree);
-extern void check_template_keyword (tree);
+extern void check_template_keyword (tree);
extern tree finish_id_expression (tree, tree, tree,
cp_id_kind *,
bool, bool, bool *,
extern tree build_cplus_array_type (tree, tree);
extern tree hash_tree_cons (tree, tree, tree);
extern tree hash_tree_chain (tree, tree);
-extern tree build_qualified_name (tree, tree, tree, bool);
+extern tree build_qualified_name (tree, tree, tree, bool);
extern int is_overloaded_fn (tree);
extern tree get_first_fn (tree);
extern tree ovl_cons (tree, tree);
extern tree cp_add_pending_fn_decls (void*,tree);
extern int cp_auto_var_in_fn_p (tree,tree);
extern tree fold_if_not_in_template (tree);
-extern tree rvalue (tree);
+extern tree rvalue (tree);
extern tree convert_bitfield_to_declared_type (tree);
-extern tree cp_save_expr (tree);
-
+extern tree cp_save_expr (tree);
+
/* in typeck.c */
extern int string_conv_p (tree, tree, int);
extern tree cp_truthvalue_conversion (tree);
extern tree cxx_sizeof_or_alignof_type (tree, enum tree_code, bool);
#define cxx_sizeof_nowarn(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, false)
extern tree inline_conversion (tree);
-extern tree is_bitfield_expr_with_lowered_type (tree);
+extern tree is_bitfield_expr_with_lowered_type (tree);
extern tree decay_conversion (tree);
extern tree build_class_member_access_expr (tree, tree, tree, bool);
extern tree finish_class_member_access_expr (tree, tree, bool);
extern tree convert_for_initialization (tree, tree, tree, int,
const char *, tree, int);
extern int comp_ptr_ttypes (tree, tree);
-extern bool comp_ptr_ttypes_const (tree, tree);
+extern bool comp_ptr_ttypes_const (tree, tree);
extern int ptr_reasonably_similar (tree, tree);
extern tree build_ptrmemfunc (tree, tree, int, bool);
extern int cp_type_quals (tree);
{
case STRING_CST:
{
- const bool in_parens = PAREN_STRING_LITERAL_P (t);
- if (in_parens)
- pp_cxx_left_paren (pp);
- pp_c_constant (pp_c_base (pp), t);
- if (in_parens)
- pp_cxx_right_paren (pp);
+ const bool in_parens = PAREN_STRING_LITERAL_P (t);
+ if (in_parens)
+ pp_cxx_left_paren (pp);
+ pp_c_constant (pp_c_base (pp), t);
+ if (in_parens)
+ pp_cxx_right_paren (pp);
}
break;
pp_equal (pp);
pp_cxx_whitespace (pp);
if (DECL_CONTEXT (DECL_NAMESPACE_ALIAS (t)))
- pp_cxx_nested_name_specifier (pp,
+ pp_cxx_nested_name_specifier (pp,
DECL_CONTEXT (DECL_NAMESPACE_ALIAS (t)));
pp_cxx_qualified_id (pp, DECL_NAMESPACE_ALIAS (t));
pp_cxx_semicolon (pp);
typename identifier(opt)
typename identifier(opt) = type-id
template < template-parameter-list > class identifier(opt)
- template < template-parameter-list > class identifier(opt) = template-name
-*/
+ template < template-parameter-list > class identifier(opt) = template-name */
static void
pp_cxx_template_parameter (cxx_pretty_printer *pp, tree t)
Used by RTTI
tree type_info_type_node, tinfo_decl_id, tinfo_decl_type;
- tree tinfo_var_id;
-
-*/
+ tree tinfo_var_id; */
tree cp_global_trees[CPTI_MAX];
This is initially set to the binding level in which the label
is defined, but is modified as scopes are closed. */
struct cp_binding_level *binding_level;
- /* The head of the names list that was current when the label was
+ /* The head of the names list that was current when the label was
defined, or the inner scope popped. These are the decls that will
be skipped when jumping to the label. */
tree names_in_scope;
if ((pedantic || ! DECL_IN_SYSTEM_HEADER (old_decl))
&& ! DECL_IS_BUILTIN (old_decl)
&& flag_exceptions
- && !comp_except_specs (new_exceptions, old_exceptions,
+ && !comp_except_specs (new_exceptions, old_exceptions,
/*exact=*/true))
{
error ("declaration of %qF throws different exceptions", new_decl);
{
DECL_THIS_EXTERN (newdecl) |= DECL_THIS_EXTERN (olddecl);
DECL_INITIALIZED_P (newdecl) |= DECL_INITIALIZED_P (olddecl);
- DECL_NONTRIVIALLY_INITIALIZED_P (newdecl)
+ DECL_NONTRIVIALLY_INITIALIZED_P (newdecl)
|= DECL_NONTRIVIALLY_INITIALIZED_P (olddecl);
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (newdecl)
|= DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (olddecl);
DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl);
DECL_VISIBILITY_SPECIFIED (newdecl) = 1;
}
- /* Init priority used to be merged from newdecl to olddecl by the memcpy,
+ /* Init priority used to be merged from newdecl to olddecl by the memcpy,
so keep this behavior. */
if (TREE_CODE (newdecl) == VAR_DECL && DECL_HAS_INIT_PRIORITY_P (newdecl))
{
memcpy ((char *) olddecl + sizeof (struct tree_common),
(char *) newdecl + sizeof (struct tree_common),
sizeof (struct tree_decl_common) - sizeof (struct tree_common));
- switch (TREE_CODE (olddecl))
+ switch (TREE_CODE (olddecl))
{
case LABEL_DECL:
case VAR_DECL:
/* Check that a single previously seen jump to a newly defined label
is OK. DECL is the LABEL_DECL or 0; LEVEL is the binding_level for
the jump context; NAMES are the names in scope in LEVEL at the jump
- context; LOCUS is the source position of the jump or 0. Returns
+ context; LOCUS is the source position of the jump or 0. Returns
true if all is well. */
static bool
while (b->level_chain->kind != sk_function_parms)
b = b->level_chain;
pushdecl_with_scope (decl, b, /*is_friend=*/false);
- cp_finish_decl (decl, init, /*init_const_expr_p=*/false, NULL_TREE,
+ cp_finish_decl (decl, init, /*init_const_expr_p=*/false, NULL_TREE,
LOOKUP_ONLYCONVERTING);
}
else
{
error ("invalid type %qT as initializer for a vector of type %qT",
TREE_TYPE (d->cur->value), type);
- value = error_mark_node;
+ value = error_mark_node;
}
++d->cur;
return value;
{
if (pedantic)
pedwarn ("ISO C++ does not allow designated initializers");
-
+
field = lookup_field_1 (type, d->cur->index, /*want_type=*/false);
if (!field || TREE_CODE (field) != FIELD_DECL)
error ("braces around scalar initializer for type %qT", type);
init = error_mark_node;
}
-
+
d->cur++;
return init;
}
tree str_init = init;
/* Strip one level of braces if and only if they enclose a single
- element (as allowed by [dcl.init.string]). */
+ element (as allowed by [dcl.init.string]). */
if (!first_initializer_p
&& TREE_CODE (str_init) == CONSTRUCTOR
&& VEC_length (constructor_elt, CONSTRUCTOR_ELTS (str_init)) == 1)
str_init = VEC_index (constructor_elt,
CONSTRUCTOR_ELTS (str_init), 0)->value;
}
-
+
/* If it's a string literal, then it's the initializer for the array
- as a whole. Otherwise, continue with normal initialization for
+ as a whole. Otherwise, continue with normal initialization for
array types (one value per array element). */
if (TREE_CODE (str_init) == STRING_CST)
{
else if (init)
{
/* Do not reshape constructors of vectors (they don't need to be
- reshaped. */
+ reshaped. */
if (TREE_CODE (init) == CONSTRUCTOR
&& !COMPOUND_LITERAL_P (init)
&& !TREE_TYPE (init)) /* ptrmemfunc */
if the (init) syntax was used. */
void
-cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
+cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
tree asmspec_tree, int flags)
{
tree type;
occurs. Therefore, in:
struct S { static const int i = 7 / 0; };
-
+
we issue an error at this point. It would
probably be better to forbid division by zero in
integral constant expressions. */
/* Build a PARM_DECL for the "this" parameter. TYPE is the
METHOD_TYPE for a non-static member function; QUALS are the
cv-qualifiers that apply to the function. */
-
+
tree
build_this_parm (tree type, cp_cv_quals quals)
{
parm = build_artificial_parm (this_identifier, qual_type);
cp_apply_type_quals_to_decl (this_quals, parm);
return parm;
-}
+}
/* CTYPE is class type, or null if non-class.
TYPE is type this FUNCTION_DECL should have, either FUNCTION_TYPE
tree newtype;
error ("%<::main%> must return %<int%>");
newtype = build_function_type (integer_type_node,
- oldtypeargs);
+ oldtypeargs);
TREE_TYPE (decl) = newtype;
}
inlinep = 0;
}
/* [dcl.fct.edf]
-
+
The declarator in a function-definition shall have the form
D1 ( parameter-declaration-clause) ... */
if (funcdef_flag && innermost_code != cdk_function)
is the same as the class name, and we are defining
a function, then it is a constructor/destructor, and
therefore returns a void type. */
-
+
/* ISO C++ 12.4/2. A destructor may not be declared
const or volatile. A destructor may not be
static.
-
+
ISO C++ 12.1. A constructor may not be declared
const or volatile. A constructor may not be
virtual. A constructor may not be static. */
- if (staticp == 2)
+ if (staticp == 2)
error ((flags == DTOR_FLAG)
? "destructor cannot be static member function"
: "constructor cannot be static member function");
&& (TREE_CODE (type) == FUNCTION_TYPE || memfn_quals))
{
memfn_quals |= cp_type_quals (type);
- type = build_memfn_type (type,
+ type = build_memfn_type (type,
declarator->u.pointer.class_type,
memfn_quals);
memfn_quals = TYPE_UNQUALIFIED;
!COMPLETE_TYPE_P (ctype)
&& (/* If the function is being defined, then
qualifying type must certainly be complete. */
- funcdef_flag
+ funcdef_flag
/* A friend declaration of "T::f" is OK, even if
"T" is a template parameter. But, if this
function is not a friend, the qualifying type
in typenames, fields or parameters. */
if (current_lang_name == lang_name_java)
TYPE_FOR_JAVA (type) = 1;
-
+
/* This declaration:
- typedef void f(int) const;
+ typedef void f(int) const;
- declares a function type which is not a member of any
+ declares a function type which is not a member of any
particular class, but which is cv-qualified; for
- example "f S::*" declares a pointer to a const-qualified
+ example "f S::*" declares a pointer to a const-qualified
member function of S. We record the cv-qualification in the
function type. */
if (memfn_quals && TREE_CODE (type) == FUNCTION_TYPE)
|| (typedef_decl && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl)))
C_TYPEDEF_EXPLICITLY_SIGNED (decl) = 1;
- bad_specifiers (decl, "type", virtualp,
+ bad_specifiers (decl, "type", virtualp,
memfn_quals != TYPE_UNQUALIFIED,
inlinep, friendp, raises != NULL_TREE);
{
decl = cp_build_parm_decl (unqualified_id, type);
- bad_specifiers (decl, "parameter", virtualp,
+ bad_specifiers (decl, "parameter", virtualp,
memfn_quals != TYPE_UNQUALIFIED,
inlinep, friendp, raises != NULL_TREE);
}
}
decl = do_friend (ctype, unqualified_id, decl,
- *attrlist, flags,
+ *attrlist, flags,
funcdef_flag);
return decl;
}
}
}
- bad_specifiers (decl, "field", virtualp,
+ bad_specifiers (decl, "field", virtualp,
memfn_quals != TYPE_UNQUALIFIED,
inlinep, friendp, raises != NULL_TREE);
}
initialized,
(type_quals & TYPE_QUAL_CONST) != 0,
ctype ? ctype : in_namespace);
- bad_specifiers (decl, "variable", virtualp,
+ bad_specifiers (decl, "variable", virtualp,
memfn_quals != TYPE_UNQUALIFIED,
inlinep, friendp, raises != NULL_TREE);
if (!COMPLETE_OR_VOID_TYPE_P (return_type))
{
tree args = TYPE_ARG_TYPES (fntype);
-
+
error ("return type %q#T is incomplete", return_type);
/* Make it return void instead. */
ignore interface specifications for
compiler-generated functions. */
&& !DECL_ARTIFICIAL (decl1));
-
+
if (DECL_INTERFACE_KNOWN (decl1))
{
tree ctx = decl_function_context (decl1);
tables. */
initialize_vtbl_ptrs (current_class_ptr);
finish_compound_stmt (compound_stmt);
-
+
/* And insert cleanups for our bases and members so that they
will be properly destroyed if we throw. */
push_base_cleanups ();
an implicit definition), non-placement operator delete shall
be looked up in the scope of the destructor's class and if
found shall be accessible and unambiguous. */
- exprstmt = build_op_delete_call(DELETE_EXPR, current_class_ptr,
+ exprstmt = build_op_delete_call(DELETE_EXPR, current_class_ptr,
virtual_size,
- /*global_p=*/false,
- /*placement=*/NULL_TREE,
+ /*global_p=*/false,
+ /*placement=*/NULL_TREE,
/*alloc_fn=*/NULL_TREE);
if_stmt = begin_if_stmt ();
{
if (compstmt == NULL_TREE)
return;
-
+
/* Close the block. */
finish_compound_stmt (compstmt);
The other parameters are as for cp_finish_decl. */
void
-finish_static_data_member_decl (tree decl,
+finish_static_data_member_decl (tree decl,
tree init, bool init_const_expr_p,
tree asmspec_tree,
int flags)
/* DECLARATOR and DECLSPECS correspond to a class member. The other
parameters are as for cp_finish_decl. Return the DECL for the
- class member declared. */
+ class member declared. */
tree
grokfield (const cp_declarator *declarator,
error ("%<asm%> specifiers are not permitted on non-static data members");
if (DECL_INITIAL (value) == error_mark_node)
init = error_mark_node;
- cp_finish_decl (value, init, /*init_const_expr_p=*/false,
+ cp_finish_decl (value, init, /*init_const_expr_p=*/false,
NULL_TREE, flags);
DECL_INITIAL (value) = init;
DECL_IN_AGGR_P (value) = 1;
if (asmspec)
set_user_assembler_name (value, asmspec);
- cp_finish_decl (value,
- /*init=*/NULL_TREE,
- /*init_const_expr_p=*/false,
+ cp_finish_decl (value,
+ /*init=*/NULL_TREE,
+ /*init_const_expr_p=*/false,
asmspec_tree, flags);
/* Pass friends back this way. */
&& DECL_VISIBILITY_SPECIFIED (decl)
&& (!class_type || !CLASSTYPE_VISIBILITY_SPECIFIED (class_type)))
targetm.cxx.determine_class_data_visibility (decl);
- }
+ }
}
static void
if (initp)
{
if (init)
- finish_expr_stmt (init);
+ finish_expr_stmt (init);
/* If we're using __cxa_atexit, register a function that calls the
- destructor for the object. */
+ destructor for the object. */
if (flag_use_cxa_atexit)
- finish_expr_stmt (register_dtor_fn (decl));
+ finish_expr_stmt (register_dtor_fn (decl));
}
else
finish_expr_stmt (build_cleanup (decl));
node = TREE_CHAIN (node))
/* Do one initialization or destruction. */
one_static_initialization_or_destruction (TREE_VALUE (node),
- TREE_PURPOSE (node), initp);
+ TREE_PURPOSE (node), initp);
/* Finish up the priority if-stmt body. */
finish_then_clause (priority_if_stmt);
DECL_EXTERNAL appropriately, so there's no need to check
again, and we do not want to clear DECL_EXTERNAL if a
previous call to import_export_decl set it.
-
+
This is done in a separate for cycle, because if some
deferred function is contained in another deferred
function later in deferred_fns varray,
else
{
/* If we have a ctor or this is obj-c++ and we need a static init,
- call generate_ctor_or_dtor_function. */
+ call generate_ctor_or_dtor_function. */
if (static_ctors || (c_dialect_objc () && objc_static_init_needed_p ()))
generate_ctor_or_dtor_function (/*constructor_p=*/true,
DEFAULT_INIT_PRIORITY, &locus);
if (VEC_length (tree, pending_statics) != 0)
{
check_global_declarations (VEC_address (tree, pending_statics),
- VEC_length (tree, pending_statics));
+ VEC_length (tree, pending_statics));
emit_debug_global_declarations (VEC_address (tree, pending_statics),
VEC_length (tree, pending_statics));
}
}
TREE_USED (decl) = 1;
- /* If we don't need a value, then we don't need to synthesize DECL. */
+ /* If we don't need a value, then we don't need to synthesize DECL. */
if (skip_evaluation)
return;
/* Normally, we can wait until instantiation-time to synthesize
saved_processing_template_decl = processing_template_decl;
processing_template_decl = 0;
}
-
+
if (processing_template_decl)
- return;
+ return;
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (decl)
&& !TREE_ASM_WRITTEN (decl))
template, we now know that we will need to actually do the
instantiation. We check that DECL is not an explicit
instantiation because that is not checked in instantiate_decl.
-
+
We put off instantiating functions in order to improve compile
times. Maintaining a stack of active functions is expensive,
and the inliner knows to instantiate any functions it might
need. Therefore, we always try to defer instantiation. */
- instantiate_decl (decl, /*defer_ok=*/true,
+ instantiate_decl (decl, /*defer_ok=*/true,
/*expl_inst_class_mem_p=*/false);
processing_template_decl = saved_processing_template_decl;
if (TREE_CODE (fn) == ADDR_EXPR)
fn = TREE_OPERAND (fn, 0);
- /* Nobody is interested in seeing the guts of vcalls. */
- if (TREE_CODE (fn) == OBJ_TYPE_REF)
- fn = resolve_virtual_fun_from_obj_type_ref (fn);
+ /* Nobody is interested in seeing the guts of vcalls. */
+ if (TREE_CODE (fn) == OBJ_TYPE_REF)
+ fn = resolve_virtual_fun_from_obj_type_ref (fn);
if (TREE_TYPE (fn) != NULL_TREE && NEXT_CODE (fn) == METHOD_TYPE)
{
/* If the C++ object needs constructing, we need to do that before
calling __cxa_begin_catch, so that std::uncaught_exception gets
the right value during the copy constructor. */
- else if (flag_use_cxa_get_exception_ptr
+ else if (flag_use_cxa_get_exception_ptr
&& TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl)))
{
exp = do_get_exception_ptr ();
tree init = do_begin_catch ();
exp = create_temporary_var (ptr_type_node);
DECL_REGISTER (exp) = 1;
- cp_finish_decl (exp, init, /*init_const_expr=*/false,
+ cp_finish_decl (exp, init, /*init_const_expr=*/false,
NULL_TREE, LOOKUP_ONLYCONVERTING);
initialize_handler_parm (decl, exp);
}
fn = push_throw_library_fn (fn, tmp);
}
- /* [except.throw]
-
- A throw-expression initializes a temporary object, the type
+ /* [except.throw]
+
+ A throw-expression initializes a temporary object, the type
of which is determined by removing any top-level
cv-qualifiers from the static type of the operand of throw
and adjusting the type from "array of T" or "function return
if (CLASS_TYPE_P (temp_type))
{
/* Call the copy constructor. */
- exp = (build_special_member_call
+ exp = (build_special_member_call
(object, complete_ctor_identifier,
build_tree_list (NULL_TREE, exp),
TREE_TYPE (object),
}
}
else
- exp = build2 (INIT_EXPR, temp_type, object,
+ exp = build2 (INIT_EXPR, temp_type, object,
decay_conversion (exp));
/* Pre-evaluate the thrown expression first, since if we allocated
return member;
if (dependent_type_p (type) || type_dependent_expression_p (member))
- return build_qualified_name (NULL_TREE, type, member,
+ return build_qualified_name (NULL_TREE, type, member,
/*template_p=*/false);
gcc_assert (TYPE_P (type));
}
/* Entities other than non-static members need no further
- processing. */
+ processing. */
if (TREE_CODE (member) == TYPE_DECL)
return member;
if (TREE_CODE (member) == VAR_DECL || TREE_CODE (member) == CONST_DECL)
constant_value_1 (tree decl, bool integral_p)
{
while (TREE_CODE (decl) == CONST_DECL
- || (integral_p
+ || (integral_p
? DECL_INTEGRAL_CONSTANT_VAR_P (decl)
: (TREE_CODE (decl) == VAR_DECL
&& CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (decl)))))
instantiation time. */
if (DECL_CLASS_SCOPE_P (decl)
&& CLASSTYPE_TEMPLATE_INFO (DECL_CONTEXT (decl))
- && uses_template_parms (CLASSTYPE_TI_ARGS
+ && uses_template_parms (CLASSTYPE_TI_ARGS
(DECL_CONTEXT (decl))))
{
++processing_template_decl;
tree
decl_constant_value (tree decl)
{
- return constant_value_1 (decl,
+ return constant_value_1 (decl,
/*integral_p=*/processing_template_decl);
}
\f
int use_global_new)
{
tree new_expr;
-
- new_expr = build4 (NEW_EXPR, build_pointer_type (type), placement, type,
- nelts, init);
+
+ new_expr = build4 (NEW_EXPR, build_pointer_type (type), placement, type,
+ nelts, init);
NEW_EXPR_USE_GLOBAL (new_expr) = use_global_new;
TREE_SIDE_EFFECTS (new_expr) = 1;
static tree
build_new_1 (tree placement, tree type, tree nelts, tree init,
bool globally_qualified_p)
-
{
tree size, rval;
/* True iff this is a call to "operator new[]" instead of just
= build_vec_init (init_expr,
cp_build_binary_op (MINUS_EXPR, outer_nelts,
integer_one_node),
- init,
- explicit_default_init_p,
+ init,
+ explicit_default_init_p,
/*from_array=*/0);
/* An array initialization is stable because the initialization
{
/* We are processing something like `new int (10)', which
means allocate an int, and initialize it with 10. */
-
+
if (TREE_CODE (init) == TREE_LIST)
- init = build_x_compound_expr_from_list (init,
+ init = build_x_compound_expr_from_list (init,
"new initializer");
else
gcc_assert (TREE_CODE (init) != CONSTRUCTOR
|| TREE_TYPE (init) != NULL_TREE);
-
+
init_expr = build_modify_expr (init_expr, INIT_EXPR, init);
stable = stabilize_init (init_expr, &init_preeval_expr);
}
array with no elements. The pointer returned by the
new-expression is non-null. [Note: If the library allocation
function is called, the pointer returned is distinct from the
- pointer to any other object.]
+ pointer to any other object.]
However, that is not generally useful, so we issue a
warning. */
deallocate_expr = build_op_delete_call (VEC_DELETE_EXPR,
base_tbd, virtual_size,
use_global_delete & 1,
- /*placement=*/NULL_TREE,
+ /*placement=*/NULL_TREE,
/*alloc_fn=*/NULL_TREE);
}
but use assignment instead of initialization. */
tree
-build_vec_init (tree base, tree maxindex, tree init,
+build_vec_init (tree base, tree maxindex, tree init,
bool explicit_default_init_p,
int from_array)
{
sorry
("cannot initialize multi-dimensional array with initializer");
elt_init = build_vec_init (build1 (INDIRECT_REF, type, base),
- 0, 0,
+ 0, 0,
/*explicit_default_init_p=*/false,
0);
}
else if (!TYPE_NEEDS_CONSTRUCTING (type))
- elt_init = (build_modify_expr
+ elt_init = (build_modify_expr
(to, INIT_EXPR,
build_zero_init (type, size_one_node,
/*static_storage_p=*/false)));
if (auto_delete != sfk_deleting_destructor)
return void_zero_node;
- return build_op_delete_call (DELETE_EXPR, addr,
- cxx_sizeof_nowarn (type),
+ return build_op_delete_call (DELETE_EXPR, addr,
+ cxx_sizeof_nowarn (type),
use_global_delete,
/*placement=*/NULL_TREE,
/*alloc_fn=*/NULL_TREE);
/* Make sure we have access to the member op delete, even though
we'll actually be calling it from the destructor. */
build_op_delete_call (DELETE_EXPR, addr, cxx_sizeof_nowarn (type),
- /*global_p=*/false,
+ /*global_p=*/false,
/*placement=*/NULL_TREE,
/*alloc_fn=*/NULL_TREE);
}
mangle_vtbl_for_type: virtual table data
mangle_vtt_for_type: VTT data
mangle_ctor_vtbl_for_type: `C-in-B' constructor virtual table data
- mangle_thunk: thunk function or entry
-
-*/
+ mangle_thunk: thunk function or entry */
#include "config.h"
#include "system.h"
<special-name> ::= T <call-offset> <base encoding>
::= Tc <this_adjust call-offset> <result_adjust call-offset>
- <base encoding>
-*/
+ <base encoding> */
tree
mangle_thunk (tree fn_decl, const int this_adjusting, tree fixed_offset,
DECL_ARGUMENTS (fn) = cp_build_parm_decl (NULL_TREE, rhs_parm_type);
TREE_READONLY (DECL_ARGUMENTS (fn)) = 1;
}
- /* Add the "this" parameter. */
+ /* Add the "this" parameter. */
this_parm = build_this_parm (fn_type, TYPE_UNQUALIFIED);
TREE_CHAIN (this_parm) = DECL_ARGUMENTS (fn);
DECL_ARGUMENTS (fn) = this_parm;
if (!(TREE_CODE (decl) == VAR_DECL && DECL_DEAD_FOR_LOCAL (decl)))
return decl;
- shadowed = DECL_HAS_SHADOWED_FOR_VAR_P (decl)
+ shadowed = DECL_HAS_SHADOWED_FOR_VAR_P (decl)
? DECL_SHADOWED_FOR_VAR (decl) : NULL_TREE ;
while (shadowed != NULL_TREE && TREE_CODE (shadowed) == VAR_DECL
&& DECL_DEAD_FOR_LOCAL (shadowed))
- shadowed = DECL_HAS_SHADOWED_FOR_VAR_P (shadowed)
+ shadowed = DECL_HAS_SHADOWED_FOR_VAR_P (shadowed)
? DECL_SHADOWED_FOR_VAR (shadowed) : NULL_TREE;
if (!shadowed)
shadowed = IDENTIFIER_NAMESPACE_VALUE (DECL_NAME (decl));
}
scope_dependent_p = dependent_type_p (scope);
- name_dependent_p = (scope_dependent_p
+ name_dependent_p = (scope_dependent_p
|| (IDENTIFIER_TYPENAME_P (name)
&& dependent_type_p (TREE_TYPE (name))));
bases_dependent_p = false;
if (processing_template_decl)
for (binfo = TYPE_BINFO (current_class_type), i = 0;
- BINFO_BASE_ITERATE (binfo, i, base_binfo);
+ BINFO_BASE_ITERATE (binfo, i, base_binfo);
i++)
if (dependent_type_p (TREE_TYPE (base_binfo)))
{
/* From [namespace.udecl]:
A using-declaration used as a member-declaration shall refer to a
- member of a base class of the class being defined.
-
+ member of a base class of the class being defined.
+
In general, we cannot check this constraint in a template because
we do not know the entire set of base classes of the current
class type. However, if all of the base classes are
decl = lookup_member (binfo, name, 0, false);
if (!decl)
{
- error ("no members matching %<%T::%D%> in %q#T", scope, name,
+ error ("no members matching %<%T::%D%> in %q#T", scope, name,
scope);
return NULL_TREE;
}
b = b->level_chain;
gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE);
-
+
/* Do C++ gratuitous typedefing. */
if (IDENTIFIER_TYPE_VALUE (name) != type)
{
if (! context)
{
tree cs = current_scope ();
-
+
if (scope == ts_current)
context = cs;
else if (cs != NULL_TREE && TYPE_P (cs))
(type, scope == ts_within_enclosing_non_class, b);
if (decl == error_mark_node)
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
-
+
if (! in_class)
set_identifier_type_value_with_scope (name, tdef, b);
{
maybe_add_class_template_decl_list (current_class_type,
type, /*friend_p=*/0);
-
+
if (CLASSTYPE_NESTED_UTDS (current_class_type) == NULL)
CLASSTYPE_NESTED_UTDS (current_class_type)
= binding_table_new (SCOPE_DEFAULT_HT_SIZE);
-
+
binding_table_insert
(CLASSTYPE_NESTED_UTDS (current_class_type), name, type);
}
specialization. Since, by definition, an
explicit specialization is introduced by
"template <>", this scope is always empty. */
- sk_omp /* An OpenMP structured block. */
+ sk_omp /* An OpenMP structured block. */
} scope_kind;
/* The scope where the class/struct/union/enum tag applies. */
/* N is 1-based, not zero-based. */
gcc_assert (n > 0);
-
+
if (cp_lexer_debugging_p (lexer))
fprintf (cp_lexer_debug_stream,
"cp_lexer: peeking ahead %ld at token: ", (long)n);
form `ID a', where `ID' is an id-expression and `a' is a plain identifier.
Usually, `ID' should name a type, but if we got here it means that it
does not. We try to emit the best possible error message depending on
- how exactly the id-expression looks like.
-*/
+ how exactly the id-expression looks like. */
static bool
cp_parser_parse_and_diagnose_invalid_type_name (cp_parser *parser)
if (TREE_CODE (id) == IDENTIFIER_NODE)
{
result = make_typename_type (scope, id, typename_type,
- /*complain=*/tf_none);
+ /*complain=*/tf_none);
if (result == error_mark_node)
cp_parser_diagnose_invalid_type_name (parser, scope, id);
return result;
}
cp_parser_declaration_seq_opt (parser);
-
+
/* If there are no tokens left then all went well. */
if (cp_lexer_next_token_is (parser->lexer, CPP_EOF))
{
/* Get rid of the token array; we don't need it any more. */
cp_lexer_destroy (parser->lexer);
parser->lexer = NULL;
-
+
/* This file might have been a context that's implicitly extern
- "C". If so, pop the lang context. (Only relevant for PCH.) */
+ "C". If so, pop the lang context. (Only relevant for PCH.) */
if (parser->implicit_extern_c)
- {
- pop_lang_context ();
- parser->implicit_extern_c = false;
- }
-
+ {
+ pop_lang_context ();
+ parser->implicit_extern_c = false;
+ }
+
/* Finish up. */
finish_translation_unit ();
-
+
success = true;
}
else
cp_parser_error (parser, "expected declaration");
success = false;
}
-
+
/* Make sure the declarator obstack was fully cleaned up. */
gcc_assert (obstack_next_free (&declarator_obstack)
== declarator_obstack_base);
}
}
- decl = (finish_id_expression
+ decl = (finish_id_expression
(id_expression, decl, parser->scope,
idk,
parser->integral_constant_expression_p,
cp_parser_unqualified_id (cp_parser* parser,
bool template_keyword_p,
bool check_dependency_p,
- bool declarator_p,
+ bool declarator_p,
bool optional_p)
{
cp_token *token;
error ("%qD used without template parameters", decl);
else if (ambiguous_decls)
{
- error ("reference to %qD is ambiguous",
+ error ("reference to %qD is ambiguous",
token->value);
print_candidates (ambiguous_decls);
decl = error_mark_node;
/* Purge all subsequent tokens. */
cp_lexer_purge_tokens_after (parser->lexer, start);
}
-
+
if (start)
pop_to_parent_deferring_access_checks ();
}
/* It must be a primary-expression. */
- postfix_expression
- = cp_parser_primary_expression (parser, address_p, cast_p,
+ postfix_expression
+ = cp_parser_primary_expression (parser, address_p, cast_p,
/*template_arg_p=*/false,
&idk);
}
pseudo-destructor-name. */
bool template_p;
/* Parse the id-expression. */
- name = (cp_parser_id_expression
- (parser,
+ name = (cp_parser_id_expression
+ (parser,
cp_parser_optional_template_keyword (parser),
/*check_dependency_p=*/true,
&template_p,
offsetof-member-designator:
id-expression
| offsetof-member-designator "." id-expression
- | offsetof-member-designator "[" expression "]"
-*/
+ | offsetof-member-designator "[" expression "]" */
static tree
cp_parser_builtin_offsetof (cp_parser *parser)
declaration-statement
try-block
- IN_COMPOUND is true when the statement is nested inside a
+ IN_COMPOUND is true when the statement is nested inside a
cp_parser_compound_statement; this matters for certain pragmas. */
static void
/* Only certain OpenMP pragmas are attached to statements, and thus
are considered statements themselves. All others are not. In
the context of a compound, accept the pragma as a "statement" and
- return so that we can check for a close brace. Otherwise we
+ return so that we can check for a close brace. Otherwise we
require a real statement and must go back and read one. */
if (in_compound)
cp_parser_pragma (parser, pragma_compound);
attributes, /*prefix_attributes=*/NULL_TREE,
&pushed_scope);
/* Parse the assignment-expression. */
- initializer
+ initializer
= cp_parser_constant_expression (parser,
/*allow_non_constant_p=*/true,
&non_constant_p);
/* Process the initializer. */
cp_finish_decl (decl,
- initializer, !non_constant_p,
+ initializer, !non_constant_p,
asm_specification,
LOOKUP_ONLYCONVERTING);
case RID_VIRTUAL:
/* 14.5.2.3 [temp.mem]
-
- A member function template shall not be virtual. */
+
+ A member function template shall not be virtual. */
if (PROCESSING_REAL_TEMPLATE_DECL_P ())
error ("templates may not be %<virtual%>");
else if (decl_specs)
saved_in_template_argument_list_p = parser->in_template_argument_list_p;
parser->in_template_argument_list_p = true;
/* Even if the template-id appears in an integral
- constant-expression, the contents of the argument list do
- not. */
+ constant-expression, the contents of the argument list do
+ not. */
saved_ice_p = parser->integral_constant_expression_p;
parser->integral_constant_expression_p = false;
saved_non_ice_p = parser->non_integral_constant_expression_p;
if (TREE_CODE (argument) == BASELINK)
/* We don't need the information about what class was used
- to name the overloaded functions. */
+ to name the overloaded functions. */
argument = BASELINK_FUNCTIONS (argument);
if (TREE_CODE (argument) == VAR_DECL)
pop_deferring_access_checks ();
if (type)
do_type_instantiation (type, extension_specifier,
- /*complain=*/tf_error);
+ /*complain=*/tf_error);
}
else
{
/* We have processed another parameter list. */
++parser->num_template_parameter_lists;
/* [temp]
-
+
A template ... explicit specialization ... shall not have C
- linkage. */
+ linkage. */
if (current_lang_name == lang_name_c)
{
error ("template specialization with C linkage");
warning (OPT_Wattributes,
"type attributes are honored only at type definition");
- template_p =
+ template_p =
(parser->num_template_parameter_lists
&& (cp_parser_next_token_starts_class_definition_p (parser)
|| cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)));
/* An unqualified name was used to reference this type, so
there were no qualifying templates. */
- if (!cp_parser_check_template_parameters (parser,
+ if (!cp_parser_check_template_parameters (parser,
/*num_templates=*/0))
return error_mark_node;
type = xref_tag (tag_type, identifier, ts, template_p);
abstract_ok = (dcl_kind == CP_PARSER_DECLARATOR_EITHER);
if (abstract_ok)
cp_parser_parse_tentatively (parser);
- unqualified_name
+ unqualified_name
= cp_parser_declarator_id (parser, /*optional_p=*/abstract_ok);
qualifying_scope = parser->scope;
if (abstract_ok)
*ctor_dtor_or_conv_p = -1;
}
}
- declarator = make_id_declarator (qualifying_scope,
+ declarator = make_id_declarator (qualifying_scope,
unqualified_name,
sfk);
declarator->id_loc = token->location;
if (typename_p && decl != error_mark_node)
{
decl = make_typename_type (scope, decl, typename_type,
- /*complain=*/tf_error);
+ /*complain=*/tf_error);
if (decl != error_mark_node)
decl = TYPE_NAME (decl);
}
tree fn;
tree class_type = NULL_TREE;
tree pushed_scope = NULL_TREE;
-
+
/* In a first pass, parse default arguments to the functions.
Then, in a second pass, parse the bodies of the functions.
This two-phased approach handles cases like:
/* c_lex_with_flags marks a single digit '0' with PURE_ZERO. */
if (token->type != CPP_NUMBER || !(token->flags & PURE_ZERO))
{
- cp_parser_error (parser,
+ cp_parser_error (parser,
"invalid pure specifier (only `= 0' is allowed)");
cp_parser_skip_to_end_of_statement (parser);
return error_mark_node;
If AMBIGUOUS_DECLS is non-NULL, *AMBIGUOUS_DECLS is set to a
TREE_LIST of candidates if name-lookup results in an ambiguity, and
- NULL_TREE otherwise. */
+ NULL_TREE otherwise. */
static tree
cp_parser_lookup_name (cp_parser *parser, tree name,
enum tag_types tag_type,
- bool is_template,
+ bool is_template,
bool is_namespace,
bool check_dependency,
tree *ambiguous_decls)
if (!cp_parser_require (parser, CPP_LESS, "`<'"))
return;
/* [temp]
-
+
A template ... shall not have C linkage. */
if (current_lang_name == lang_name_c)
{
if (!processing_template_decl)
parsed_arg = check_default_argument (TREE_VALUE (parm), parsed_arg);
-
+
TREE_PURPOSE (parm) = parsed_arg;
/* Update any instantiations we've already created. */
decl_specs->specs[(int) ds_thread] = 0;
}
- switch (keyword)
+ switch (keyword)
{
case RID_AUTO:
storage_class = sc_auto;
token = cp_lexer_peek_token (parser->lexer);
while (cp_parser_objc_selector_p (token->type) || token->type == CPP_COLON
- || token->type == CPP_SCOPE)
+ || token->type == CPP_SCOPE)
{
tree selector = NULL_TREE;
selector = cp_parser_objc_selector (parser);
if (cp_lexer_next_token_is_not (parser->lexer, CPP_COLON)
- && cp_lexer_next_token_is_not (parser->lexer, CPP_SCOPE))
+ && cp_lexer_next_token_is_not (parser->lexer, CPP_SCOPE))
{
/* Detect if we have a unary selector. */
if (maybe_unary_selector_p)
}
maybe_unary_selector_p = false;
token = cp_lexer_consume_token (parser->lexer);
-
+
if (token->type == CPP_SCOPE)
- {
+ {
sel_seq
= chainon (sel_seq,
build_tree_list (selector, NULL_TREE));
cplus_decl_attributes (&decl, attributes, /*flags=*/0);
}
else
- decl = grokfield (declarator, &declspecs,
+ decl = grokfield (declarator, &declspecs,
NULL_TREE, /*init_const_expr_p=*/false,
NULL_TREE, attributes);
case 'c':
if (!strcmp ("copyin", p))
result = PRAGMA_OMP_CLAUSE_COPYIN;
- else if (!strcmp ("copyprivate", p))
+ else if (!strcmp ("copyprivate", p))
result = PRAGMA_OMP_CLAUSE_COPYPRIVATE;
break;
case 'f':
cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true,
/*or_comma=*/false,
/*consume_paren=*/true);
-
+
if (kind == OMP_CLAUSE_DEFAULT_UNSPECIFIED)
return list;
schedule ( schedule-kind , expression )
schedule-kind:
- static | dynamic | guided | runtime
-*/
+ static | dynamic | guided | runtime */
static tree
cp_parser_omp_clause_schedule (cp_parser *parser, tree list)
OMP_CLAUSE_SCHEDULE_KIND (c) = OMP_CLAUSE_SCHEDULE_DYNAMIC;
break;
- case 'g':
+ case 'g':
if (strcmp ("guided", p) != 0)
goto invalid_kind;
OMP_CLAUSE_SCHEDULE_KIND (c) = OMP_CLAUSE_SCHEDULE_GUIDED;
/* OpenMP 2.5:
- # pragma omp barrier new-line
-*/
+ # pragma omp barrier new-line */
static void
cp_parser_omp_barrier (cp_parser *parser, cp_token *pragma_tok)
/* OpenMP 2.5:
# pragma omp critical [(name)] new-line
- structured-block
-*/
+ structured-block */
static tree
cp_parser_omp_critical (cp_parser *parser, cp_token *pragma_tok)
cp_lexer_consume_token (parser->lexer);
name = cp_parser_identifier (parser);
-
+
if (name == error_mark_node
|| !cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"))
cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true,
/* OpenMP 2.5:
#pragma omp for for-clause[optseq] new-line
- for-loop
-*/
+ for-loop */
#define OMP_FOR_CLAUSE_MASK \
( (1u << PRAGMA_OMP_CLAUSE_PRIVATE) \
/* OpenMP 2.5:
# pragma omp master new-line
- structured-block
-*/
+ structured-block */
static tree
cp_parser_omp_master (cp_parser *parser, cp_token *pragma_tok)
/* OpenMP 2.5:
# pragma omp ordered new-line
- structured-block
-*/
+ structured-block */
static tree
cp_parser_omp_ordered (cp_parser *parser, cp_token *pragma_tok)
while (1)
{
- cp_parser_statement (parser, NULL_TREE, false);
+ cp_parser_statement (parser, NULL_TREE, false);
tok = cp_lexer_peek_token (parser->lexer);
if (tok->pragma_kind == PRAGMA_OMP_SECTION)
/* OpenMP 2.5:
# pragma omp sections sections-clause[optseq] newline
- sections-scope
-*/
+ sections-scope */
#define OMP_SECTIONS_CLAUSE_MASK \
( (1u << PRAGMA_OMP_CLAUSE_PRIVATE) \
/* OpenMP 2.5:
# pragma parallel parallel-clause new-line
# pragma parallel for parallel-for-clause new-line
- # pragma parallel sections parallel-sections-clause new-line
-*/
+ # pragma parallel sections parallel-sections-clause new-line */
#define OMP_PARALLEL_CLAUSE_MASK \
( (1u << PRAGMA_OMP_CLAUSE_IF) \
/* OpenMP 2.5:
# pragma omp single single-clause[optseq] new-line
- structured-block
-*/
+ structured-block */
#define OMP_SINGLE_CLAUSE_MASK \
( (1u << PRAGMA_OMP_CLAUSE_PRIVATE) \
PCH file, which is a GC collection point. So we need to handle this
first pragma without benefit of an existing lexer structure.
- Always returns one token to the caller in *FIRST_TOKEN. This is
+ Always returns one token to the caller in *FIRST_TOKEN. This is
either the true first token of the file, or the first token after
the initial pragma. */
static char* mangle_class_name_for_template (const char *, tree, tree);
static tree tsubst_initializer_list (tree, tree);
static tree get_class_bindings (tree, tree, tree);
-static tree coerce_template_parms (tree, tree, tree, tsubst_flags_t,
+static tree coerce_template_parms (tree, tree, tree, tsubst_flags_t,
bool, bool);
static void tsubst_enum (tree, tree, tree);
static tree add_to_template_args (tree, tree);
tree ns;
/* DR 275: An explicit instantiation shall appear in an enclosing
- namespace of its template. */
+ namespace of its template. */
ns = decl_namespace_context (spec);
if (!is_ancestor (current_namespace, ns))
pedwarn ("explicit instantiation of %qD in namespace %qD "
retrieve_local_specialization (tree tmpl)
{
tree spec = (tree) htab_find_with_hash (local_specializations, tmpl,
- htab_hash_pointer (tmpl));
+ htab_hash_pointer (tmpl));
return spec ? TREE_PURPOSE (spec) : NULL_TREE;
}
DECL_INITIAL (fn) = NULL_TREE;
duplicate_decls (spec, fn, is_friend);
/* The call to duplicate_decls will have applied
- [temp.expl.spec]:
+ [temp.expl.spec]:
- An explicit specialization of a function template
+ An explicit specialization of a function template
is inline only if it is explicitly declared to be,
and independently of whether its function template
is.
to the primary function; now copy the inline bits to
- the various clones. */
+ the various clones. */
FOR_EACH_CLONE (clone, fn)
{
DECL_DECLARED_INLINE_P (clone)
if (current_binding_level->kind == sk_template_parms
&& !current_binding_level->explicit_spec_p
&& (TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (fn))
- != TREE_VEC_LENGTH (INNERMOST_TEMPLATE_PARMS
+ != TREE_VEC_LENGTH (INNERMOST_TEMPLATE_PARMS
(current_template_parms))))
continue;
/* If DECL is a friend declaration, declared using an
unqualified name, the namespace associated with DECL may
have been set incorrectly. For example, in:
-
- template <typename T> void f(T);
- namespace N {
- struct S { friend void f<int>(int); }
- }
-
- we will have set the DECL_CONTEXT for the friend
- declaration to N, rather than to the global namespace. */
+
+ template <typename T> void f(T);
+ namespace N {
+ struct S { friend void f<int>(int); }
+ }
+
+ we will have set the DECL_CONTEXT for the friend
+ declaration to N, rather than to the global namespace. */
if (DECL_NAMESPACE_SCOPE_P (decl))
DECL_CONTEXT (decl) = DECL_CONTEXT (tmpl);
val = arg;
/* We only form one instance of each template specialization.
Therefore, if we use a non-canonical variant (i.e., a
- typedef), any future messages referring to the type will use
+ typedef), any future messages referring to the type will use
the typedef, which is confusing if those future uses do not
themselves also use the typedef. */
if (TYPE_P (val))
arglist = add_to_template_args (current_template_args (), arglist);
arglist2 = coerce_template_parms (parmlist, arglist, template,
- complain,
+ complain,
/*require_all_args=*/true,
/*use_default_args=*/true);
if (arglist2 == error_mark_node
{
tree a = coerce_template_parms (TREE_VALUE (t),
arglist, template,
- complain,
+ complain,
/*require_all_args=*/true,
/*use_default_args=*/true);
= coerce_template_parms (INNERMOST_TEMPLATE_PARMS (parmlist),
INNERMOST_TEMPLATE_ARGS (arglist),
template,
- complain,
+ complain,
/*require_all_args=*/true,
/*use_default_args=*/true);
specialization. We replace the innermost set of ARGS with
the arguments appropriate for substitution. For example,
given:
-
- template <class T> struct S {};
+
+ template <class T> struct S {};
template <class T> struct S<T*> {};
and supposing that we are instantiating S<int*>, ARGS will
- presently be {int*} -- but we need {int}. */
+ presently be {int*} -- but we need {int}. */
pattern = TREE_TYPE (t);
args = TREE_PURPOSE (t);
}
not occur unless the static data member is
itself used in a way that requires the
definition of the static data member to
- exist.
+ exist.
Therefore, we do not substitute into the
- initialized for the static data member here. */
- finish_static_data_member_decl
- (r,
- /*init=*/NULL_TREE,
+ initialized for the static data member here. */
+ finish_static_data_member_decl
+ (r,
+ /*init=*/NULL_TREE,
/*init_const_expr_p=*/false,
- /*asmspec_tree=*/NULL_TREE,
+ /*asmspec_tree=*/NULL_TREE,
/*flags=*/0);
if (DECL_INITIALIZED_IN_CLASS_P (r))
check_static_variable_definition (r, TREE_TYPE (r));
entering_scope, complain);
r = cp_build_qualified_type_real (r, TYPE_QUALS (t), complain);
}
-
+
skip_evaluation = saved_skip_evaluation;
return r;
tree new_type;
++processing_template_decl;
new_type = tsubst (TREE_TYPE (t), args, complain, in_decl);
- --processing_template_decl;
+ --processing_template_decl;
if (new_type == error_mark_node)
return error_mark_node;
DECL_TI_TEMPLATE (new_decl) = r;
TREE_TYPE (r) = TREE_TYPE (new_decl);
DECL_TI_ARGS (r) = DECL_TI_ARGS (new_decl);
- DECL_CONTEXT (r) = DECL_CONTEXT (new_decl);
+ DECL_CONTEXT (r) = DECL_CONTEXT (new_decl);
}
SET_DECL_IMPLICIT_INSTANTIATION (r);
{
tree ve = DECL_VALUE_EXPR (t);
ve = tsubst_expr (ve, args, complain, in_decl);
- SET_DECL_VALUE_EXPR (r, ve);
+ SET_DECL_VALUE_EXPR (r, ve);
}
}
else if (DECL_SELF_REFERENCE_P (t))
expr = name;
if (dependent_type_p (scope))
- return build_qualified_name (/*type=*/NULL_TREE,
- scope, expr,
+ return build_qualified_name (/*type=*/NULL_TREE,
+ scope, expr,
QUALIFIED_NAME_IS_TEMPLATE (qualified_id));
if (!BASELINK_P (name) && !DECL_P (expr))
{
expr = (adjust_result_of_qualified_name_lookup
(expr, scope, current_class_type));
- expr = (finish_qualified_id_expr
+ expr = (finish_qualified_id_expr
(scope, expr, done, address_p,
QUALIFIED_NAME_IS_TEMPLATE (qualified_id),
/*template_arg_p=*/false));
complain, in_decl);
name = build1 (BIT_NOT_EXPR, NULL_TREE, name);
name = build_qualified_name (/*type=*/NULL_TREE,
- base, name,
+ base, name,
/*template_p=*/false);
}
else if (TREE_CODE (name) == BASELINK)
}
else
qualified_p = false;
-
+
function = tsubst_copy_and_build (function, args, complain,
in_decl,
!qualified_p);
if (nt)
{
/* DR 488 makes use of a type with no linkage cause
- type deduction to fail. */
+ type deduction to fail. */
if (complain & tf_error)
{
if (TYPE_ANONYMOUS_P (nt))
error ("%qT is/uses anonymous type", t);
else
error ("template argument for %qD uses local type %qT",
- tmpl, t);
+ tmpl, t);
}
result = true;
}
if (same_type_p (parm, type))
continue;
if (strict != DEDUCE_EXACT
- && can_convert_arg (parm, type, TYPE_P (arg) ? NULL_TREE : arg,
+ && can_convert_arg (parm, type, TYPE_P (arg) ? NULL_TREE : arg,
flags))
continue;
-
+
return 1;
}
typename Block>
void operator+(float, View<Block> const&);
- template <typename Block,
- unsigned int Dim = Block::dim>
+ template <typename Block,
+ unsigned int Dim = Block::dim>
struct Lvalue_proxy { operator float() const; };
void
Here, if Lvalue_proxy is permitted to bind to View, then
the global operator+ will be used; if they are not, the
- Lvalue_proxy will be converted to float. */
- if (coerce_template_parms (argtmplvec, parmvec,
+ Lvalue_proxy will be converted to float. */
+ if (coerce_template_parms (argtmplvec, parmvec,
TYPE_TI_TEMPLATE (parm),
tf_none,
/*require_all_args=*/true,
return 1;
/* CV qualifications for methods can never be deduced, they must
- match exactly. We need to check them explicitly here,
- because type_unification_real treats them as any other
- cvqualified parameter. */
+ match exactly. We need to check them explicitly here,
+ because type_unification_real treats them as any other
+ cvqualified parameter. */
if (TREE_CODE (parm) == METHOD_TYPE
&& (!check_cv_quals_for_unify
(UNIFY_ALLOW_NONE,
tree args2 = TYPE_ARG_TYPES (TREE_TYPE (decl2));
int better1 = 0;
int better2 = 0;
-
+
/* Remove the this parameter from non-static member functions. If
one is a non-static member function and the other is not a static
member function, remove the first parameter from that function
args1 = TREE_CHAIN (args1);
}
}
-
+
/* If only one is a conversion operator, they are unordered. */
if (DECL_CONV_FN_P (decl1) != DECL_CONV_FN_P (decl2))
return 0;
specialized.
See [temp.class.order] for information about determining which of
- two templates is more specialized. */
+ two templates is more specialized. */
static int
more_specialized_class (tree pat1, tree pat2)
types in the arguments, and we need our dependency check functions
to behave correctly. */
++processing_template_decl;
- targs = get_class_bindings (TREE_VALUE (pat1),
+ targs = get_class_bindings (TREE_VALUE (pat1),
CLASSTYPE_TI_ARGS (tmpl1),
CLASSTYPE_TI_ARGS (tmpl2));
if (targs)
--winner;
- targs = get_class_bindings (TREE_VALUE (pat2),
+ targs = get_class_bindings (TREE_VALUE (pat2),
CLASSTYPE_TI_ARGS (tmpl2),
CLASSTYPE_TI_ARGS (tmpl1));
if (targs)
converted_args
= coerce_template_parms (DECL_INNERMOST_TEMPLATE_PARMS (tmpl),
explicit_args, NULL_TREE,
- tf_none,
+ tf_none,
/*require_all_args=*/false,
/*use_default_args=*/false);
if (converted_args == error_mark_node)
innermost_deduced_args);
}
else
- deduced_args = innermost_deduced_args;
+ deduced_args = innermost_deduced_args;
- if (unify (tparms, deduced_args,
- INNERMOST_TEMPLATE_ARGS (spec_args),
- INNERMOST_TEMPLATE_ARGS (args),
+ if (unify (tparms, deduced_args,
+ INNERMOST_TEMPLATE_ARGS (spec_args),
+ INNERMOST_TEMPLATE_ARGS (args),
UNIFY_ALLOW_NONE))
return NULL_TREE;
/* Verify that nondeduced template arguments agree with the type
obtained from argument deduction.
-
+
For example:
struct A { typedef int X; };
tree spec_args;
partial_spec_args = CLASSTYPE_TI_ARGS (TREE_TYPE (t));
- spec_args = get_class_bindings (TREE_VALUE (t),
- partial_spec_args,
+ spec_args = get_class_bindings (TREE_VALUE (t),
+ partial_spec_args,
args);
if (spec_args)
{
}
else
error ("storage class %qD applied to template instantiation", storage);
-
+
check_explicit_instantiation_namespace (result);
mark_decl_instantiated (result, extern_p);
if (! extern_p)
- instantiate_decl (result, /*defer_ok=*/1,
+ instantiate_decl (result, /*defer_ok=*/1,
/*expl_inst_class_mem_p=*/false);
}
{
mark_decl_instantiated (decl, extern_p);
if (! extern_p)
- instantiate_decl (decl, /*defer_ok=*/1,
+ instantiate_decl (decl, /*defer_ok=*/1,
/*expl_inst_class_mem_p=*/true);
}
explicitly instantiated class template. */
tree
-instantiate_decl (tree d, int defer_ok,
+instantiate_decl (tree d, int defer_ok,
bool expl_inst_class_mem_p)
{
tree tmpl = DECL_TI_TEMPLATE (d);
code_pattern = DECL_TEMPLATE_RESULT (td);
/* We should never be trying to instantiate a member of a class
- template or partial specialization. */
+ template or partial specialization. */
gcc_assert (d != code_pattern);
-
+
if ((DECL_NAMESPACE_SCOPE_P (d) && !DECL_INITIALIZED_IN_CLASS_P (d))
|| DECL_TEMPLATE_SPECIALIZATION (td))
/* In the case of a friend template whose definition is provided
/* If D is a member of an explicitly instantiated class template,
and no definition is available, treat it like an implicit
- instantiation. */
- if (!pattern_defined && expl_inst_class_mem_p
- && DECL_EXPLICIT_INSTANTIATION (d))
+ instantiation. */
+ if (!pattern_defined && expl_inst_class_mem_p
+ && DECL_EXPLICIT_INSTANTIATION (d))
{
DECL_NOT_REALLY_EXTERN (d) = 0;
DECL_INTERFACE_KNOWN (d) = 0;
&& ! (TREE_CODE (d) == FUNCTION_DECL && DECL_INLINE (d))
/* ... we instantiate static data members whose values are
needed in integral constant expressions. */
- && ! (TREE_CODE (d) == VAR_DECL
+ && ! (TREE_CODE (d) == VAR_DECL
&& DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (d)))
goto out;
/* Defer all other templates, unless we have been explicitly
forbidden from doing so. */
if (/* If there is no definition, we cannot instantiate the
template. */
- ! pattern_defined
+ ! pattern_defined
/* If it's OK to postpone instantiation, do so. */
|| defer_ok
/* If this is a static data member that will be defined
/* The definition of the static data member is now required so
we must substitute the initializer. */
if (TREE_CODE (d) == VAR_DECL
- && !DECL_INITIAL (d)
+ && !DECL_INITIAL (d)
&& DECL_INITIAL (code_pattern))
{
tree ns;
ns = decl_namespace_context (d);
push_nested_namespace (ns);
push_nested_class (DECL_CONTEXT (d));
- init = tsubst_expr (DECL_INITIAL (code_pattern),
+ init = tsubst_expr (DECL_INITIAL (code_pattern),
args,
tf_warning_or_error, NULL_TREE);
cp_finish_decl (d, init, /*init_const_expr_p=*/false,
fn;
fn = TREE_CHAIN (fn))
if (! DECL_ARTIFICIAL (fn))
- instantiate_decl (fn,
+ instantiate_decl (fn,
/*defer_ok=*/0,
/*expl_inst_class_mem_p=*/false);
if (COMPLETE_TYPE_P (instantiation))
if (!DECL_TEMPLATE_SPECIALIZATION (instantiation)
&& !DECL_TEMPLATE_INSTANTIATED (instantiation))
{
- instantiation
+ instantiation
= instantiate_decl (instantiation,
/*defer_ok=*/0,
/*expl_inst_class_mem_p=*/false);
}
gcc_assert (TREE_CODE (expression) != TYPE_DECL);
-
+
return (dependent_type_p (TREE_TYPE (expression)));
}
/* If the type is unknown, it can't really be non-dependent */
gcc_assert (TREE_TYPE (expr) != unknown_type_node);
-
+
/* Otherwise, build a NON_DEPENDENT_EXPR.
REFERENCE_TYPEs are not stripped for expressions in templates
case BASELINK:
print_node (file, "functions", BASELINK_FUNCTIONS (node), indent + 4);
print_node (file, "binfo", BASELINK_BINFO (node), indent + 4);
- print_node (file, "access_binfo", BASELINK_ACCESS_BINFO (node),
+ print_node (file, "access_binfo", BASELINK_ACCESS_BINFO (node),
indent + 4);
break;
case OVERLOAD:
TK_POINTER_MEMBER_TYPE, /* abi::__pointer_to_member_type_info */
TK_CLASS_TYPE, /* abi::__class_type_info */
TK_SI_CLASS_TYPE, /* abi::__si_class_type_info */
- TK_FIXED /* end of fixed descriptors. */
- /* ... abi::__vmi_type_info<I> */
+ TK_FIXED /* end of fixed descriptors. */
+ /* ... abi::__vmi_type_info<I> */
} tinfo_kind;
/* A vector of all tinfo decls that haven't yet been emitted. */
size_binop (MULT_EXPR,
size_int (2 * TARGET_VTABLE_DATA_ENTRY_DISTANCE),
TYPE_SIZE_UNIT (vtable_entry_type)));
-
+
ti->vtable = vtable_ptr;
}
generic_initializer (tinfo_s *ti, tree target)
{
tree init = tinfo_base_init (ti, target);
-
+
init = build_constructor_from_list (NULL_TREE, init);
TREE_CONSTANT (init) = 1;
TREE_INVARIANT (init) = 1;
init = tree_cons (NULL_TREE,
get_tinfo_ptr (klass),
init);
-
+
init = build_constructor_from_list (NULL_TREE, nreverse (init));
TREE_CONSTANT (init) = 1;
TREE_INVARIANT (init) = 1;
get_pseudo_ti_init (tree type, unsigned tk_index)
{
tinfo_s *ti = VEC_index (tinfo_s, tinfo_descs, tk_index);
-
+
gcc_assert (at_eof);
switch (tk_index)
{
case TK_POINTER_MEMBER_TYPE:
return ptm_initializer (ti, type);
-
+
case TK_POINTER_TYPE:
return ptr_initializer (ti, type);
-
+
case TK_BUILTIN_TYPE:
case TK_ENUMERAL_TYPE:
case TK_FUNCTION_TYPE:
VEC(tree,gc) *base_accesses = BINFO_BASE_ACCESSES (binfo);
tree base_inits = NULL_TREE;
int ix;
-
+
gcc_assert (tk_index >= TK_FIXED);
-
+
/* Generate the base information initializer. */
for (ix = nbases; ix--;)
{
int flags = 0;
tree tinfo;
tree offset;
-
+
if (VEC_index (tree, base_accesses, ix) == access_public_node)
flags |= 2;
tinfo = get_tinfo_ptr (BINFO_TYPE (base_binfo));
if (BINFO_VIRTUAL_P (base_binfo))
{
/* We store the vtable offset at which the virtual
- base offset can be found. */
+ base offset can be found. */
offset = BINFO_VPTR_FIELD (base_binfo);
offset = convert (sizetype, offset);
flags |= 1;
}
else
offset = BINFO_OFFSET (base_binfo);
-
+
/* Combine offset and flags into one field. */
offset = cp_build_binary_op (LSHIFT_EXPR, offset,
build_int_cst (NULL_TREE, 8));
get_pseudo_ti_index (tree type)
{
unsigned ix;
-
+
switch (TREE_CODE (type))
{
case OFFSET_TYPE:
ix = TK_POINTER_MEMBER_TYPE;
break;
-
+
case POINTER_TYPE:
ix = TK_POINTER_TYPE;
break;
-
+
case ENUMERAL_TYPE:
ix = TK_ENUMERAL_TYPE;
break;
-
+
case FUNCTION_TYPE:
ix = TK_FUNCTION_TYPE;
break;
-
+
case ARRAY_TYPE:
ix = TK_ARRAY_TYPE;
break;
-
+
case UNION_TYPE:
case RECORD_TYPE:
if (TYPE_PTRMEMFUNC_P (type))
{
/* too short, extend. */
unsigned len = VEC_length (tinfo_s, tinfo_descs);
-
+
VEC_safe_grow (tinfo_s, gc, tinfo_descs, ix + 1);
while (VEC_iterate (tinfo_s, tinfo_descs, len++, ti))
ti->type = ti->vtable = ti->name = NULL_TREE;
create_tinfo_types (void)
{
tinfo_s *ti;
-
+
gcc_assert (!tinfo_descs);
VEC_safe_grow (tinfo_s, gc, tinfo_descs, TK_FIXED);
-
+
push_nested_namespace (abi_node);
/* Create the internal type_info structure. This is used as a base for
create_pseudo_type_info (TK_ARRAY_TYPE, "__array_type_info", NULL);
create_pseudo_type_info (TK_FUNCTION_TYPE, "__function_type_info", NULL);
create_pseudo_type_info (TK_ENUMERAL_TYPE, "__enum_type_info", NULL);
-
+
/* Class type_info. No additional fields. */
create_pseudo_type_info (TK_CLASS_TYPE, "__class_type_info", NULL);
-
- /* Single public non-virtual base class. Add pointer to base class.
+
+ /* Single public non-virtual base class. Add pointer to base class.
This is really a descendant of __class_type_info. */
create_pseudo_type_info (TK_SI_CLASS_TYPE, "__si_class_type_info",
- build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type),
- NULL);
+ build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type),
+ NULL);
/* Base class internal helper. Pointer to base type, offset to base,
flags. */
field = build_decl (FIELD_DECL, NULL_TREE, integer_types[itk_long]);
TREE_CHAIN (field) = fields;
fields = field;
-
+
ti = VEC_index (tinfo_s, tinfo_descs, TK_BASE_TYPE);
-
+
ti->type = make_aggr_type (RECORD_TYPE);
ti->vtable = NULL_TREE;
ti->name = NULL_TREE;
This is really a descendant of __pbase_type_info. */
create_pseudo_type_info (TK_POINTER_MEMBER_TYPE,
"__pointer_to_member_type_info",
- build_decl (FIELD_DECL, NULL_TREE, integer_type_node),
- build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type),
- build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type),
- NULL);
+ build_decl (FIELD_DECL, NULL_TREE, integer_type_node),
+ build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type),
+ build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type),
+ NULL);
pop_nested_namespace (abi_node);
}
if (DECL_NOT_REALLY_EXTERN (decl) && decl_needed_p (decl))
{
tree init;
-
+
DECL_EXTERNAL (decl) = 0;
init = get_pseudo_ti_init (type, get_pseudo_ti_index (type));
DECL_INITIAL (decl) = init;
instantiation. However, PROCESSING_TEMPLATE_DECL is set in the
parameter list for a template (because we may see dependent types
in default arguments for template parameters), and access
- checking should be performed in the outermost parameter list. */
- if (processing_template_decl
+ checking should be performed in the outermost parameter list. */
+ if (processing_template_decl
&& (!processing_template_parmlist || processing_template_decl > 1))
return 1;
if (!lvalue_or_else (operand, lv_asm))
operand = error_mark_node;
- if (operand != error_mark_node
+ if (operand != error_mark_node
&& (TREE_READONLY (operand)
|| CP_TYPE_CONST_P (TREE_TYPE (operand))
- /* Functions are not modifiable, even though they are
- lvalues. */
- || TREE_CODE (TREE_TYPE (operand)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (operand)) == METHOD_TYPE
- /* If it's an aggregate and any field is const, then it is
- effectively const. */
- || (CLASS_TYPE_P (TREE_TYPE (operand))
- && C_TYPE_FIELDS_READONLY (TREE_TYPE (operand)))))
+ /* Functions are not modifiable, even though they are
+ lvalues. */
+ || TREE_CODE (TREE_TYPE (operand)) == FUNCTION_TYPE
+ || TREE_CODE (TREE_TYPE (operand)) == METHOD_TYPE
+ /* If it's an aggregate and any field is const, then it is
+ effectively const. */
+ || (CLASS_TYPE_P (TREE_TYPE (operand))
+ && C_TYPE_FIELDS_READONLY (TREE_TYPE (operand)))))
readonly_error (operand, "assignment (via 'asm' output)", 0);
constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t)));
is true iff this qualified name appears as a template argument. */
tree
-finish_qualified_id_expr (tree qualifying_class,
- tree expr,
+finish_qualified_id_expr (tree qualifying_class,
+ tree expr,
bool done,
- bool address_p,
+ bool address_p,
bool template_p,
bool template_arg_p)
{
return error_mark_node;
/* If the last statement does not have "void" type, then the value
- of the last statement is the value of the entire expression. */
+ of the last statement is the value of the entire expression. */
if (expr)
{
tree type;
statement-expression. */
if (!processing_template_decl && !VOID_TYPE_P (type))
{
- tree target_expr;
- if (CLASS_TYPE_P (type)
- && !TYPE_HAS_TRIVIAL_INIT_REF (type))
+ tree target_expr;
+ if (CLASS_TYPE_P (type)
+ && !TYPE_HAS_TRIVIAL_INIT_REF (type))
{
target_expr = build_target_expr_with_type (expr, type);
expr = TARGET_EXPR_INITIAL (target_expr);
problem described above. */
target_expr = force_target_expr (type, expr);
expr = TARGET_EXPR_INITIAL (target_expr);
- expr = build2 (INIT_EXPR,
+ expr = build2 (INIT_EXPR,
type,
TARGET_EXPR_SLOT (target_expr),
expr);
{
/* If this compound-literal appears outside of a function, then
the corresponding variable has static storage duration, just
- like the variable in whose initializer it appears. */
+ like the variable in whose initializer it appears. */
TREE_STATIC (var) = 1;
/* The variable has internal linkage, since there is no need to
reference it from another translation unit. */
pushdecl (var);
/* Initialize the variable as we would any other variable with a
brace-enclosed initializer. */
- cp_finish_decl (var, compound_literal,
+ cp_finish_decl (var, compound_literal,
/*init_const_expr_p=*/false,
/*asmspec_tree=*/NULL_TREE,
LOOKUP_ONLYCONVERTING);
inner_type, LOOKUP_NORMAL);
/* We'll have called convert_from_reference on the call, which
- may well have added an indirect_ref. It's unneeded here,
+ may well have added an indirect_ref. It's unneeded here,
and in the way, so kill it. */
if (TREE_CODE (t) == INDIRECT_REF)
t = TREE_OPERAND (t, 0);
void
finish_omp_atomic (enum tree_code code, tree lhs, tree rhs)
{
- /* If either of the operands are dependent, we can't do semantic
+ /* If either of the operands are dependent, we can't do semantic
processing yet. Stuff the values away for now. We cheat a bit
- and use the same tree code for this, even though the operands
+ and use the same tree code for this, even though the operands
are of totally different form, thus we need to remember which
statements are which, thus the lang_flag bit. */
/* ??? We ought to be using type_dependent_expression_p, but the
the type of the result expression, if known, or NULL_TREE if the
resulting expression is type-dependent. If TEMPLATE_P is true,
NAME is known to be a template because the user explicitly used the
- "template" keyword after the "::".
+ "template" keyword after the "::".
All SCOPE_REFs should be built by use of this function. */
/* Things that are TREE_PUBLIC have external linkage. */
if (TREE_PUBLIC (decl))
return lk_external;
-
- /* Linkage of a CONST_DECL depends on the linkage of the enumeration
+
+ /* Linkage of a CONST_DECL depends on the linkage of the enumeration
type. */
if (TREE_CODE (decl) == CONST_DECL)
return decl_linkage (TYPE_NAME (TREE_TYPE (decl)));
cxx_alignof_expr (tree e)
{
tree t;
-
+
if (e == error_mark_node)
return error_mark_node;
adr = build_unary_op (ADDR_EXPR, exp, 1);
return cp_convert (ptrtype, adr);
}
-
+
/* If a bitfield is used in a context where integral promotion
applies, then the caller is expected to have used
default_conversion. That function promotes bitfields correctly
{
/* Perform the integral promotions first so that bitfield
expressions (which may promote to "int", even if the bitfield is
- declared "unsigned") are promoted correctly. */
+ declared "unsigned") are promoted correctly. */
if (INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (exp)))
exp = perform_integral_promotions (exp);
/* Perform the other conversions. */
template, the program is ill-formed.
DR 228 removed the restriction that the template be a member
- template.
-
+ template.
+
DR 96, if accepted would add the further restriction that explicit
template arguments must be provided if the template keyword is
used, but, as of 2005-10-16, that DR is still in "drafting". If
orig_object, orig_name,
NULL_TREE);
}
-
+
return expr;
}
case EQ_EXPR:
case NE_EXPR:
if (code0 == REAL_TYPE || code1 == REAL_TYPE)
- warning (OPT_Wfloat_equal,
- "comparing floating point with == or != is unsafe");
+ warning (OPT_Wfloat_equal,
+ "comparing floating point with == or != is unsafe");
if ((TREE_CODE (orig_op0) == STRING_CST && !integer_zerop (op1))
|| (TREE_CODE (orig_op1) == STRING_CST && !integer_zerop (op0)))
warning (OPT_Wstring_literal_comparison,
from_array = TREE_CODE (TREE_TYPE (newrhs)) == ARRAY_TYPE
? 1 + (modifycode != INIT_EXPR): 0;
- return build_vec_init (lhs, NULL_TREE, newrhs,
+ return build_vec_init (lhs, NULL_TREE, newrhs,
/*explicit_default_init_p=*/false,
from_array);
}
"%s might be a candidate for a format attribute",
errtype);
}
-
+
return perform_implicit_conversion (strip_top_quals (type), rhs);
}
return!). */
current_function_returns_null = 0;
/* And signal caller that TREE_NO_WARNING should be set on the
- RETURN_EXPR to avoid control reaches end of non-void function
- warnings in tree-cfg.c. */
+ RETURN_EXPR to avoid control reaches end of non-void function
+ warnings in tree-cfg.c. */
*no_warning = true;
}
/* Check for a return statement with a value in a function that
was an incomplete type. Just treat this as 'return;' */
if (VOID_TYPE_P (functype))
return error_mark_node;
-
+
/* First convert the value to the function's return type, then
to the type of return value's location to handle the
case that functype is smaller than the valtype. */
add anything to the CONSTRUCTOR. */
break;
- flags |= picflag_from_initializer (next);
+ flags |= picflag_from_initializer (next);
CONSTRUCTOR_APPEND_ELT (v, size_int (i), next);
}
gcc_assert (TREE_CODE (ce->index) == FIELD_DECL
|| TREE_CODE (ce->index) == IDENTIFIER_NODE);
if (ce->index != field
- && ce->index != DECL_NAME (field))
+ && ce->index != DECL_NAME (field))
sorry ("non-trivial designated initializers not supported");
}
After the execution, the initializer will have TREE_CONSTANT if all elts are
constant, and TREE_STATIC set if, in addition, all elts are simple enough
constants that the assembler and linker can compute them.
-
+
The function returns the initializer itself, or error_mark_node in case
of error. */