static tree grokfndecl (tree, tree, tree, tree, tree, int,
enum overload_flags, cp_cv_quals,
tree, int, int, int, int, int, int, tree);
-static tree grokvardecl (tree, tree, const cp_decl_specifier_seq *,
+static tree grokvardecl (tree, tree, const cp_decl_specifier_seq *,
int, int, tree);
static void record_unknown_type (tree, const char *);
static tree builtin_function_1 (const char *, tree, tree, int,
static void end_cleanup_fn (void);
static tree cp_make_fname_decl (tree, int);
static void initialize_predefined_identifiers (void);
-static tree check_special_function_return_type
+static tree check_special_function_return_type
(special_function_kind, tree, tree);
static tree push_cp_library_fn (enum tree_code, tree);
static tree build_cp_library_fn (tree, enum tree_code, tree);
with __attribute__((deprecated)). An object declared as
__attribute__((deprecated)) suppresses warnings of uses of other
deprecated items. */
-
+
enum deprecated_states {
DEPRECATED_NORMAL,
DEPRECATED_SUPPRESS
struct cp_binding_level *b;
/* Scan through the template parameter scopes. */
- for (b = current_binding_level;
- b->kind == sk_template_parms;
+ for (b = current_binding_level;
+ b->kind == sk_template_parms;
b = b->level_chain)
{
/* If we see a specialization scope inside a parameter scope,
? ((functionbody = 0), tmp) : functionbody);
subblocks = functionbody >= 0 ? current_binding_level->blocks : 0;
- my_friendly_assert (VEC_length(cp_class_binding,
+ my_friendly_assert (VEC_length(cp_class_binding,
current_binding_level->class_shadowed) == 0,
19990414);
else
decls = current_binding_level->names;
- /* When not in function-at-a-time mode, expand_end_bindings will
- warn about unused variables. But, in function-at-a-time mode
- expand_end_bindings is not passed the list of variables in the
- current scope, and therefore no warning is emitted. So, we
- explicitly warn here. */
- if (!processing_template_decl)
- warn_about_unused_variables (getdecls ());
-
/* If there were any declarations or structure tags in that level,
or if this level is a function body,
create a BLOCK to record them for the life of this function. */
leaving_for_scope
= current_binding_level->kind == sk_for && flag_new_for_scope == 1;
+ /* Before we remove the declarations first check for unused variables. */
+ if (warn_unused_variable
+ && !processing_template_decl)
+ for (decl = getdecls (); decl; decl = TREE_CHAIN (decl))
+ if (TREE_CODE (decl) == VAR_DECL
+ && ! TREE_USED (decl)
+ && ! DECL_IN_SYSTEM_HEADER (decl)
+ && DECL_NAME (decl) && ! DECL_ARTIFICIAL (decl))
+ warning ("%Junused variable '%D'", decl, decl);
+
/* Remove declarations for all the DECLs in this level. */
for (link = decls; link; link = TREE_CHAIN (link))
{
/* Although we don't pop the cxx_binding, we do clear
its SCOPE since the scope is going away now. */
- IDENTIFIER_BINDING (name)->scope
+ IDENTIFIER_BINDING (name)->scope
= current_binding_level->level_chain;
}
}
{
/* Remove the binding. */
decl = link;
+
if (TREE_CODE (decl) == TREE_LIST)
decl = TREE_VALUE (decl);
+
if (DECL_P (decl))
pop_binding (DECL_NAME (decl), decl);
else if (TREE_CODE (decl) == OVERLOAD)
returns a nonzero value, return a nonzero value. */
bool
walk_vtables (walk_globals_pred p, walk_globals_fn f, void *data)
-{
+{
struct walk_globals_data wgd;
- wgd.p = p;
+ wgd.p = p;
wgd.f = f;
wgd.data = data;
walk_namespaces_r (tree namespace, walk_namespaces_fn f, void* data)
{
int result = 0;
- tree current = NAMESPACE_LEVEL (namespace)->namespaces;
+ tree current = NAMESPACE_LEVEL (namespace)->namespaces;
result |= (*f) (namespace, data);
In a declarative region, a namespace-alias-definition can be
used to redefine a namespace-alias declared in that declarative
region to refer only to the namespace to which it already
- refers.
+ refers.
Therefore, if we encounter a second alias directive for the same
alias, we can just ignore the second directive. */
}
}
- if (DECL_DECLARED_INLINE_P (newdecl)
+ if (DECL_DECLARED_INLINE_P (newdecl)
&& ! DECL_DECLARED_INLINE_P (olddecl)
&& TREE_ADDRESSABLE (olddecl) && warn_inline)
{
if (DECL_INITIAL (DECL_TEMPLATE_RESULT (olddecl)) == NULL_TREE
&& DECL_INITIAL (DECL_TEMPLATE_RESULT (newdecl)) != NULL_TREE)
{
- DECL_SOURCE_LOCATION (olddecl)
+ DECL_SOURCE_LOCATION (olddecl)
= DECL_SOURCE_LOCATION (DECL_TEMPLATE_RESULT (olddecl))
= DECL_SOURCE_LOCATION (newdecl);
if (DECL_FUNCTION_TEMPLATE_P (newdecl))
if (DECL_FUNCTION_TEMPLATE_P (newdecl))
{
- DECL_INLINE (DECL_TEMPLATE_RESULT (olddecl))
+ DECL_INLINE (DECL_TEMPLATE_RESULT (olddecl))
|= DECL_INLINE (DECL_TEMPLATE_RESULT (newdecl));
DECL_DECLARED_INLINE_P (DECL_TEMPLATE_RESULT (olddecl))
|= DECL_DECLARED_INLINE_P (DECL_TEMPLATE_RESULT (newdecl));
/* Keep the old RTL. */
COPY_DECL_RTL (olddecl, newdecl);
}
- else if (TREE_CODE (newdecl) == VAR_DECL
+ else if (TREE_CODE (newdecl) == VAR_DECL
&& (DECL_SIZE (olddecl) || !DECL_SIZE (newdecl)))
{
/* Keep the old RTL. We cannot keep the old RTL if the old
/* Don't really know how much of the language-specific
values we should copy from old to new. */
DECL_IN_AGGR_P (newdecl) = DECL_IN_AGGR_P (olddecl);
- DECL_LANG_SPECIFIC (newdecl)->decl_flags.u2 =
+ DECL_LANG_SPECIFIC (newdecl)->decl_flags.u2 =
DECL_LANG_SPECIFIC (olddecl)->decl_flags.u2;
DECL_NONCONVERTING_P (newdecl) = DECL_NONCONVERTING_P (olddecl);
DECL_TEMPLATE_INFO (newdecl) = DECL_TEMPLATE_INFO (olddecl);
DECL_DECLARED_INLINE_P (newdecl) |= DECL_DECLARED_INLINE_P (olddecl);
- /* If either decl says `inline', this fn is inline, unless
+ /* If either decl says `inline', this fn is inline, unless
its definition was passed already. */
if (DECL_INLINE (newdecl) && DECL_INITIAL (olddecl) == NULL_TREE)
DECL_INLINE (olddecl) = 1;
olddecl, and not newdecl, is on the list of
instantiations so that if we try to do the instantiation
again we won't get the clobbered declaration. */
- reregister_specialization (newdecl,
- DECL_TI_TEMPLATE (newdecl),
+ reregister_specialization (newdecl,
+ DECL_TI_TEMPLATE (newdecl),
olddecl);
}
else
/* If OLDDECL had its DECL_RTL instantiated, re-invoke make_decl_rtl
so that encode_section_info has a chance to look at the new decl
flags and attributes. */
- if (DECL_RTL_SET_P (olddecl)
+ if (DECL_RTL_SET_P (olddecl)
&& (TREE_CODE (olddecl) == FUNCTION_DECL
|| (TREE_CODE (olddecl) == VAR_DECL
&& TREE_STATIC (olddecl))))
}
if (TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) != FUNCTION_DECL
- || (DECL_TEMPLATE_RESULT (newdecl)
+ || (DECL_TEMPLATE_RESULT (newdecl)
== DECL_TEMPLATE_RESULT (olddecl)))
return NULL;
/* After labels, make any new cleanups in the function go into their
own new (temporary) binding contour. */
- for (p = current_binding_level;
- p->kind != sk_function_parms;
+ for (p = current_binding_level;
+ p->kind != sk_function_parms;
p = p->level_chain)
p->more_cleanups_ok = 0;
/* After labels, make any new cleanups in the function go into their
own new (temporary) binding contour. */
- for (p = current_binding_level;
- p->kind != sk_function_parms;
+ for (p = current_binding_level;
+ p->kind != sk_function_parms;
p = p->level_chain)
p->more_cleanups_ok = 0;
if (typename_htab == NULL)
{
- typename_htab = htab_create_ggc (61, &typename_hash,
+ typename_htab = htab_create_ggc (61, &typename_hash,
&typename_compare, NULL);
}
return error_mark_node;
}
my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 20030802);
-
+
if (TREE_CODE (context) == NAMESPACE_DECL)
{
/* We can get here from typename_sub0 in the explicit_template_type
if (DECL_ARTIFICIAL (t) || !(complain & tf_keep_type_decl))
t = TREE_TYPE (t);
-
+
return t;
}
}
error ("no class template named `%#T' in `%#T'", name, context);
return error_mark_node;
}
-
+
if (complain & tf_error)
perform_or_defer_access_check (TYPE_BINFO (context), tmpl);
type. TYPE is the _TYPE node for the builtin type. */
void
-record_builtin_type (enum rid rid_index,
- const char* name,
+record_builtin_type (enum rid rid_index,
+ const char* name,
tree type)
{
tree rname = NULL_TREE, tname = NULL_TREE;
void_ftype = build_function_type (void_type_node, void_list_node);
void_ftype_ptr = build_function_type (void_type_node,
tree_cons (NULL_TREE,
- ptr_type_node,
+ ptr_type_node,
void_list_node));
void_ftype_ptr
= build_exception_variant (void_ftype_ptr, empty_except_spec);
bad_alloc_id = get_identifier ("bad_alloc");
bad_alloc_type_node = make_aggr_type (RECORD_TYPE);
TYPE_CONTEXT (bad_alloc_type_node) = current_namespace;
- bad_alloc_decl
+ bad_alloc_decl
= create_implicit_typedef (bad_alloc_id, bad_alloc_type_node);
DECL_CONTEXT (bad_alloc_decl) = current_namespace;
TYPE_STUB_DECL (bad_alloc_type_node) = bad_alloc_decl;
pop_namespace ();
-
- ptr_ftype_sizetype
+
+ ptr_ftype_sizetype
= build_function_type (ptr_type_node,
tree_cons (NULL_TREE,
size_type_node,
domain = build_index_type (size_int (length));
init = build_string (length + 1, name);
}
-
+
type = build_qualified_type (char_type_node, TYPE_QUAL_CONST);
type = build_cplus_array_type (type, domain);
*type_p = type;
-
+
if (init)
TREE_TYPE (init) = type;
else
init = error_mark_node;
-
+
return init;
}
/* As we're using pushdecl_with_scope, we must set the context. */
DECL_CONTEXT (decl) = current_function_decl;
DECL_PRETTY_FUNCTION_P (decl) = type_dep;
-
+
TREE_STATIC (decl) = 1;
TREE_READONLY (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
DECL_INITIAL (decl) = init;
-
+
TREE_USED (decl) = 1;
if (current_function_decl)
}
else
pushdecl_top_level_and_finish (decl, init);
-
+
return decl;
}
}
if (TYPE_P (declspecs->type)
- && ((TREE_CODE (declspecs->type) != TYPENAME_TYPE
+ && ((TREE_CODE (declspecs->type) != TYPENAME_TYPE
&& IS_AGGR_TYPE (declspecs->type))
|| TREE_CODE (declspecs->type) == ENUMERAL_TYPE))
declared_type = declspecs->type;
/* Anonymous unions are objects, so they can have specifiers. */;
SET_ANON_AGGR_TYPE_P (declared_type);
- if (TREE_CODE (declared_type) != UNION_TYPE && pedantic
+ if (TREE_CODE (declared_type) != UNION_TYPE && pedantic
&& !in_system_header)
pedwarn ("ISO C++ prohibits anonymous structs");
}
{
if (declspecs->specs[(int)ds_inline]
|| declspecs->specs[(int)ds_virtual])
- error ("`%s' can only be specified for functions",
- declspecs->specs[(int)ds_inline]
+ error ("`%s' can only be specified for functions",
+ declspecs->specs[(int)ds_inline]
? "inline" : "virtual");
else if (saw_friend
- && (!current_class_type
+ && (!current_class_type
|| current_scope () != current_class_type))
error ("`friend' can only be specified inside a class");
else if (declspecs->specs[(int)ds_explicit])
Otherwise, it is an error.
C++: may have to grok the declspecs to learn about static,
- complain for anonymous unions.
+ complain for anonymous unions.
Returns the TYPE declared -- or NULL_TREE if none. */
if (TYPE_FIELDS (t))
{
- tree decl = grokdeclarator (/*declarator=*/NULL,
+ tree decl = grokdeclarator (/*declarator=*/NULL,
declspecs, NORMAL, 0, NULL);
finish_anon_union (decl);
}
/* Decode a "typename", such as "int **", returning a ..._TYPE node. */
tree
-groktypename (cp_decl_specifier_seq *type_specifiers,
+groktypename (cp_decl_specifier_seq *type_specifiers,
const cp_declarator *declarator)
{
tree attrs;
grokfield and not through here. */
tree
-start_decl (const cp_declarator *declarator,
+start_decl (const cp_declarator *declarator,
cp_decl_specifier_seq *declspecs,
- int initialized,
- tree attributes,
+ int initialized,
+ tree attributes,
tree prefix_attributes)
{
tree decl;
`extern X x' for some incomplete type `X'.) */
if (!DECL_EXTERNAL (decl))
complete_type (type);
- if (!DECL_SIZE (decl)
+ if (!DECL_SIZE (decl)
&& TREE_TYPE (decl) != error_mark_node
&& (COMPLETE_TYPE_P (type)
- || (TREE_CODE (type) == ARRAY_TYPE
+ || (TREE_CODE (type) == ARRAY_TYPE
&& !TYPE_DOMAIN (type)
&& COMPLETE_TYPE_P (TREE_TYPE (type)))))
layout_decl (decl, 0);
&& DECL_FUNCTION_SCOPE_P (decl)
/* Unfortunately, import_export_decl has not always been called
before the function is processed, so we cannot simply check
- DECL_COMDAT. */
+ DECL_COMDAT. */
&& (DECL_COMDAT (DECL_CONTEXT (decl))
|| ((DECL_DECLARED_INLINE_P (DECL_CONTEXT (decl))
|| DECL_TEMPLATE_INSTANTIATION (DECL_CONTEXT (decl)))
*INITP is one of a list of initializers describing a brace-enclosed
initializer for an entity of the indicated aggregate TYPE. It may
not presently match the shape of the TYPE; for example:
-
+
struct S { int a; int b; };
struct S a[] = { 1, 2, 3, 4 };
else
old_init = error_mark_node;
}
-
+
return old_init;
}
}
else
{
- /* Build a CONSTRUCTOR to hold the contents of the aggregate. */
+ /* Build a CONSTRUCTOR to hold the contents of the aggregate. */
new_init = build_constructor (NULL_TREE, NULL_TREE);
if (CLASS_TYPE_P (type))
if (!field)
{
/* [dcl.init.aggr]
-
+
An initializer for an aggregate member that is an
empty class shall have the form of an empty
initializer-list {}. */
return error_mark_node;
TREE_CHAIN (field_init) = CONSTRUCTOR_ELTS (new_init);
CONSTRUCTOR_ELTS (new_init) = field_init;
- /* [dcl.init.aggr]
+ /* [dcl.init.aggr]
When a union is initialized with a brace-enclosed
initializer, the braces shall only contain an
if (type == error_mark_node)
/* We will have already complained. */
init = NULL_TREE;
- else if (init && COMPLETE_TYPE_P (type)
+ else if (init && COMPLETE_TYPE_P (type)
&& !TREE_CONSTANT (TYPE_SIZE (type)))
{
error ("variable-sized object `%D' may not be initialized", decl);
init = grok_reference_init (decl, type, init, cleanup);
else if (init)
{
- if (TREE_CODE (init) == CONSTRUCTOR
+ if (TREE_CODE (init) == CONSTRUCTOR
&& BRACE_ENCLOSED_INITIALIZER_P (init))
{
/* [dcl.init] paragraph 13,
T x = { a };
is equivalent to
T x = a;
-
+
reshape_init will complain about the extra braces,
and doesn't do anything useful in the case where TYPE is
scalar, so just don't call it. */
tree cleanup;
my_friendly_assert (TREE_CODE (decl) == VAR_DECL
- || TREE_CODE (decl) == RESULT_DECL,
+ || TREE_CODE (decl) == RESULT_DECL,
20021010);
my_friendly_assert (!TREE_STATIC (decl), 20021010);
/* If a name was specified, get the string. */
if (global_scope_p (current_binding_level))
asmspec_tree = maybe_apply_renaming_pragma (decl, asmspec_tree);
- if (asmspec_tree)
+ if (asmspec_tree)
asmspec = TREE_STRING_POINTER (asmspec_tree);
if (init && TREE_CODE (init) == NAMESPACE_DECL)
if (TREE_CODE (decl) != FUNCTION_DECL)
ttype = target_type (type);
-
+
/* Currently, GNU C++ puts constants in text space, making them
impossible to initialize. In the future, one would hope for
an operating system which understood the difference between
if (! DECL_EXTERNAL (decl) && TREE_READONLY (decl))
{
was_readonly = 1;
- if (TYPE_NEEDS_CONSTRUCTING (type)
+ if (TYPE_NEEDS_CONSTRUCTING (type)
|| TREE_CODE (type) == REFERENCE_TYPE)
TREE_READONLY (decl) = 0;
}
init = NULL_TREE;
}
/* Handle:
-
+
[dcl.init]
-
+
The memory occupied by any object of static storage
duration is zero-initialized at program startup before
any other initialization takes place.
-
+
We cannot create an appropriate initializer until after
the type of DECL is finalized. If DECL_INITIAL is set,
then the DECL is statically initialized, and any
else
abstract_virtuals_error (decl, type);
- if (TREE_CODE (decl) == FUNCTION_DECL
+ if (TREE_CODE (decl) == FUNCTION_DECL
|| TREE_TYPE (decl) == error_mark_node)
/* No initialization required. */
;
to the original function, rather than the anonymous one. That
will make the back-end think that nested functions are in use,
which causes confusion. */
-
+
push_deferring_access_checks (dk_no_check);
fcall = build_cleanup (decl);
pop_deferring_access_checks ();
cleanup = build_unary_op (ADDR_EXPR, cleanup, 0);
if (flag_use_cxa_atexit)
{
- args = tree_cons (NULL_TREE,
+ args = tree_cons (NULL_TREE,
build_unary_op (ADDR_EXPR, get_dso_handle_node (), 0),
NULL_TREE);
args = tree_cons (NULL_TREE, null_pointer_node, args);
my_friendly_assert (TREE_STATIC (decl), 20021010);
/* Some variables require no initialization. */
- if (!init
+ if (!init
&& !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl))
&& TYPE_HAS_TRIVIAL_DESTRUCTOR (TREE_TYPE (decl)))
return;
TYPE_NEEDS_CONSTRUCTING (type)
= TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (elt_type));
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
- = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TYPE_MAIN_VARIANT (elt_type));
+ = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TYPE_MAIN_VARIANT (elt_type));
}
/* Lay out the type now that we can get the real answer. */
applicable error messages. */
static tree
-grokfndecl (tree ctype,
+grokfndecl (tree ctype,
tree type,
tree declarator,
tree parms,
enum overload_flags flags,
cp_cv_quals quals,
tree raises,
- int check,
- int friendp,
- int publicp,
- int inlinep,
- int funcdef_flag,
+ int check,
+ int friendp,
+ int publicp,
+ int inlinep,
+ int funcdef_flag,
int template_count,
tree in_namespace)
{
return decl;
}
-/* Create a VAR_DECL named NAME with the indicated TYPE.
+/* Create a VAR_DECL named NAME with the indicated TYPE.
If SCOPE is non-NULL, it is the class type or namespace containing
the variable. If SCOPE is NULL, the variable should is created in
{
tree decl;
- my_friendly_assert (!name || TREE_CODE (name) == IDENTIFIER_NODE,
+ my_friendly_assert (!name || TREE_CODE (name) == IDENTIFIER_NODE,
20020808);
/* Compute the scope in which to place the variable. */
(TREE_CODE (scope) == NAMESPACE_DECL && processing_template_decl)
/* Similarly for namespace-scope variables with language linkage
other than C++. */
- || (TREE_CODE (scope) == NAMESPACE_DECL
+ || (TREE_CODE (scope) == NAMESPACE_DECL
&& current_lang_name != lang_name_cplusplus)
/* Similarly for static data members. */
|| TYPE_P (scope)))
t = make_aggr_type (RECORD_TYPE);
xref_basetypes (t, NULL_TREE);
-
+
/* Let the front-end know this is a pointer to member function... */
TYPE_PTRMEMFUNC_FLAG (t) = 1;
/* ... and not really an aggregate. */
field = build_decl (FIELD_DECL, pfn_identifier, type);
fields = field;
-
+
field = build_decl (FIELD_DECL, delta_identifier, delta_type_node);
TREE_CHAIN (field) = fields;
fields = field;
-
+
finish_builtin_struct (t, "__ptrmemfunc_type", fields, ptr_type_node);
/* Zap out the name so that the back-end will give us the debugging
tree arg_types;
arg_types = TYPE_ARG_TYPES (member_type);
- class_type = (cp_build_qualified_type
+ class_type = (cp_build_qualified_type
(class_type,
cp_type_quals (TREE_TYPE (TREE_VALUE (arg_types)))));
- member_type
- = build_method_type_directly (class_type,
+ member_type
+ = build_method_type_directly (class_type,
TREE_TYPE (member_type),
TREE_CHAIN (arg_types));
return build_ptrmemfunc_type (build_pointer_type (member_type));
int explicit_char = 0;
int defaulted_int = 0;
tree dependant_name = NULL_TREE;
-
+
tree typedef_decl = NULL_TREE;
const char *name = NULL;
tree typedef_type = NULL_TREE;
/* The NAMESPACE_DECL for the namespace in which this entity is
located. If an unqualified name is used to declare the entity,
this value will be NULL_TREE, even if the entity is located at
- namespace scope. */
+ namespace scope. */
tree in_namespace = NULL_TREE;
cp_decl_spec ds;
cp_storage_class storage_class;
/* Look inside a declarator for the name being declared
and get it as a string, for an error message. */
- for (id_declarator = declarator;
- id_declarator;
+ for (id_declarator = declarator;
+ id_declarator;
id_declarator = id_declarator->declarator)
{
if (id_declarator->kind != cdk_id)
Therefore, we do as well. */
if (qualifying_scope && TYPE_P (qualifying_scope))
{
- ctype = TYPE_MAIN_VARIANT (qualifying_scope);
+ ctype = TYPE_MAIN_VARIANT (qualifying_scope);
if (innermost_code != cdk_function
&& current_class_type
- && !UNIQUELY_DERIVED_FROM_P (ctype,
+ && !UNIQUELY_DERIVED_FROM_P (ctype,
current_class_type))
{
error ("type `%T' is not derived from type `%T'",
ctype, current_class_type);
ctype = NULL_TREE;
}
- TREE_OPERAND (decl, 0) = ctype;
+ TREE_OPERAND (decl, 0) = ctype;
}
else if (TREE_CODE (qualifying_scope) == NAMESPACE_DECL)
in_namespace = qualifying_scope;
explicit_char = declspecs->explicit_char_p;
/* Check for repeated decl-specifiers. */
- for (ds = ds_first; ds != ds_last; ++ds)
+ for (ds = ds_first; ds != ds_last; ++ds)
{
unsigned count = declspecs->specs[(int)ds];
if (count < 2)
continue;
- /* The "long" specifier is a special case because of
+ /* The "long" specifier is a special case because of
"long long". */
if (ds == ds_long)
{
pedwarn ("ISO C++ does not support `long long'");
else
longlong = 1;
- }
+ }
else if (declspecs->specs[(int)ds] > 1)
{
static const char *const decl_spec_names[] = {
type = integer_type_node;
}
-
+
ctype = NULL_TREE;
/* Now process the modifiers that were specified
? tf_ignore_bad_quals : 0) | tf_error | tf_warning));
/* We might have ignored or rejected some of the qualifiers. */
type_quals = cp_type_quals (type);
-
+
staticp = 0;
inlinep = !! declspecs->specs[(int)ds_inline];
virtualp = !! declspecs->specs[(int)ds_virtual];
if (declspecs->multiple_storage_classes_p)
error ("multiple storage classes in declaration of `%s'", name);
else if (thread_p
- && ((storage_class
+ && ((storage_class
&& storage_class != sc_extern
&& storage_class != sc_static)
|| declspecs->specs[(int)ds_typedef]))
error ("multiple storage classes in declaration of `%s'", name);
thread_p = false;
}
- else if (decl_context != NORMAL
+ else if (decl_context != NORMAL
&& ((storage_class != sc_none
&& storage_class != sc_mutable)
|| thread_p))
storage_class = sc_none;
}
}
- else if (storage_class == sc_extern && initialized
+ else if (storage_class == sc_extern && initialized
&& !funcdef_flag)
{
if (toplevel_bindings_p ())
switch (TREE_CODE (unqualified_id))
{
case BIT_NOT_EXPR:
- unqualified_id
+ unqualified_id
= constructor_name (TREE_OPERAND (unqualified_id, 0));
break;
-
+
case TYPE_DECL:
- unqualified_id
+ unqualified_id
= constructor_name (TREE_TYPE (unqualified_id));
break;
case IDENTIFIER_NODE:
case TEMPLATE_ID_EXPR:
break;
-
+
default:
abort ();
}
/* Determine the type of the entity declared by recurring on the
declarator. */
- for (;
+ for (;
declarator && declarator->kind != cdk_id;
declarator = declarator->declarator)
{
if (attrs)
{
int attr_flags;
-
+
attr_flags = 0;
if (declarator == NULL || declarator->kind == cdk_id)
attr_flags |= (int) ATTR_FLAG_DECL_NEXT;
switch (declarator->kind)
{
case cdk_array:
- type = create_array_type_for_decl (dname, type,
+ type = create_array_type_for_decl (dname, type,
declarator->u.array.bounds);
if (inner_declarator
&& (inner_declarator->kind == cdk_pointer
name);
}
- arg_types = grokparms (declarator->u.function.parameters,
+ arg_types = grokparms (declarator->u.function.parameters,
&parms);
if (inner_declarator
arg_types = void_list_node;
parms = NULL_TREE;
}
-
+
type = build_function_type (type, arg_types);
}
break;
|| (quals && TREE_CODE (type) == METHOD_TYPE)))
{
tree dummy = build_decl (TYPE_DECL, NULL_TREE, type);
- grok_method_quals (declarator->u.pointer.class_type,
+ grok_method_quals (declarator->u.pointer.class_type,
dummy, quals);
type = TREE_TYPE (dummy);
quals = TYPE_UNQUALIFIED;
else if (TREE_CODE (type) == METHOD_TYPE)
type = build_ptrmemfunc_type (build_pointer_type (type));
else if (declarator->kind == cdk_ptrmem)
- type = build_ptrmem_type (declarator->u.pointer.class_type,
+ type = build_ptrmem_type (declarator->u.pointer.class_type,
type);
else
type = build_pointer_type (type);
if (declarator->u.pointer.qualifiers)
{
- type
- = cp_build_qualified_type (type,
+ type
+ = cp_build_qualified_type (type,
declarator->u.pointer.qualifiers);
type_quals = cp_type_quals (type);
}
abort ();
}
}
-
+
if (unqualified_id && TREE_CODE (unqualified_id) == TEMPLATE_ID_EXPR
&& TREE_CODE (type) != FUNCTION_TYPE
&& TREE_CODE (type) != METHOD_TYPE)
{
- error ("template-id `%D' used as a declarator",
+ error ("template-id `%D' used as a declarator",
unqualified_id);
unqualified_id = dname;
}
/* If DECLARATOR is non-NULL, we know it is a cdk_id declarator;
otherwise, we would not have exited the loop above. */
- if (declarator
+ if (declarator
&& TREE_CODE (declarator->u.id.name) == SCOPE_REF
/* If the qualifying scope was invalid, it will have been set to
NULL_TREE above. */
are always static functions. */
;
else if (current_class_type == NULL_TREE || friendp)
- type
- = build_method_type_directly (ctype,
+ type
+ = build_method_type_directly (ctype,
TREE_TYPE (type),
TYPE_ARG_TYPES (type));
else
}
if ((decl_context == FIELD || decl_context == PARM)
- && !processing_template_decl
+ && !processing_template_decl
&& variably_modified_type_p (type, NULL_TREE))
{
if (decl_context == FIELD)
if (!current_function_decl)
DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
}
-
+
/* If the user declares "typedef struct {...} foo" then the
struct will have an anonymous name. Fill that name in now.
Nothing can refer to it, so nothing needs know about the name
|| (typedef_decl && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl)))
C_TYPEDEF_EXPLICITLY_SIGNED (decl) = 1;
- bad_specifiers (decl, "type", virtualp, quals != TYPE_UNQUALIFIED,
+ bad_specifiers (decl, "type", virtualp, quals != TYPE_UNQUALIFIED,
inlinep, friendp, raises != NULL_TREE);
return decl;
/* Detect where we're using a typedef of function type to declare a
function. PARMS will not be set, so we must create it now. */
-
+
if (type == typedef_type && TREE_CODE (type) == FUNCTION_TYPE)
{
tree decls = NULL_TREE;
TREE_CHAIN (decl) = decls;
decls = decl;
}
-
+
parms = nreverse (decls);
}
}
}
else if (staticp < 2)
- type = build_method_type_directly (ctype,
+ type = build_method_type_directly (ctype,
TREE_TYPE (type),
TYPE_ARG_TYPES (type));
}
if (decl == error_mark_node)
return error_mark_node;
}
-
+
decl = do_friend (ctype, unqualified_id, decl,
*attrlist, flags, quals, funcdef_flag);
return decl;
}
else if (TREE_CODE (type) == FUNCTION_TYPE && staticp < 2
&& !NEW_DELETE_OPNAME_P (original_name))
- type = build_method_type_directly (ctype,
+ type = build_method_type_directly (ctype,
TREE_TYPE (type),
TYPE_ARG_TYPES (type));
/* It's a variable. */
/* An uninitialized decl with `extern' is a reference. */
- decl = grokvardecl (type, unqualified_id,
+ decl = grokvardecl (type, unqualified_id,
declspecs,
initialized,
(type_quals & TYPE_QUAL_CONST) != 0,
tree args;
tree arg_type;
int result = 1;
-
+
my_friendly_assert (DECL_FUNCTION_MEMBER_P (d), 20011208);
if (DECL_TEMPLATE_INFO (d) && is_member_template (DECL_TI_TEMPLATE (d)))
represented as template functions internally, and we must
accept those as copy functions. */
return 0;
-
+
args = FUNCTION_FIRST_USER_PARMTYPE (d);
if (!args)
return 0;
}
else
return 0;
-
+
args = TREE_CHAIN (args);
if (args && args != void_list_node && !TREE_PURPOSE (args))
else if (DECL_CONSTRUCTOR_P (decl))
{
int ctor = copy_fn_p (decl);
-
+
if (ctor > 0)
{
/* [class.copy]
-
+
A non-template constructor for class X is a copy
constructor if its first parameter is of type X&, const
X&, volatile X& or const volatile X&, and either there
else if (DECL_OVERLOADED_OPERATOR_P (decl) == NOP_EXPR)
{
/* [class.copy]
-
+
A non-template assignment operator for class X is a copy
assignment operator if its parameter is of type X, X&, const
X&, volatile X& or const volatile X&. */
-
+
int assop = copy_fn_p (decl);
-
+
if (assop)
{
TYPE_HAS_ASSIGN_REF (DECL_CONTEXT (decl)) = 1;
if (ctor_parm < 0)
{
/* [class.copy]
-
+
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.
-
+
We *don't* complain about member template instantiations that
have this form, though; they can occur as we try to decide
what constructor to use during overload resolution. Since
ctype, ctype);
return 0;
}
-
+
return 1;
}
type = TREE_TYPE (decl);
- /* [dcl.type.elab]
+ /* [dcl.type.elab]
If the identifier resolves to a typedef-name or a template
type-parameter, the elaborated-type-specifier is ill-formed.
error ("using typedef-name `%D' after `%s'", decl, tag_name (tag_code));
return IS_AGGR_TYPE (type) ? type : error_mark_node;
}
-
+
if (TREE_CODE (type) == TEMPLATE_TYPE_PARM)
{
error ("using template type parameter `%T' after `%s'",
{
if (!globalize && processing_template_decl && IS_AGGR_TYPE (t))
redeclare_class_template (t, current_template_parms);
- else if (!processing_template_decl
+ else if (!processing_template_decl
&& CLASS_TYPE_P (t)
&& CLASSTYPE_IS_TEMPLATE (t))
{
instantiated. This ensures that if we call ourselves recursively
we do not get confused about which classes are marked and which
are not. */
- basep = &base_list;
- while (*basep)
+ basep = &base_list;
+ while (*basep)
{
tree basetype = TREE_VALUE (*basep);
-
+
if (!(processing_template_decl && uses_template_parms (basetype))
&& !complete_type_or_else (basetype, NULL))
/* An incomplete type. Remove it from the list. */
redefinition. */
my_friendly_assert (!TYPE_BINFO (ref) || TYPE_SIZE (ref), 20040706);
my_friendly_assert (TYPE_MAIN_VARIANT (ref) == ref, 20040712);
-
+
binfo = make_tree_binfo (max_bases);
+
TYPE_BINFO (ref) = binfo;
BINFO_OFFSET (binfo) = size_zero_node;
BINFO_TYPE (binfo) = ref;
-
+
if (max_bases)
{
BINFO_BASE_ACCESSES (binfo) = make_tree_vec (max_bases);
/* An aggregate cannot have baseclasses. */
CLASSTYPE_NON_AGGREGATE (ref) = 1;
-
+
if (TREE_CODE (ref) == UNION_TYPE)
error ("derived union `%T' invalid", ref);
}
-
+
if (max_bases > 1)
{
TYPE_USES_MULTIPLE_INHERITANCE (ref) = 1;
/* If there is more than one non-empty they cannot be at the
same address. */
TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (ref) = 1;
-
+
if (TYPE_FOR_JAVA (ref))
error ("Java class '%T' cannot have multiple bases", ref);
}
-
+
if (max_vbases)
{
CLASSTYPE_VBASECLASSES (ref) = VEC_alloc (tree, max_vbases);
/* Converting to a virtual base class requires looking up the
offset of the virtual base. */
TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (ref) = 1;
-
+
if (TYPE_FOR_JAVA (ref))
error ("Java class '%T' cannot have virtual bases", ref);
}
tree access = TREE_PURPOSE (base_list);
int via_virtual = TREE_TYPE (base_list) != NULL_TREE;
tree basetype = TREE_VALUE (base_list);
-
+
if (access == access_default_node)
access = default_access;
-
+
if (TREE_CODE (basetype) == TYPE_DECL)
basetype = TREE_TYPE (basetype);
if (TREE_CODE (basetype) != RECORD_TYPE
basetype);
continue;
}
-
+
if (CLASSTYPE_MARKED (basetype))
{
if (basetype == ref)
continue;
}
SET_CLASSTYPE_MARKED (basetype);
-
+
if (TYPE_FOR_JAVA (basetype) && (current_lang_depth () == 0))
TYPE_FOR_JAVA (ref) = 1;
base_binfo = TYPE_BINFO (basetype);
/* The orignal basetype could have been a typedef'd type. */
basetype = BINFO_TYPE (base_binfo);
-
+
/* Inherit flags from the base. */
TYPE_HAS_NEW_OPERATOR (ref)
|= TYPE_HAS_NEW_OPERATOR (basetype);
|= TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (basetype);
TYPE_HAS_CONVERSION (ref) |= TYPE_HAS_CONVERSION (basetype);
}
-
+
base_binfo = copy_binfo (base_binfo, basetype, ref,
&igo_prev, via_virtual);
if (!BINFO_INHERITANCE_CHAIN (base_binfo))
slots. */
TREE_VEC_LENGTH (BINFO_BASE_ACCESSES (binfo))
= BINFO_N_BASE_BINFOS (binfo);
-
+
/* Unmark all the types. */
for (i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
CLEAR_CLASSTYPE_MARKED (BINFO_TYPE (base_binfo));
tree t;
bool unsignedp;
int lowprec;
- int highprec;
+ int highprec;
int precision;
integer_type_kind itk;
tree underlying_type = NULL_TREE;
works. */
if (processing_template_decl)
{
- for (values = TYPE_VALUES (enumtype);
- values;
+ for (values = TYPE_VALUES (enumtype);
+ values;
values = TREE_CHAIN (values))
TREE_TYPE (TREE_VALUE (values)) = enumtype;
if (at_function_scope_p ())
{
minnode = maxnode = NULL_TREE;
- for (values = TYPE_VALUES (enumtype);
- values;
+ for (values = TYPE_VALUES (enumtype);
+ values;
values = TREE_CHAIN (values))
{
decl = TREE_VALUE (values);
enumeration. It is implementation-defined which integral type is
used as the underlying type for an enumeration except that the
underlying type shall not be larger than int unless the value of
- an enumerator cannot fit in an int or unsigned int.
+ an enumerator cannot fit in an int or unsigned int.
We use "int" or an "unsigned int" as the underlying type, even if
a smaller integral type would work, unless the user has
explicitly requested that we use the smallest possible type. */
- for (itk = (flag_short_enums ? itk_char : itk_int);
- itk != itk_none;
+ for (itk = (flag_short_enums ? itk_char : itk_int);
+ itk != itk_none;
itk++)
{
underlying_type = integer_types[itk];
underlying_type = integer_types[itk_unsigned_long_long];
}
- /* Compute the minium and maximum values for the type.
+ /* Compute the minium and maximum values for the type.
[dcl.enum]
set_min_and_max_values_for_integral_type (enumtype, precision, unsignedp);
/* [dcl.enum]
-
+
The value of sizeof() applied to an enumeration type, an object
of an enumeration type, or an enumerator, is the value of sizeof()
applied to the underlying type. */
fntype = TREE_TYPE (decl1);
if (TREE_CODE (fntype) == METHOD_TYPE)
ctype = TYPE_METHOD_BASETYPE (fntype);
-
+
/* ISO C++ 11.4/5. A friend function defined in a class is in
the (lexical) scope of the class in which it is defined. */
if (!ctype && DECL_FRIEND_P (decl1))
{
ctype = DECL_FRIEND_CONTEXT (decl1);
-
+
/* CTYPE could be null here if we're dealing with a template;
for example, `inline friend float foo()' inside a template
will have no CTYPE set. */
{
/* A specialization is not used to guide overload resolution. */
if (!DECL_FUNCTION_MEMBER_P (decl1)
- && !(DECL_USE_TEMPLATE (decl1) &&
+ && !(DECL_USE_TEMPLATE (decl1) &&
PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (decl1))))
{
tree olddecl = pushdecl (decl1);
else if (interface_unknown == 0
&& ! DECL_TEMPLATE_INSTANTIATION (decl1))
{
- if (DECL_DECLARED_INLINE_P (decl1)
+ if (DECL_DECLARED_INLINE_P (decl1)
|| DECL_TEMPLATE_INSTANTIATION (decl1)
|| processing_template_decl)
{
DECL_EXTERNAL (decl1)
= (interface_only
- || (DECL_DECLARED_INLINE_P (decl1)
+ || (DECL_DECLARED_INLINE_P (decl1)
&& ! flag_implement_inlines
&& !DECL_VINDEX (decl1)));
So clear DECL_EXTERNAL. */
DECL_EXTERNAL (decl1) = 0;
- if ((DECL_DECLARED_INLINE_P (decl1)
+ if ((DECL_DECLARED_INLINE_P (decl1)
|| DECL_TEMPLATE_INSTANTIATION (decl1))
&& ! DECL_INTERFACE_KNOWN (decl1)
/* Don't try to defer nested functions for now. */
}
start_fname_decls ();
-
+
store_parm_decls (current_function_parms);
}
yyparse to report a parse error. */
int
-start_function (cp_decl_specifier_seq *declspecs,
+start_function (cp_decl_specifier_seq *declspecs,
const cp_declarator *declarator,
tree attrs)
{
/* This should only be done once on the outermost decl. */
have_extern_spec = false;
}
-
+
decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1, &attrs);
/* If the declarator is not suitable for a function definition,
cause a syntax error. */
if (decl1 == NULL_TREE || TREE_CODE (decl1) != FUNCTION_DECL)
return 0;
-
+
cplus_decl_attributes (&decl1, attrs, 0);
-
+
/* If #pragma weak was used, mark the decl weak now. */
if (global_scope_p (current_binding_level))
maybe_apply_pragma_weak (decl1);
-
+
if (DECL_MAIN_P (decl1))
{
/* If this doesn't return integer_type, or a typedef to
if_stmt = begin_if_stmt ();
/* If it is not safe to avoid setting up the vtables, then
- someone will change the condition to be boolean_true_node.
+ someone will change the condition to be boolean_true_node.
(Actually, for now, we do not have code to set the condition
appropriately, so we just assume that we always need to
initialize the vtables.) */
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, virtual_size,
+ (DELETE_EXPR, current_class_ptr, virtual_size,
/*global_p=*/false, NULL_TREE);
if_stmt = begin_if_stmt ();
finish_constructor_body ();
else if (DECL_DESTRUCTOR_P (current_function_decl))
finish_destructor_body ();
-}
+}
/* Finish up a function declaration and compile that function
all the way to assembler language output. The free the storage
which then got a warning when stored in a ptr-to-function variable. */
my_friendly_assert (building_stmt_tree (), 20000911);
-
+
/* For a cloned function, we've already got all the code we need;
there's no need to add any extra bits. */
if (!DECL_CLONED_FUNCTION_P (fndecl))
/* This must come after expand_function_end because cleanups might
have declarations (from inline functions) that need to go into
this function's blocks. */
-
+
/* If the current binding level isn't the outermost binding level
for this function, either there is a bug, or we have experienced
syntax errors and the statement tree is malformed. */
CHANGES TO CODE IN `grokfield'. */
tree
-start_method (cp_decl_specifier_seq *declspecs,
+start_method (cp_decl_specifier_seq *declspecs,
const cp_declarator *declarator, tree attrlist)
{
tree fndecl = grokdeclarator (declarator, declspecs, MEMFUNCDEF, 0,
my_friendly_assert (TREE_CODE (var) == VAR_DECL, 20020406);
/* Keep track of variables with incomplete types. */
- if (!processing_template_decl && TREE_TYPE (var) != error_mark_node
+ if (!processing_template_decl && TREE_TYPE (var) != error_mark_node
&& DECL_EXTERNAL (var))
{
tree inner_type = TREE_TYPE (var);
-
+
while (TREE_CODE (inner_type) == ARRAY_TYPE)
inner_type = TREE_TYPE (inner_type);
inner_type = TYPE_MAIN_VARIANT (inner_type);
-
+
if ((!COMPLETE_TYPE_P (inner_type) && CLASS_TYPE_P (inner_type))
/* RTTI TD entries are created while defining the type_info. */
|| (TYPE_LANG_SPECIFIC (inner_type)
tree *list = &incomplete_vars;
my_friendly_assert (CLASS_TYPE_P (type), 20020406);
- while (*list)
+ while (*list)
{
if (same_type_p (type, TREE_PURPOSE (*list)))
{
*cp_function_chain = *DECL_SAVED_FUNCTION_DATA (fn);
/* We don't need the saved data anymore. Unless this is an inline
- function; we need the named return value info for
+ function; we need the named return value info for
declare_return_variable. */
if (! DECL_INLINE (fn))
DECL_SAVED_FUNCTION_DATA (fn) = NULL;