tree error_mark_list;
/* The following symbols are subsumed in the cp_global_trees array, and
- listed here individually for documentation purposes.
+ listed here individually for documentation purposes.
C++ extensions
tree wchar_decl_node;
tree current_function_return_value;
+/* Nonzero means use the ISO C9x dialect of C. */
+
+int flag_isoc9x;
+
/* Nonzero means give `double' the same size as `float'. */
extern int flag_short_double;
};
#define NULL_BINDING_LEVEL ((struct binding_level *) NULL)
-
+
/* The binding level currently in effect. */
#define current_binding_level \
/* Remove the binding for DECL which should be the innermost binding
for ID. */
-static void
-pop_binding (id, decl)
+static void
+pop_binding (id, decl)
tree id;
tree decl;
{
tree binding;
-
+
if (id == NULL_TREE)
/* It's easiest to write the loops that call this function without
checking whether or not the entities involved have names. We
}
/* At the end of a function, all labels declared within the fucntion
- go out of scope. BLOCK is the top-level block for the
+ go out of scope. BLOCK is the top-level block for the
function. */
static void
in a for-init statement were in scope after the for-statement
ended. We only use the new rules in flag_new_for_scope is
nonzero. */
- leaving_for_scope
+ leaving_for_scope
= current_binding_level->is_for_scope && flag_new_for_scope == 1;
/* Remove declarations for all the DECLs in this level. */
{
if (leaving_for_scope && TREE_CODE (link) == VAR_DECL)
{
- tree outer_binding
+ tree outer_binding
= TREE_CHAIN (IDENTIFIER_BINDING (DECL_NAME (link)));
tree ns_binding;
else
ns_binding = NULL_TREE;
- if (outer_binding
- && (BINDING_LEVEL (outer_binding)
+ if (outer_binding
+ && (BINDING_LEVEL (outer_binding)
== current_binding_level->level_chain))
/* We have something like:
-
+
int i;
for (int i; ;);
-
+
and we are leaving the `for' scope. There's no reason to
keep the binding of the inner `i' in this case. */
pop_binding (DECL_NAME (link), link);
- else if ((outer_binding
- && (TREE_CODE (BINDING_VALUE (outer_binding))
+ else if ((outer_binding
+ && (TREE_CODE (BINDING_VALUE (outer_binding))
== TYPE_DECL))
- || (ns_binding
+ || (ns_binding
&& TREE_CODE (ns_binding) == TYPE_DECL))
/* Here, we have something like:
/* Mark this VAR_DECL as dead so that we can tell we left it
there only for backward compatibility. */
DECL_DEAD_FOR_LOCAL (link) = 1;
-
+
/* Keep track of what should of have happenned when we
popped the binding. */
if (outer_binding && BINDING_VALUE (outer_binding))
- DECL_SHADOWED_FOR_VAR (link)
+ DECL_SHADOWED_FOR_VAR (link)
= BINDING_VALUE (outer_binding);
/* Add it to the list of dead variables in the next
= 0;
}
}
- else
+ else
{
/* Remove the binding. */
decl = link;
pop_binding (DECL_NAME (decl), decl);
else if (TREE_CODE (decl) == OVERLOAD)
pop_binding (DECL_NAME (OVL_FUNCTION (decl)), decl);
- else
+ else
my_friendly_abort (0);
}
}
/* Restore the IDENTIFIER_LABEL_VALUEs for local labels. */
for (link = current_binding_level->shadowed_labels;
- link;
+ link;
link = TREE_CHAIN (link))
pop_label (link);
{
tree scope_stmts;
- scope_stmts
+ scope_stmts
= add_scope_stmt (/*begin_p=*/0, /*partial_p=*/1);
if (block)
{
tree shadowed;
my_friendly_assert (level != 0, 354);
-
+
/* If we're leaving a toplevel class, don't bother to do the setting
of IDENTIFIER_CLASS_VALUE to NULL_TREE, since first of all this slot
shouldn't even be used when current_class_type isn't set, and second,
shadowed;
shadowed = TREE_CHAIN (shadowed))
IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (shadowed)) = NULL_TREE;
-
+
/* Find the next enclosing class, and recreate
IDENTIFIER_CLASS_VALUEs appropriate for that class. */
b = level->level_chain;
b = b->level_chain;
if (b)
- for (shadowed = b->class_shadowed;
- shadowed;
+ for (shadowed = b->class_shadowed;
+ shadowed;
shadowed = TREE_CHAIN (shadowed))
{
tree t;
t = IDENTIFIER_BINDING (TREE_PURPOSE (shadowed));
while (t && BINDING_LEVEL (t) != b)
t = TREE_CHAIN (t);
-
+
if (t)
- IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (shadowed))
+ IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (shadowed))
= BINDING_VALUE (t);
}
}
SET_IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (shadowed), TREE_VALUE (shadowed));
/* Remove the bindings for all of the class-level declarations. */
- for (shadowed = level->class_shadowed;
- shadowed;
+ for (shadowed = level->class_shadowed;
+ shadowed;
shadowed = TREE_CHAIN (shadowed))
pop_binding (TREE_PURPOSE (shadowed), TREE_TYPE (shadowed));
for which P returns non-zero, call F with its address. If any call
to F returns a non-zero value, return a non-zero value. */
-static int
+static int
walk_globals_r (namespace, data)
tree namespace;
void *data;
/* Process the decls in reverse order--earliest first.
Put them into VEC from back to front, then take out from front. */
-
+
for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl))
vec[len - i - 1] = decl;
-
+
if (last_time)
{
check_global_declarations (vec, len);
/* We can probably fit 3 names to a line? */
for (t = lvl->names; t; t = TREE_CHAIN (t))
{
- if (no_print_functions && (TREE_CODE (t) == FUNCTION_DECL))
+ if (no_print_functions && (TREE_CODE (t) == FUNCTION_DECL))
continue;
if (no_print_builtins
&& (TREE_CODE (t) == TYPE_DECL)
tree iter, prev = NULL_TREE;
scope = ORIGINAL_NAMESPACE (scope);
-
+
for (iter = IDENTIFIER_NAMESPACE_BINDINGS (name); iter;
iter = TREE_CHAIN (iter))
{
tree result;
scope = ORIGINAL_NAMESPACE (scope);
-
+
if (b && TREE_CODE (b) != CPLUS_BINDING)
{
/* Get rid of optimization for global scope. */
if (scope == NULL_TREE)
scope = global_namespace;
-
+
if (scope == global_namespace)
{
b = IDENTIFIER_NAMESPACE_BINDINGS (name);
}
}
}
-
+
if (need_new)
{
/* Make a new namespace, binding the name to it. */
/* Pop back from the scope of the namespace NS, which was previously
entered with push_nested_namespace. */
-
+
void
pop_nested_namespace (ns)
tree ns;
else
id = DECL_NAME (t);
- if (!id
+ if (!id
/* Note that we may have an IDENTIFIER_CLASS_VALUE even when
we have no IDENTIFIER_BINDING if we have left the class
scope, but cached the class-level declarations. */
}
\f
/* Push a definition of struct, union or enum tag "name".
- into binding_level "b". "type" should be the type node,
+ into binding_level "b". "type" should be the type node,
We assume that the tag "name" is not already defined.
Note that the definition may really be just a forward reference.
Returns the TYPE_DECL for TYPE, which may have been altered by this
processing. */
-static tree
+static tree
maybe_process_template_type_declaration (type, globalize, b)
tree type;
int globalize;
struct binding_level* b;
{
tree decl = TYPE_NAME (type);
-
+
if (processing_template_parmlist)
/* You can't declare a new template type in a template parameter
list. But, you can declare a non-template type:
-
+
template <class A*> struct S;
-
+
is a forward-declaration of `A'. */
;
- else
+ else
{
maybe_check_template_type (type);
- my_friendly_assert (IS_AGGR_TYPE (type)
+ my_friendly_assert (IS_AGGR_TYPE (type)
|| TREE_CODE (type) == ENUMERAL_TYPE, 0);
-
-
+
+
if (processing_template_decl)
{
/* This may change after the call to
/* Put this tag on the list of tags for the class, since
that won't happen below because B is not the class
binding level, but is instead the pseudo-global level. */
- b->level_chain->tags =
+ b->level_chain->tags =
tree_cons (name, type, b->level_chain->tags);
if (TYPE_SIZE (current_class_type) == NULL_TREE)
CLASSTYPE_TAGS (current_class_type) = b->level_chain->tags;
if (! globalize)
context = cs;
- else if (cs != NULL_TREE
+ else if (cs != NULL_TREE
&& TREE_CODE_CLASS (TREE_CODE (cs)) == 't')
/* When declaring a friend class of a local class, we want
to inject the newly named class into the scope
if (!comp_template_parms (DECL_TEMPLATE_PARMS (newdecl),
DECL_TEMPLATE_PARMS (olddecl)))
return 0;
-
+
if (TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL)
types_match = 1;
else
tree name;
- if (TREE_CODE (newdecl) == TYPE_DECL
+ if (TREE_CODE (newdecl) == TYPE_DECL
|| TREE_CODE (newdecl) == TEMPLATE_DECL)
return;
-
+
/* Don't get confused by static member functions; that's a different
use of `static'. */
if (TREE_CODE (newdecl) == FUNCTION_DECL
if (TREE_TYPE (newdecl) == error_mark_node
|| TREE_TYPE (olddecl) == error_mark_node)
types_match = 1;
-
+
/* Check for redeclaration and other discrepancies. */
if (TREE_CODE (olddecl) == FUNCTION_DECL
&& DECL_ARTIFICIAL (olddecl))
/* Discard the old built-in function. */
return 0;
}
-
+
if (DECL_THIS_STATIC (newdecl) && !DECL_THIS_STATIC (olddecl))
{
/* If a builtin function is redeclared as `static', merge
cp_error_at ("previous declaration as `%#D'", olddecl);
}
}
- else if (TREE_CODE (newdecl) == FUNCTION_DECL
+ else if (TREE_CODE (newdecl) == FUNCTION_DECL
&& ((DECL_TEMPLATE_SPECIALIZATION (olddecl)
&& (!DECL_TEMPLATE_INFO (newdecl)
- || (DECL_TI_TEMPLATE (newdecl)
+ || (DECL_TI_TEMPLATE (newdecl)
!= DECL_TI_TEMPLATE (olddecl))))
|| (DECL_TEMPLATE_SPECIALIZATION (newdecl)
&& (!DECL_TEMPLATE_INFO (olddecl)
- || (DECL_TI_TEMPLATE (olddecl)
+ || (DECL_TI_TEMPLATE (olddecl)
!= DECL_TI_TEMPLATE (newdecl))))))
/* It's OK to have a template specialization and a non-template
with the same type, or to have specializations of two
specialize one of its methods. This situation is legal, but
the declarations must be merged in the usual way. */
return 0;
- else if (TREE_CODE (newdecl) == FUNCTION_DECL
- && ((DECL_TEMPLATE_INSTANTIATION (olddecl)
+ else if (TREE_CODE (newdecl) == FUNCTION_DECL
+ && ((DECL_TEMPLATE_INSTANTIATION (olddecl)
&& !DECL_USE_TEMPLATE (newdecl))
|| (DECL_TEMPLATE_INSTANTIATION (newdecl)
&& !DECL_USE_TEMPLATE (olddecl))))
if (TREE_CODE (TREE_TYPE (newdecl)) == METHOD_TYPE)
t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2);
-
+
for (; t1 && t1 != void_list_node;
t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2), i++)
if (TREE_PURPOSE (t1) && TREE_PURPOSE (t2))
DECL_NEEDS_FINAL_OVERRIDER_P (newdecl) |= DECL_NEEDS_FINAL_OVERRIDER_P (olddecl);
DECL_THIS_STATIC (newdecl) |= DECL_THIS_STATIC (olddecl);
new_defines_function = DECL_INITIAL (newdecl) != NULL_TREE;
-
+
/* Optionally warn about more than one declaration for the same
name, but don't warn about a function declaration followed by a
definition. */
/* Copy all the DECL_... slots specified in the new decl
except for any that we copy here from the old type. */
- DECL_MACHINE_ATTRIBUTES (newdecl)
+ DECL_MACHINE_ATTRIBUTES (newdecl)
= merge_machine_decl_attributes (olddecl, newdecl);
if (TREE_CODE (newdecl) == TEMPLATE_DECL)
DECL_TEMPLATE_RESULT (olddecl)))
cp_error ("invalid redeclaration of %D", newdecl);
TREE_TYPE (olddecl) = TREE_TYPE (DECL_TEMPLATE_RESULT (olddecl));
- DECL_TEMPLATE_SPECIALIZATIONS (olddecl)
+ DECL_TEMPLATE_SPECIALIZATIONS (olddecl)
= chainon (DECL_TEMPLATE_SPECIALIZATIONS (olddecl),
DECL_TEMPLATE_SPECIALIZATIONS (newdecl));
-
+
return 1;
}
-
+
if (types_match)
{
/* Automatically handles default parameters. */
TREE_STATIC (olddecl) = TREE_STATIC (newdecl) |= TREE_STATIC (olddecl);
if (! DECL_EXTERNAL (olddecl))
DECL_EXTERNAL (newdecl) = 0;
-
+
if (DECL_LANG_SPECIFIC (newdecl) && DECL_LANG_SPECIFIC (olddecl))
{
DECL_INTERFACE_KNOWN (newdecl) |= DECL_INTERFACE_KNOWN (olddecl);
DECL_NOT_REALLY_EXTERN (newdecl) |= DECL_NOT_REALLY_EXTERN (olddecl);
DECL_COMDAT (newdecl) |= DECL_COMDAT (olddecl);
- DECL_TEMPLATE_INSTANTIATED (newdecl)
+ DECL_TEMPLATE_INSTANTIATED (newdecl)
|= DECL_TEMPLATE_INSTANTIATED (olddecl);
/* Don't really know how much of the language-specific
values we should copy from old to new. */
if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
- if (DECL_TEMPLATE_INSTANTIATION (olddecl)
- && !DECL_TEMPLATE_INSTANTIATION (newdecl))
+ if (DECL_TEMPLATE_INSTANTIATION (olddecl)
+ && !DECL_TEMPLATE_INSTANTIATION (newdecl))
{
/* If newdecl is not a specialization, then it is not a
template-related function at all. And that means that we
my_friendly_assert (DECL_TEMPLATE_SPECIALIZATION (newdecl),
0);
- if (TREE_USED (olddecl))
+ if (TREE_USED (olddecl))
/* From [temp.expl.spec]:
-
+
If a template, a member template or the member of a class
template is explicitly specialized then that
specialization shall be declared before the first use of
that specialization that would cause an implicit
instantiation to take place, in every translation unit in
which such a use occurs. */
- cp_error ("explicit specialization of %D after first use",
+ cp_error ("explicit specialization of %D after first use",
olddecl);
SET_DECL_TEMPLATE_SPECIALIZATION (olddecl);
the following sequence of events has occurred:
o A friend function was declared in a class template. The
- class template was instantiated.
+ class template was instantiated.
- o The instantiation of the friend declaration was
- recorded on the instantiation list, and is newdecl.
+ o The instantiation of the friend declaration was
+ recorded on the instantiation list, and is newdecl.
o Later, however, instantiate_class_template called pushdecl
on the newdecl to perform name injection. But, pushdecl in
turn called duplicate_decls when it discovered that another
declaration of a global function with the same name already
- existed.
+ existed.
o Here, in duplicate_decls, we decided to clobber newdecl.
instantiations so that if we try to do the instantiation
again we won't get the clobbered declaration. */
- tree tmpl = DECL_TI_TEMPLATE (newdecl);
- tree decls = DECL_TEMPLATE_SPECIALIZATIONS (tmpl);
+ tree tmpl = DECL_TI_TEMPLATE (newdecl);
+ tree decls = DECL_TEMPLATE_SPECIALIZATIONS (tmpl);
for (; decls; decls = TREE_CHAIN (decls))
if (TREE_VALUE (decls) == newdecl)
/* If this is the declaration for a namespace-scope function,
but the declaration itself is in a local scope, mark the
declaration. */
- if (TREE_CODE (x) == FUNCTION_DECL
+ if (TREE_CODE (x) == FUNCTION_DECL
&& DECL_NAMESPACE_SCOPE_P (x)
&& current_function_decl
&& x != current_function_decl)
#endif
if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
name = TREE_OPERAND (name, 0);
-
+
/* Namespace-scoped variables are not found in the current level. */
if (TREE_CODE (x) == VAR_DECL && DECL_NAMESPACE_SCOPE_P (x))
t = namespace_binding (name, DECL_CONTEXT (x));
else if (DECL_MAIN_P (x))
{
/* A redeclaration of main, but not a duplicate of the
- previous one.
+ previous one.
[basic.start.main]
/* We don't want to copy the type when all we're
doing is making a TYPE_DECL for the purposes of
inlining. */
- && (!TYPE_NAME (type)
+ && (!TYPE_NAME (type)
|| TYPE_NAME (type) != DECL_ABSTRACT_ORIGIN (x)))
{
DECL_ORIGINAL_TYPE (x) = type;
if (type != error_mark_node
&& TYPE_NAME (type)
&& TYPE_IDENTIFIER (type))
- set_identifier_type_value_with_scope (DECL_NAME (x), type,
+ set_identifier_type_value_with_scope (DECL_NAME (x), type,
current_binding_level);
}
We get warnings about inline functions where they are defined.
We get warnings about other functions from push_overloaded_decl.
-
+
Avoid duplicate warnings where they are used. */
if (TREE_PUBLIC (x) && TREE_CODE (x) != FUNCTION_DECL)
{
the mangled name (i.e., NAME) to the DECL. But, for
an `extern "C"' function, the mangled name and the
ordinary name are the same so we need not do this. */
- && !(TREE_CODE (x) == FUNCTION_DECL &&
+ && !(TREE_CODE (x) == FUNCTION_DECL &&
DECL_LANGUAGE (x) == lang_c))
{
if (TREE_CODE (x) == FUNCTION_DECL)
- my_friendly_assert
+ my_friendly_assert
((IDENTIFIER_GLOBAL_VALUE (name) == NULL_TREE)
|| (IDENTIFIER_GLOBAL_VALUE (name) == x), 378);
SET_IDENTIFIER_NAMESPACE_VALUE (name, x);
/* If this is a TYPE_DECL, push it into the type value slot. */
if (TREE_CODE (x) == TYPE_DECL)
- set_identifier_type_value_with_scope (name, TREE_TYPE (x),
+ set_identifier_type_value_with_scope (name, TREE_TYPE (x),
current_binding_level);
/* Clear out any TYPE_DECL shadowed by a namespace so that
we won't think this is a type. The C struct hack doesn't
go through namespaces. */
if (TREE_CODE (x) == NAMESPACE_DECL)
- set_identifier_type_value_with_scope (name, NULL_TREE,
+ set_identifier_type_value_with_scope (name, NULL_TREE,
current_binding_level);
/* If this is an extern function declaration, see if we
warning ("variable `%s' shadows local",
IDENTIFIER_POINTER (name));
cp_warning_at (" this is the shadowed declaration", oldlocal);
- }
+ }
/* Maybe warn if shadowing something else. */
else if (warn_shadow && !DECL_EXTERNAL (x)
/* No shadow warnings for internally generated vars. */
/* RTTI TD entries are created while defining the type_info. */
|| (TYPE_LANG_SPECIFIC (TREE_TYPE (x))
&& TYPE_BEING_DEFINED (TREE_TYPE (x)))))
- current_binding_level->incomplete
+ current_binding_level->incomplete
= tree_cons (NULL_TREE, x, current_binding_level->incomplete);
}
if (need_new_binding)
- add_decl_to_level (x,
+ add_decl_to_level (x,
DECL_NAMESPACE_SCOPE_P (x)
? NAMESPACE_LEVEL (CP_DECL_CONTEXT (x))
: current_binding_level);
/* Add this decl to the current binding level, but not if it comes
from another scope, e.g. a static member variable. TEM may equal
DECL or it may be a previous decl of the same name. */
- if ((TREE_CODE (decl) != PARM_DECL
- && DECL_CONTEXT (decl) != NULL_TREE
+ if ((TREE_CODE (decl) != PARM_DECL
+ && DECL_CONTEXT (decl) != NULL_TREE
/* Definitions of namespace members outside their namespace are
possible. */
&& TREE_CODE (DECL_CONTEXT (decl)) != NAMESPACE_DECL)
tree x;
{
tree binding;
- /* The class_binding_level will be NULL if x is a template
+ /* The class_binding_level will be NULL if x is a template
parameter name in a member template. */
if (!class_binding_level)
return;
class, then we will need to restore IDENTIFIER_CLASS_VALUE when
we leave this class. Record the shadowed declaration here. */
binding = IDENTIFIER_BINDING (name);
- if (binding
+ if (binding
&& ((TREE_CODE (x) == OVERLOAD
&& BINDING_VALUE (binding)
&& is_overloaded_fn (BINDING_VALUE (binding)))
tree name;
{
tree decl;
-
+
my_friendly_assert (TREE_CODE (scope) == NAMESPACE_DECL, 383);
my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 384);
for (decl = current_binding_level->usings; decl; decl = TREE_CHAIN (decl))
{
tree ud = current_binding_level->using_directives;
tree iter, ancestor;
-
+
/* Check if we already have this. */
if (purpose_member (used, ud) != NULL_TREE)
return NULL_TREE;
PUSH_LOCAL: Bind DECL in the current scope, rather than at
namespace scope.
PUSH_USING: DECL is being pushed as the result of a using
- declaration.
+ declaration.
The value returned may be a previous declaration if we guessed wrong
about what language DECL should belong to (C or C++). Otherwise,
else if (is_overloaded_fn (old))
{
tree tmp;
-
+
for (tmp = old; tmp; tmp = OVL_NEXT (tmp))
{
tree fn = OVL_CURRENT (tmp);
TYPE_ARG_TYPES (TREE_TYPE (decl))))
cp_error ("`%#D' conflicts with previous using declaration `%#D'",
decl, fn);
-
+
if (duplicate_decls (decl, fn))
return fn;
}
if (TREE_CODE (new_binding) == OVERLOAD && old)
{
tree *d;
-
+
for (d = &BINDING_LEVEL (IDENTIFIER_BINDING (name))->names;
*d;
d = &TREE_CHAIN (*d))
TREE_VALUE (*d) = new_binding;
else
/* Build a TREE_LIST to wrap the OVERLOAD. */
- *d = tree_cons (NULL_TREE, new_binding,
+ *d = tree_cons (NULL_TREE, new_binding,
TREE_CHAIN (*d));
/* And update the CPLUS_BINDING node. */
be found, create one. (We keep track of used, but undefined,
labels, and complain about them at the end of a function.) */
-tree
+tree
lookup_label (id)
tree id;
{
IDENTIFIER_POINTER (id));
return NULL_TREE;
}
-
+
/* See if we've already got this label. */
decl = IDENTIFIER_LABEL_VALUE (id);
if (decl != NULL_TREE && DECL_CONTEXT (decl) == current_function_decl)
/* Add a new entry to the SHADOWED_LABELS list so that when we leave
this scope we can restore the old value of
IDENTIFIER_TYPE_VALUE. */
- current_binding_level->shadowed_labels
+ current_binding_level->shadowed_labels
= tree_cons (IDENTIFIER_LABEL_VALUE (id), NULL_TREE,
current_binding_level->shadowed_labels);
/* Look for the label. */
decl = make_label_decl (id, /*local_p=*/1);
/* Now fill in the information we didn't have before. */
TREE_VALUE (current_binding_level->shadowed_labels) = decl;
-
+
return decl;
}
if (! switch_stack)
/* Don't crash; we'll complain in do_case. */
return;
-
+
if (cleanup)
{
static int explained = 0;
declaration, then we use the _TYPE node for the
template. See the example below. */
if (thislevel_only && !allow_pseudo_global
- && old && BINDING_VALUE (old)
+ && old && BINDING_VALUE (old)
&& DECL_CLASS_TEMPLATE_P (BINDING_VALUE (old)))
old = TREE_TYPE (BINDING_VALUE (old));
- else
+ else
old = BINDING_TYPE (old);
/* If it has an original type, it is a typedef, and we
if (level->pseudo_global && allow_pseudo_global)
{
/* We must deal with cases like this:
-
+
template <class T> struct S;
template <class T> struct S {};
-
+
When looking up `S', for the second declaration, we
would like to find the first declaration. But, we
are in the pseudo-global level created for the
}
my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 373);
-
+
val = make_node (CPLUS_BINDING);
if (!qualified_lookup_using_namespace (name, namespace, val, 0))
return error_mark_node;
if (template_id)
{
if (DECL_CLASS_TEMPLATE_P (val))
- val = lookup_template_class (val,
+ val = lookup_template_class (val,
TREE_OPERAND (template_id, 1),
/*in_decl=*/NULL_TREE,
/*context=*/NULL_TREE,
/*entering_scope=*/0);
else if (DECL_FUNCTION_TEMPLATE_P (val)
|| TREE_CODE (val) == OVERLOAD)
- val = lookup_template_function (val,
+ val = lookup_template_function (val,
TREE_OPERAND (template_id, 1));
else
{
t2 = (tree) k2;
d1 = TYPE_NAME (t1);
d2 = TYPE_NAME (t2);
-
+
return (DECL_NAME (d1) == DECL_NAME (d2)
&& same_type_p (TYPE_CONTEXT (t1), TYPE_CONTEXT (t2))
- && ((TREE_TYPE (t1) != NULL_TREE)
+ && ((TREE_TYPE (t1) != NULL_TREE)
== (TREE_TYPE (t2) != NULL_TREE))
&& same_type_p (TREE_TYPE (t1), TREE_TYPE (t2))
&& TYPENAME_TYPE_FULLNAME (t1) == TYPENAME_TYPE_FULLNAME (t2));
the type of `T', NAME is the IDENTIFIER_NODE for `t'. If BASE_TYPE
is non-NULL, this type is being created by the implicit typename
extension, and BASE_TYPE is a type named `t' in some base class of
- `T' which depends on template parameters.
+ `T' which depends on template parameters.
Returns the new TYPENAME_TYPE. */
if (!ht.table)
{
static struct hash_table *h = &ht;
- if (!hash_table_init (&ht, &hash_newfunc, &typename_hash,
+ if (!hash_table_init (&ht, &hash_newfunc, &typename_hash,
&typename_compare))
fatal ("virtual memory exhausted");
ggc_add_tree_hash_table_root (&h, 1);
if (TREE_CODE_CLASS (TREE_CODE (name)) == 't')
{
- if (!(TYPE_LANG_SPECIFIC (name)
- && (CLASSTYPE_IS_TEMPLATE (name)
+ if (!(TYPE_LANG_SPECIFIC (name)
+ && (CLASSTYPE_IS_TEMPLATE (name)
|| CLASSTYPE_USE_TEMPLATE (name))))
name = TYPE_IDENTIFIER (name);
else
return error_mark_node;
}
- return lookup_template_class (tmpl,
+ return lookup_template_class (tmpl,
TREE_OPERAND (fullname, 1),
- NULL_TREE, context,
+ NULL_TREE, context,
/*entering_scope=*/0);
}
else
{
tree t;
-
+
if (!IS_AGGR_TYPE (context))
{
if (complain)
cp_error ("no type named `%#T' in `%#T'", name, context);
return error_mark_node;
}
-
-
+
+
return build_typename_type (context, name, fullname, NULL_TREE);
}
return val;
return NULL_TREE;
}
-
+
/* If we could have a type and
we have nothing or we need a type and have none. */
if (BINDING_TYPE (binding)
BINDING_TYPE (b) = BINDING_TYPE (val);
/* Add all _DECLs seen through local using-directives. */
- for (level = current_binding_level;
+ for (level = current_binding_level;
!level->namespace_p;
level = level->level_chain)
if (!lookup_using_namespace (name, b, level->using_directives,
siter = initial;
while (1)
{
- if (!lookup_using_namespace (name, b, DECL_NAMESPACE_USING (siter),
+ if (!lookup_using_namespace (name, b, DECL_NAMESPACE_USING (siter),
scope, flags, spacesp))
/* Give up because of error. */
return error_mark_node;
&& ! (TREE_CODE (binding) == TYPE_DECL
&& same_type_p (TREE_TYPE (binding), subtype)))
{
- cp_warning ("lookup of `%D' finds `%#D'",
+ cp_warning ("lookup of `%D' finds `%#D'",
name, binding);
cp_warning (" instead of `%D' from dependent base class",
typename);
If PREFER_TYPE is > 0, we prefer TYPE_DECLs or namespaces.
If PREFER_TYPE is > 1, we reject non-type decls (e.g. namespaces).
If PREFER_TYPE is -2, we're being called from yylex(). (UGLY)
- Otherwise we prefer non-TYPE_DECLs.
+ Otherwise we prefer non-TYPE_DECLs.
If NONCLASS is non-zero, we don't look for the NAME in class scope,
using IDENTIFIER_CLASS_VALUE. */
type = got_scope;
else if (got_object != error_mark_node)
type = got_object;
-
+
if (type)
{
if (type == error_mark_node)
if (!LOCAL_BINDING_P (t) && nonclass)
/* We're not looking for class-scoped bindings, so keep going. */
continue;
-
+
/* If this is the kind of thing we're looking for, we're done. */
if (qualify_lookup (BINDING_VALUE (t), flags))
binding = BINDING_VALUE (t);
- else if ((flags & LOOKUP_PREFER_TYPES)
+ else if ((flags & LOOKUP_PREFER_TYPES)
&& qualify_lookup (BINDING_TYPE (t), flags))
binding = BINDING_TYPE (t);
else
if (val_is_implicit_typename && !yylex)
warn_about_implicit_typename_lookup (val, binding);
val = binding;
- val_is_implicit_typename
+ val_is_implicit_typename
= IMPLICIT_TYPENAME_TYPE_DECL_P (val);
if (!val_is_implicit_typename)
break;
if (t != NULL_TREE && TREE_CODE (t) == TREE_LIST)
t = TREE_VALUE (t);
}
- else if (IDENTIFIER_BINDING (name)
+ else if (IDENTIFIER_BINDING (name)
&& LOCAL_BINDING_P (IDENTIFIER_BINDING (name)))
{
while (1)
{
if (BINDING_LEVEL (IDENTIFIER_BINDING (name)) == b)
return IDENTIFIER_VALUE (name);
-
+
if (b->keep == 2)
b = b->level_chain;
else
tname = get_identifier (name);
TYPE_BUILT_IN (type) = 1;
-
+
if (tname)
{
tdecl = pushdecl (build_decl (TYPE_DECL, tname, type));
TYPE_SIZE (type) = TYPE_SIZE (void_type_node);
TYPE_ALIGN (type) = 1;
TYPE_MODE (type) = TYPE_MODE (void_type_node);
-}
+}
/* Push overloaded decl, in global scope, with one argument so it
can be used as a callback from define_function. */
/* Create the widest literal types. */
widest_integer_literal_type_node = make_signed_type (HOST_BITS_PER_WIDE_INT * 2);
- pushdecl (build_decl (TYPE_DECL, NULL_TREE,
+ pushdecl (build_decl (TYPE_DECL, NULL_TREE,
widest_integer_literal_type_node));
widest_unsigned_literal_type_node = make_unsigned_type (HOST_BITS_PER_WIDE_INT * 2);
- pushdecl (build_decl (TYPE_DECL, NULL_TREE,
+ pushdecl (build_decl (TYPE_DECL, NULL_TREE,
widest_unsigned_literal_type_node));
/* These are types that type_for_size and type_for_mode use. */
string_type_node = build_pointer_type (char_type_node);
const_string_type_node
- = build_pointer_type (build_qualified_type (char_type_node,
+ = build_pointer_type (build_qualified_type (char_type_node,
TYPE_QUAL_CONST));
empty_except_spec = build_tree_list (NULL_TREE, NULL_TREE);
#if 0
layout_type (vtbl_ptr_type_node);
record_builtin_type (RID_MAX, NULL_PTR, vtbl_ptr_type_node);
- std_node = build_decl (NAMESPACE_DECL,
+ std_node = build_decl (NAMESPACE_DECL,
get_identifier (flag_honor_std ? "fake std":"std"),
void_type_node);
pushdecl (std_node);
}
-/* Wrapper around define_function, for the benefit of
+/* Wrapper around define_function, for the benefit of
c_common_nodes_and_builtins.
FUNCTION_CODE tells later passes how to compile calls to this function.
See tree.h for its possible values. */
decl = grokdeclarator (declarator, declspecs, NORMAL, initialized,
attrlist);
-
+
if (decl == NULL_TREE || TREE_CODE (decl) == VOID_TYPE)
return NULL_TREE;
#ifdef SET_DEFAULT_DECL_ATTRIBUTES
SET_DEFAULT_DECL_ATTRIBUTES (decl, attributes);
#endif
-
+
/* Set attributes here so if duplicate decl, will have proper attributes. */
cplus_decl_attributes (decl, attributes, prefix_attributes);
/* cp_finish_decl sets DECL_EXTERNAL if DECL_IN_AGGR_P is set. */
DECL_IN_AGGR_P (decl) = 0;
- if ((DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl))
+ if ((DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl))
|| CLASSTYPE_USE_TEMPLATE (context))
{
SET_DECL_TEMPLATE_SPECIALIZATION (decl);
data segment. */
DECL_COMMON (tem) = flag_conserve_space || ! TREE_PUBLIC (tem);
#endif
-
+
if (! processing_template_decl)
start_decl_1 (tem);
/* Note: default conversion is only called in very special cases. */
init = default_conversion (init);
}
-
+
/* Convert INIT to the reference type TYPE. This may involve the
creation of a temporary, whose lifetime must be the same as that
of the reference. If so, a DECL_STMT for the temporary will be
/* If we haven't already layed out this declaration, do so now.
Note that we must not call complete type for an external object
because it's type might involve templates that we are not
- supposed to isntantiate yet. (And it's perfectly legal to say
+ supposed to isntantiate yet. (And it's perfectly legal to say
`extern X x' for some incomplete type `X'.) */
if (!DECL_EXTERNAL (decl))
complete_type (type);
}
else
check_for_uninitialized_const_var (decl);
-
+
return init;
}
{
if (current_binding_level->is_for_scope)
{
- struct binding_level *outer
+ struct binding_level *outer
= current_binding_level->level_chain;
/* Check to see if the same name is already bound at the outer
Otherwise, we need to preserve the temp slot for decl to last
into the outer binding level. */
- tree outer_binding
+ tree outer_binding
= TREE_CHAIN (IDENTIFIER_BINDING (DECL_NAME (decl)));
-
+
if (outer_binding && BINDING_LEVEL (outer_binding) == outer
- && (TREE_CODE (BINDING_VALUE (outer_binding))
+ && (TREE_CODE (BINDING_VALUE (outer_binding))
== VAR_DECL)
&& DECL_DEAD_FOR_LOCAL (BINDING_VALUE (outer_binding)))
{
if (DECL_SIZE (decl) && type != error_mark_node)
{
int already_used;
-
+
/* Compute and store the initial value. */
already_used = TREE_USED (decl) || TREE_USED (type);
marked used. (see TREE_USED, above.) */
if (TYPE_NEEDS_CONSTRUCTING (type)
&& ! already_used
- && !TYPE_NEEDS_DESTRUCTOR (type)
+ && !TYPE_NEEDS_DESTRUCTOR (type)
&& DECL_NAME (decl))
TREE_USED (decl) = 0;
else if (already_used)
/* Generate code to destroy DECL (a local variable). */
-static void
+static void
destroy_local_var (decl)
tree decl;
{
/* Only variables get cleaned up. */
if (TREE_CODE (decl) != VAR_DECL)
return;
-
+
/* And only things with destructors need cleaning up. */
if (!TYPE_NEEDS_DESTRUCTOR (type))
return;
translation unit, or that need a static cleanup. The latter
are handled by finish_file. */
return;
-
+
/* Compute the cleanup. */
cleanup = maybe_build_cleanup (decl);
if (DECL_RTL (decl))
/* Only a RESULT_DECL should have non-NULL RTL when arriving here.
All other local variables are assigned RTL in this function. */
- my_friendly_assert (TREE_CODE (decl) == RESULT_DECL,
+ my_friendly_assert (TREE_CODE (decl) == RESULT_DECL,
19990828);
else
{
if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
/* The user must have specified an assembler name for this
variable. Set that up now. */
- rest_of_decl_compilation
+ rest_of_decl_compilation
(decl, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)),
/*top_level=*/0, /*at_end=*/0);
else
/* Handling __FUNCTION__ and its ilk in a template-function requires
some special processing because we are called from
language-independent code. */
- if (cfun && processing_template_decl
+ if (cfun && processing_template_decl
&& current_function_name_declared == 2)
{
/* Since we're in a template function, we need to
retrofit_lang_decl (decl);
decl = push_template_decl (decl);
- if (strcmp (IDENTIFIER_POINTER (DECL_NAME (decl)),
+ if (strcmp (IDENTIFIER_POINTER (DECL_NAME (decl)),
"__PRETTY_FUNCTION__") == 0)
{
init = build (FUNCTION_NAME, const_string_type_node);
&& (DECL_INITIAL (decl) || init))
DECL_DEFINED_IN_CLASS_P (decl) = 1;
- if (TREE_CODE (decl) == VAR_DECL
+ if (TREE_CODE (decl) == VAR_DECL
&& DECL_CONTEXT (decl)
&& TREE_CODE (DECL_CONTEXT (decl)) == NAMESPACE_DECL
&& DECL_CONTEXT (decl) != current_namespace
make_rtl_for_nonlocal_decl (decl, init, asmspec);
- if (TREE_CODE (type) == FUNCTION_TYPE
+ if (TREE_CODE (type) == FUNCTION_TYPE
|| TREE_CODE (type) == METHOD_TYPE)
- abstract_virtuals_error (decl,
+ abstract_virtuals_error (decl,
strip_array_types (TREE_TYPE (type)));
- else
+ else
abstract_virtuals_error (decl, strip_array_types (type));
if (TREE_CODE (decl) == FUNCTION_DECL)
We build up the argument types and then then function type
itself. */
-
+
/* First, build the pointer-to-function type for the first
argument. */
arg_types = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
else
{
/* The declaration for `atexit' is:
-
+
int atexit (void (*)());
We build up the argument types and then then function type
initialization is complete. This ensures that an exception,
thrown during the construction, will cause the variable to
reinitialized when we pass through this code again, as per:
-
+
[stmt.dcl]
If the initialization exits by throwing an exception, the
/* Begin the conditional initialization. */
if_stmt = begin_if_stmt ();
finish_if_stmt_cond (build_binary_op (EQ_EXPR, temp,
- integer_zero_node),
+ integer_zero_node),
if_stmt);
then_clause = begin_compound_stmt (/*has_no_scope=*/0);
if (assignment)
{
assignment = tree_cons (NULL_TREE, assignment,
- build_tree_list (NULL_TREE,
+ build_tree_list (NULL_TREE,
temp_init));
assignment = build_compound_expr (assignment);
}
{
register tree maxindex = NULL_TREE;
int value = 0;
-
+
if (initial_value)
{
/* Note MAXINDEX is really the maximum index,
or `volatile'.
RAISES is a list of exceptions that this function can raise.
CHECK is 1 if we must find this method in CTYPE, 0 if we should
- not look, and -1 if we should not call `grokclassfn' at all.
+ not look, and -1 if we should not call `grokclassfn' at all.
Returns `NULL_TREE' if something goes wrong, after issuing
applicable error messages. */
if (PROCESSING_REAL_TEMPLATE_DECL_P ())
{
/* Something like `template <class T> friend void f<T>()'. */
- cp_error ("template-id `%D' in declaration of primary template",
+ cp_error ("template-id `%D' in declaration of primary template",
orig_declarator);
return NULL_TREE;
}
if (inlinep)
{
- cp_error ("`inline' is not allowed in declaration of friend template specialization `%D'",
+ cp_error ("`inline' is not allowed in declaration of friend template specialization `%D'",
decl);
return NULL_TREE;
}
grokclassfn (ctype, decl, flags, quals);
decl = check_explicit_specialization (orig_declarator, decl,
- template_count,
- 2 * (funcdef_flag != 0) +
+ template_count,
+ 2 * (funcdef_flag != 0) +
4 * (friendp != 0));
if (decl == error_mark_node)
return NULL_TREE;
grokclassfn (ctype, decl, flags, quals);
decl = check_explicit_specialization (orig_declarator, decl,
- template_count,
- 2 * (funcdef_flag != 0) +
+ template_count,
+ 2 * (funcdef_flag != 0) +
4 * (friendp != 0));
if (decl == error_mark_node)
return NULL_TREE;
if (tmp && TREE_CODE (tmp) == TEMPLATE_DECL)
tmp = DECL_TEMPLATE_RESULT (tmp);
-
+
if (tmp && DECL_STATIC_FUNCTION_P (tmp)
&& TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE)
{
else
context = NULL_TREE;
- if (processing_template_decl)
+ if (processing_template_decl)
/* If we're in a template, we need DECL_LANG_SPECIFIC so that
we can call push_template_decl. */
decl = build_lang_decl (VAR_DECL, declarator, type);
/* Make sure that we always have the unqualified pointer-to-member
type first. */
if (CP_TYPE_QUALS (type) != TYPE_UNQUALIFIED)
- unqualified_variant
+ unqualified_variant
= build_ptrmemfunc_type (TYPE_MAIN_VARIANT (type));
u = make_aggr_type (UNION_TYPE);
required. */
if (CLASS_TYPE_P (type) || TREE_CODE (type) == REFERENCE_TYPE)
{
- cp_error ("in-class initialization of static data member of non-integral type `%T'",
+ cp_error ("in-class initialization of static data member of non-integral type `%T'",
type);
/* If we just return the declaration, crashes will sometimes
occur. We therefore return void_type_node, as if this was a
size = integer_one_node;
}
/* Except that an extension we allow zero-sized arrays. We
- always allow them in system headers because glibc uses
+ always allow them in system headers because glibc uses
them. */
else if (integer_zerop (size) && pedantic && !in_system_header)
{
cp_convert (ssizetype, size),
cp_convert (ssizetype,
integer_one_node)));
-
+
/* Check for variable-sized arrays. We allow such things as an
extension, even though they are not allowed in ANSI/ISO C++. */
if (!TREE_CONSTANT (itype))
error ("overflow in array dimension");
TREE_OVERFLOW (itype) = 0;
}
-
+
/* Create and return the appropriate index type. */
return build_index_type (itype);
}
}
/* [dcl.array]
-
+
The constant expressions that specify the bounds of the arrays
can be omitted only for the first member of the sequence. */
if (TREE_CODE (type) == ARRAY_TYPE && !TYPE_DOMAIN (type))
}
ctype = NULL_TREE;
break;
-
+
case TEMPLATE_ID_EXPR:
{
tree fns = TREE_OPERAND (decl, 0);
if (name == NULL)
name = decl_context == PARM ? "parameter" : "type name";
-
+
/* Look through the decl specs and record which ones appear.
Some typespecs are defined as built-in typenames.
Others, the ones that are modifiers of other types,
&& TYPE_MAIN_VARIANT (type) == double_type_node)
{
RIDBIT_RESET (RID_LONG, specbits);
- type = build_qualified_type (long_double_type_node,
+ type = build_qualified_type (long_double_type_node,
CP_TYPE_QUALS (type));
}
It is implementation-defined whether a plain (neither
explicitly signed or unsigned) char, short, int, or long
bit-field is signed or unsigned.
-
+
Naturally, we extend this to long long as well. Note that
this does not include wchar_t. */
|| (bitfield && !flag_signed_bitfields
/* A typedef for plain `int' without `signed' can be
controlled just like plain `int', but a typedef for
`signed int' cannot be so controlled. */
- && !(typedef_decl
+ && !(typedef_decl
&& C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl))
&& (TREE_CODE (type) == INTEGER_TYPE
|| TREE_CODE (type) == CHAR_TYPE)
type = build_complex_type (type);
}
- if (return_type == return_conversion
+ if (return_type == return_conversion
&& (RIDBIT_SETP (RID_CONST, specbits)
|| RIDBIT_SETP (RID_VOLATILE, specbits)
|| RIDBIT_SETP (RID_RESTRICT, specbits)))
Likewise for VOLATILEP. */
constp = !! RIDBIT_SETP (RID_CONST, specbits) + CP_TYPE_CONST_P (type);
- restrictp =
+ restrictp =
!! RIDBIT_SETP (RID_RESTRICT, specbits) + CP_TYPE_RESTRICT_P (type);
- volatilep =
+ volatilep =
!! RIDBIT_SETP (RID_VOLATILE, specbits) + CP_TYPE_VOLATILE_P (type);
type_quals = ((constp ? TYPE_QUAL_CONST : 0)
| (restrictp ? TYPE_QUAL_RESTRICT : 0)
if (declarator)
{
- /* Avoid trying to get an operand off an identifier node. */
+ /* Avoid trying to get an operand off an identifier node. */
if (TREE_CODE (declarator) == IDENTIFIER_NODE)
tmp = declarator;
else
the declared identifier (or NULL_TREE, in an absolute declarator). */
inner_attrs = NULL_TREE;
- ignore_attrs = 0;
+ ignore_attrs = 0;
while (declarator && TREE_CODE (declarator) != IDENTIFIER_NODE
&& TREE_CODE (declarator) != TEMPLATE_ID_EXPR)
if (inner_decl && TREE_CODE (inner_decl) == SCOPE_REF)
inner_decl = TREE_OPERAND (inner_decl, 1);
- if (inner_decl && TREE_CODE (inner_decl) == TEMPLATE_ID_EXPR)
+ if (inner_decl && TREE_CODE (inner_decl) == TEMPLATE_ID_EXPR)
inner_decl = dname;
/* Pick up type qualifiers which should be applied to `this'. */
/* Say it's a definition only for the CALL_EXPR
closest to the identifier. */
funcdecl_p
- = inner_decl
+ = inner_decl
&& (TREE_CODE (inner_decl) == IDENTIFIER_NODE
- || TREE_CODE (inner_decl) == TEMPLATE_ID_EXPR
+ || TREE_CODE (inner_decl) == TEMPLATE_ID_EXPR
|| TREE_CODE (inner_decl) == BIT_NOT_EXPR);
-
+
if (ctype == NULL_TREE
&& decl_context == FIELD
&& funcdecl_p
want the underlying IDENTIFIER. */
if (TREE_CODE (declarator) == BIT_NOT_EXPR)
declarator = TREE_OPERAND (declarator, 0);
-
+
if (strict_prototype == 0 && arg_types == NULL_TREE)
arg_types = void_list_node;
else if (arg_types == NULL_TREE
ctype = TREE_OPERAND (declarator, 0);
t = ctype;
- while (t != NULL_TREE && CLASS_TYPE_P (t))
+ while (t != NULL_TREE && CLASS_TYPE_P (t))
{
if (CLASSTYPE_TEMPLATE_INFO (t) &&
!CLASSTYPE_TEMPLATE_SPECIALIZATION (t))
type is a (non-primary) template. The name for the
template needs updating as well. */
if (TYPE_LANG_SPECIFIC (type) && CLASSTYPE_TEMPLATE_INFO (type))
- DECL_NAME (CLASSTYPE_TI_TEMPLATE (type))
+ DECL_NAME (CLASSTYPE_TI_TEMPLATE (type))
= TYPE_IDENTIFIER (type);
- /* XXX Temporarily set the scope.
+ /* XXX Temporarily set the scope.
When returning, start_decl expects it as NULL_TREE,
and will then then set it using pushdecl. */
my_friendly_assert (DECL_CONTEXT (decl) == NULL_TREE, 980404);
return NULL_TREE;
}
}
-
+
{
register tree decl;
}
/* Tell grokfndecl if it needs to set TREE_PUBLIC on the node. */
- function_context = (ctype != NULL_TREE) ?
+ function_context = (ctype != NULL_TREE) ?
hack_decl_function_context (TYPE_MAIN_DECL (ctype)) : NULL_TREE;
publicp = (! friendp || ! staticp)
&& function_context == NULL_TREE;
- decl = grokfndecl (ctype, type,
+ decl = grokfndecl (ctype, type,
TREE_CODE (declarator) != TEMPLATE_ID_EXPR
? declarator : dname,
declarator,
We don't look at the first parameter, which is
really just the `this' parameter for the new
object. */
- tree arg_types =
+ tree arg_types =
TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (decl)));
/* Skip the `in_chrg' argument too, if present. */
arg_types = TREE_CHAIN (arg_types);
if (arg_types == void_list_node
- || (arg_types
- && TREE_CHAIN (arg_types)
+ || (arg_types
+ && TREE_CHAIN (arg_types)
&& TREE_CHAIN (arg_types) != void_list_node
&& !TREE_PURPOSE (TREE_CHAIN (arg_types))))
DECL_NONCONVERTING_P (decl) = 1;
{
if (template_class_depth (current_class_type) == 0)
{
- decl
- = check_explicit_specialization
+ decl
+ = check_explicit_specialization
(declarator, decl,
template_count, 2 * (funcdef_flag != 0) + 4);
if (decl == error_mark_node)
}
if (t && funcdef_flag)
return t;
-
+
return void_type_node;
}
}
{
/* An attempt is being made to initialize a non-static
member. But, from [class.mem]:
-
+
4 A member-declarator can contain a
constant-initializer only if it declares a static
member (_class.static_) of integral or enumeration
- type, see _class.static.data_.
+ type, see _class.static.data_.
This used to be relatively common practice, but
the rest of the compiler does not correctly
else
pedwarn ("storage class `inline' invalid for function `%s' declared out of global scope", name);
}
-
+
if (ctype == NULL_TREE)
{
if (virtualp)
decl = grokfndecl (ctype, type, original_name, declarator,
virtualp, flags, quals, raises,
1, friendp,
- publicp, inlinep, funcdef_flag,
+ publicp, inlinep, funcdef_flag,
template_count, in_namespace);
if (decl == NULL_TREE)
return NULL_TREE;
/* It's a variable. */
/* An uninitialized decl with `extern' is a reference. */
- decl = grokvardecl (type, declarator, &specbits,
- initialized,
- (type_quals & TYPE_QUAL_CONST) != 0,
+ decl = grokvardecl (type, declarator, &specbits,
+ initialized,
+ (type_quals & TYPE_QUAL_CONST) != 0,
in_namespace);
bad_specifiers (decl, "variable", virtualp, quals != NULL_TREE,
inlinep, friendp, raises != NULL_TREE);
local_variable_p (t)
tree t;
{
- if ((TREE_CODE (t) == VAR_DECL
+ if ((TREE_CODE (t) == VAR_DECL
/* A VAR_DECL with a context that is a _TYPE is a static data
member. */
&& !TYPE_P (CP_DECL_CONTEXT (t))
int *walk_subtrees ATTRIBUTE_UNUSED;
void *data ATTRIBUTE_UNUSED;
{
- return ((local_variable_p (*tp) && !DECL_ARTIFICIAL (*tp))
+ return ((local_variable_p (*tp) && !DECL_ARTIFICIAL (*tp))
? *tp : NULL_TREE);
}
else
decl_type = TREE_TYPE (decl);
- if (arg == error_mark_node
+ if (arg == error_mark_node
|| decl == error_mark_node
|| TREE_TYPE (arg) == error_mark_node
|| decl_type == error_mark_node)
return error_mark_node;
/* [dcl.fct.default]
-
+
A default argument expression is implicitly converted to the
parameter type. */
if (!TREE_TYPE (arg)
|| !can_convert_arg (decl_type, TREE_TYPE (arg), arg))
{
if (decl)
- cp_error ("default argument for `%#D' has type `%T'",
+ cp_error ("default argument for `%#D' has type `%T'",
decl, TREE_TYPE (arg));
else
cp_error ("default argument for parameter of type `%T' has type `%T'",
/* [dcl.fct.default]
Local variables shall not be used in default argument
- expressions.
+ expressions.
The keyword `this' shall not be used in a default argument of a
member function. */
chain = TREE_CHAIN (parm);
/* @@ weak defense against parse errors. */
- if (TREE_CODE (decl) != VOID_TYPE
+ if (TREE_CODE (decl) != VOID_TYPE
&& TREE_CODE (decl) != TREE_LIST)
{
/* Give various messages as the need arises. */
A declaration of a constructor for a class X is ill-formed if its
first parameter is of type (optionally cv-qualified) X and either
there are no other parameters or else all other parameters have
- default arguments.
+ default arguments.
We *don't* complain about member template instantiations that
have this form, though; they can occur as we try to decide what
doesn't look at the class declaration to find out if it's static. */
if (methodp)
revert_static_member_fn (&decl, NULL, NULL);
-
+
/* Take care of function decl if we had syntax errors. */
if (argtypes == NULL_TREE)
TREE_TYPE (decl)
{
if (methodp)
revert_static_member_fn (&decl, NULL, NULL);
-
+
if (argtypes == NULL_TREE)
TREE_TYPE (decl)
= build_function_type (void_type_node,
;
}
}
-
+
if (name == ansi_opname[(int) CALL_EXPR])
return; /* No restrictions on args. */
{
/* 13.4.0.3 */
cp_error ("ANSI C++ prohibits overloading operator ?:");
- }
+ }
else if (ambi_op_p (name))
{
if (list_length (argtypes) == 2)
}
else
ref = lookup_tag (code, name, b, 0);
-
+
if (! ref)
{
/* Try finding it as a type declaration. If that wins,
- use it. */
+ use it. */
ref = lookup_name (name, 1);
if (ref != NULL_TREE
ref = NULL_TREE;
}
- if (ref && current_class_type
- && template_class_depth (current_class_type)
- && PROCESSING_REAL_TEMPLATE_DECL_P ())
+ if (ref && current_class_type
+ && template_class_depth (current_class_type)
+ && PROCESSING_REAL_TEMPLATE_DECL_P ())
{
/* Since GLOBALIZE is non-zero, we are not looking at a
definition of this tag. Since, in addition, we are currently
else
{
/* If it no longer looks like a nested type, make sure it's
- in global scope.
+ in global scope.
If it is not an IDENTIFIER, this is not a declaration */
if (b->namespace_p && !class_binding_level
&& TREE_CODE (name) == IDENTIFIER_NODE
}
if (TYPE_FOR_JAVA (basetype)
- && (current_lang_stack
+ && (current_lang_stack
== &VARRAY_TREE (current_lang_base, 0)))
TYPE_FOR_JAVA (ref) = 1;
derived classes. (Each BINFO record describing an
individual inheritance contains flags which say what
the `accessibility' of that particular inheritance is.) */
-
- base_binfo
+
+ base_binfo
= make_binfo (integer_zero_node, basetype,
CLASS_TYPE_P (basetype)
? TYPE_BINFO_VTABLE (basetype) : NULL_TREE,
CLASS_TYPE_P (basetype)
? TYPE_BINFO_VIRTUALS (basetype) : NULL_TREE);
-
+
TREE_VEC_ELT (binfos, i) = base_binfo;
TREE_VIA_PUBLIC (base_binfo) = via_public;
TREE_VIA_PROTECTED (base_binfo) = via_protected;
TYPE_GETS_NEW (ref) |= TYPE_GETS_NEW (basetype);
TYPE_GETS_DELETE (ref) |= TYPE_GETS_DELETE (basetype);
/* If the base-class uses multiple inheritance, so do we. */
- TYPE_USES_MULTIPLE_INHERITANCE (ref)
+ TYPE_USES_MULTIPLE_INHERITANCE (ref)
|= TYPE_USES_MULTIPLE_INHERITANCE (basetype);
/* Likewise, if converting to a base of the base may require
code, then we may need to generate code to convert to a
base as well. */
- TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (ref)
+ TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (ref)
|= TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (basetype);
}
bases. */
get_vbase_types (ref);
}
-
+
\f
/* Begin compiling the definition of an enumeration type.
NAME is its name (or null if anonymous).
reason to do that when processing_template_decl.
And, if the expression is something like a
TEMPLATE_PARM_INDEX or a CAST_EXPR doing so will
- wreak havoc on the intended type of the expression.
+ wreak havoc on the intended type of the expression.
Of course, there's also no point in trying to compute
minimum or maximum values if we're in a template. */
minnode = value;
}
- if (processing_template_decl)
+ if (processing_template_decl)
/* If this is just a template, leave the CONST_DECL
alone. That way tsubst_copy will find CONST_DECLs for
CONST_DECLs, and not INTEGER_CSTs. */
if (flag_short_enums || (precision > TYPE_PRECISION (integer_type_node)))
/* Use the width of the narrowest normal C type which is wide
- enough. */
+ enough. */
TYPE_PRECISION (enumtype) = TYPE_PRECISION (type_for_size
(precision, 1));
else
TYPE_SIZE (enumtype) = 0;
layout_type (enumtype);
-
+
/* Fix up all variant types of this enum type. */
for (tem = TYPE_MAIN_VARIANT (enumtype); tem;
tem = TYPE_NEXT_VARIANT (tem))
prev_value,
integer_one_node,
PLUS_EXPR);
-
+
if (tree_int_cst_lt (value, prev_value))
cp_error ("overflow in enumeration values at `%D'", name);
}
TREE_TYPE (decl)
= build_function_type (void_type_node,
TYPE_ARG_TYPES (TREE_TYPE (decl)));
- TREE_TYPE (decl)
+ TREE_TYPE (decl)
= build_exception_variant (fntype,
TYPE_RAISES_EXCEPTIONS (fntype));
}
process and that DECLSPECS should be ignored), SF_INCLASS_INLINE
indicating that the function is an inline defined in-class, and
SF_EXPAND indicating that we should generate RTL for this
- function.
-
+ function.
+
This function creates a binding context for the function body
as well as setting up the FUNCTION_DECL in current_function_decl.
}
}
}
-
+
/* Sometimes we don't notice that a function is a static member, and
build a METHOD_TYPE for it. Fix that up now. */
if (ctype != NULL_TREE && DECL_STATIC_FUNCTION_P (decl1)
#ifdef SET_DEFAULT_DECL_ATTRIBUTES
SET_DEFAULT_DECL_ATTRIBUTES (decl1, attrs);
#endif
-
+
/* This function exists in static storage.
(This does not mean `static' in the C sense!) */
TREE_STATIC (decl1) = 1;
{
DECL_RESULT (decl1)
= build_decl (RESULT_DECL, 0, TYPE_MAIN_VARIANT (restype));
- c_apply_type_quals_to_decl (CP_TYPE_QUALS (restype),
- DECL_RESULT (decl1));
+ c_apply_type_quals_to_decl (CP_TYPE_QUALS (restype),
+ DECL_RESULT (decl1));
}
}
else
if (!processing_template_decl && !(flags & SF_PRE_PARSED))
{
/* A specialization is not used to guide overload resolution. */
- if ((flag_guiding_decls
+ if ((flag_guiding_decls
|| !DECL_TEMPLATE_SPECIALIZATION (decl1))
&& ! DECL_FUNCTION_MEMBER_P (decl1))
decl1 = pushdecl (decl1);
never get us to that point. Here we keep the consistency
between `current_class_type' and `current_class_ptr'. */
tree t = DECL_ARGUMENTS (decl1);
-
- my_friendly_assert (t != NULL_TREE && TREE_CODE (t) == PARM_DECL,
+
+ my_friendly_assert (t != NULL_TREE && TREE_CODE (t) == PARM_DECL,
162);
my_friendly_assert (TREE_CODE (TREE_TYPE (t)) == POINTER_TYPE,
19990811);
-
- cp_function_chain->x_current_class_ref
+
+ cp_function_chain->x_current_class_ref
= build_indirect_ref (t, NULL_PTR);
cp_function_chain->x_current_class_ptr = t;
if (DECL_NOT_REALLY_EXTERN (decl1))
DECL_EXTERNAL (decl1) = 0;
- if (ctx != NULL_TREE && DECL_THIS_INLINE (ctx)
+ if (ctx != NULL_TREE && DECL_THIS_INLINE (ctx)
&& TREE_PUBLIC (ctx))
/* This is a function in a local class in an extern inline
function. */
if (attrs)
cplus_decl_attributes (decl1, NULL_TREE, attrs);
-
+
if (!building_stmt_tree ())
{
GNU_xref_function (decl1, current_function_parms);
if (doing_semantic_analysis_p ())
{
tree cleanup;
-
+
if (DECL_NAME (parm) == NULL_TREE
|| TREE_CODE (parm) != VOID_TYPE)
pushdecl (parm);
cp_error ("parameter `%D' declared void", parm);
cleanup = maybe_build_cleanup (parm);
-
+
if (cleanup)
cleanups = tree_cons (parm, cleanup, cleanups);
}
should not be called before the parm can be used. */
while (cleanups)
{
- finish_decl_cleanup (TREE_PURPOSE (cleanups),
+ finish_decl_cleanup (TREE_PURPOSE (cleanups),
TREE_VALUE (cleanups));
cleanups = TREE_CHAIN (cleanups);
}
}
/* Do the starting of the exception specifications, if we have any. */
- if (flag_exceptions && !processing_template_decl
- && building_stmt_tree ()
+ if (flag_exceptions && !processing_template_decl
+ && building_stmt_tree ()
&& TYPE_RAISES_EXCEPTIONS (TREE_TYPE (current_function_decl)))
current_eh_spec_try_block = expand_start_eh_spec ();
}
get it back when we really expand this function. */
my_friendly_assert (!DECL_PENDING_INLINE_P (decl),
19990908);
-
+
/* Make a copy. */
- f = ((struct language_function *)
+ f = ((struct language_function *)
xmalloc (sizeof (struct language_function)));
bcopy ((char *) cp_function_chain, (char *) f,
sizeof (struct language_function));
in_charge = current_in_charge_parm;
exprstmt = build_delete (current_class_type,
- current_class_ref,
+ current_class_ref,
in_charge,
- LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR|LOOKUP_NORMAL,
+ LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR|LOOKUP_NORMAL,
0);
if (exprstmt != error_mark_node
tree vbases = nreverse (copy_list (CLASSTYPE_VBASECLASSES (current_class_type)));
tree if_stmt = begin_if_stmt ();
finish_if_stmt_cond (build (BIT_AND_EXPR, integer_type_node,
- current_in_charge_parm,
+ current_in_charge_parm,
integer_two_node),
if_stmt);
finish_if_stmt ();
}
}
-
+
virtual_size = c_sizeof (current_class_type);
/* At the end, call delete if that's what's requested. */
-
+
/* FDIS sez: At the point of definition of a virtual destructor
(including 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.
-
+
This is somewhat unclear, but I take it to mean that if the class
only defines placement deletes we don't do anything here. So we
pass LOOKUP_SPECULATIVELY; delete_sanity will complain for us if
This is called after parsing the body of the function definition.
LINENO is the current line number.
- FLAGS is a bitwise or of the following values:
- 1 - CALL_POPLEVEL
+ FLAGS is a bitwise or of the following values:
+ 1 - CALL_POPLEVEL
An extra call to poplevel (and expand_end_bindings) must be
made to take care of the binding contour for the base
initializers. This is only relevant for constructors.
/* Finish dealing with exception specifiers. */
if (flag_exceptions && !processing_template_decl
&& TYPE_RAISES_EXCEPTIONS (TREE_TYPE (current_function_decl)))
- expand_end_eh_spec (TYPE_RAISES_EXCEPTIONS
+ expand_end_eh_spec (TYPE_RAISES_EXCEPTIONS
(TREE_TYPE (current_function_decl)),
current_eh_spec_try_block);
}
/* If this function is supposed to return a value, ensure that
we do not fall into the cleanups by mistake. The end of our
function will look like this:
-
+
user code (may have return stmt somewhere)
goto no_return_label
cleanup_label:
NOTE_INSN_FUNCTION_END
return_label:
things for return
-
+
If the user omits a return stmt in the USER CODE section, we
will have a control path which reaches NOTE_INSN_FUNCTION_END.
Otherwise, we won't. */
maybe_end_member_template_processing decides to pop all the
template parameters. */
expand_p = !building_stmt_tree ();
-
+
/* If we're saving up tree structure, tie off the function now. */
if (!expand_p)
finish_stmt_tree (&DECL_SAVED_TREE (fndecl));
{
if (IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (fndecl)) != current_class_type)
{
- if (DECL_CONTEXT (fndecl)
+ if (DECL_CONTEXT (fndecl)
&& TREE_CODE( DECL_CONTEXT (fndecl)) != NAMESPACE_DECL)
cp_error ("`%D' is already defined in class %s", fndecl,
TYPE_NAME_STRING (DECL_CONTEXT (fndecl)));
/* Make a place for the parms */
pushlevel (0);
current_binding_level->parm_flag = 1;
-
+
DECL_IN_AGGR_P (fndecl) = 1;
return fndecl;
}
{
if (stmts_are_full_exprs_p)
exp = convert_to_void (exp, "statement");
-
+
#if 0
/* We should do this eventually, but right now this causes regex.o from
libg++ to miscompile, and tString to core dump. */
tree function = fn ? *fn : TREE_TYPE (*decl);
tree args = argtypes ? *argtypes : TYPE_ARG_TYPES (function);
- if (CP_TYPE_QUALS (TREE_TYPE (TREE_VALUE (args)))
+ if (CP_TYPE_QUALS (TREE_TYPE (TREE_VALUE (args)))
!= TYPE_UNQUALIFIED)
- cp_error ("static member function `%#D' declared with type qualifiers",
+ cp_error ("static member function `%#D' declared with type qualifiers",
*decl);
args = TREE_CHAIN (args);
*argtypes = args;
}
-/* Initialize the variables used during compilation of a C++
- function. */
+/* Initialize the variables used during compilation of a C++
+ function. */
static void
push_cp_function_context (f)
struct function *f;
{
- struct language_function *p
- = ((struct language_function *)
+ struct language_function *p
+ = ((struct language_function *)
xcalloc (1, sizeof (struct language_function)));
f->language = p;
{
struct lang_type *lt = TYPE_LANG_SPECIFIC (t);
- if (lt && !(TREE_CODE (t) == POINTER_TYPE
+ if (lt && !(TREE_CODE (t) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (t)) == METHOD_TYPE))
{
ggc_mark (lt);
ggc_mark_tree ((tree) lt);
}
}
-