aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cp-tree.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/cp-tree.h')
-rw-r--r--gcc/cp/cp-tree.h124
1 files changed, 65 insertions, 59 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 65811323751..a2c0db11574 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -1,6 +1,6 @@
/* Definitions for C++ parsing and type checking.
Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002 Free Software Foundation, Inc.
+ 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@@ -28,6 +28,10 @@ Boston, MA 02111-1307, USA. */
#ifndef GCC_CP_TREE_H
#define GCC_CP_TREE_H
+#ifndef __GNUC__
+#error "You should be using 'make bootstrap' -- see installation instructions"
+#endif
+
#include "c-common.h"
/* Usage of TREE_LANG_FLAG_?:
@@ -318,8 +322,6 @@ typedef struct ptrmem_cst
set_namespace_binding ((NODE), current_namespace, (VAL))
#define CLEANUP_P(NODE) TREE_LANG_FLAG_0 (TRY_BLOCK_CHECK (NODE))
-#define CLEANUP_DECL(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 0)
-#define CLEANUP_EXPR(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 1)
/* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual
sense of `same'. */
@@ -537,7 +539,7 @@ enum cp_tree_index
CPTI_STD,
CPTI_ABI,
CPTI_TYPE_INFO_TYPE,
- CPTI_TINFO_DECL_TYPE,
+ CPTI_TYPE_INFO_PTR_TYPE,
CPTI_ABORT_FNDECL,
CPTI_GLOBAL_DELETE_FNDECL,
CPTI_AGGR_TAG,
@@ -624,7 +626,7 @@ extern tree cp_global_trees[CPTI_MAX];
#define std_node cp_global_trees[CPTI_STD]
#define abi_node cp_global_trees[CPTI_ABI]
#define type_info_type_node cp_global_trees[CPTI_TYPE_INFO_TYPE]
-#define tinfo_decl_type cp_global_trees[CPTI_TINFO_DECL_TYPE]
+#define type_info_ptr_type cp_global_trees[CPTI_TYPE_INFO_PTR_TYPE]
#define abort_fndecl cp_global_trees[CPTI_ABORT_FNDECL]
#define global_delete_fndecl cp_global_trees[CPTI_GLOBAL_DELETE_FNDECL]
#define current_aggr cp_global_trees[CPTI_AGGR_TAG]
@@ -727,8 +729,8 @@ struct saved_scope
tree x_previous_class_type;
tree x_previous_class_values;
tree x_saved_tree;
- tree incomplete;
tree lookups;
+ tree last_parms;
HOST_WIDE_INT x_processing_template_decl;
int x_processing_specialization;
@@ -791,10 +793,6 @@ struct saved_scope
#define previous_class_values scope_chain->x_previous_class_values
-/* A list of the declarations with incomplete type at namespace scope. */
-
-#define namespace_scope_incomplete scope_chain->incomplete
-
/* A list of private types mentioned, for deferred access checking. */
#define type_lookups scope_chain->lookups
@@ -936,6 +934,11 @@ extern int flag_operator_names;
extern int flag_gnu_binutils;
+/* Nonzero means warn about things that will change when compiling
+ with an ABI-compliant compiler. */
+
+extern int warn_abi;
+
/* Nonzero means warn about implicit declarations. */
extern int warn_implicit;
@@ -1247,6 +1250,9 @@ struct lang_type
unsigned is_partial_instantiation : 1;
unsigned java_interface : 1;
+ unsigned non_zero_init : 1;
+ unsigned contains_empty_class_p : 1;
+
/* When adding a flag here, consider whether or not it ought to
apply to a template instance if it applies to the template. If
so, make sure to copy it in instantiate_class_template! */
@@ -1254,12 +1260,13 @@ struct lang_type
/* There are some bits left to fill out a 32-bit word. Keep track
of this by updating the size of this bitfield whenever you add or
remove a flag. */
- unsigned dummy : 8;
+ unsigned dummy : 6;
int vsize;
tree primary_base;
tree vfields;
+ tree typeinfo_var;
tree vbases;
tree tags;
tree size;
@@ -1502,14 +1509,23 @@ struct lang_type
#define CLASSTYPE_HAS_MUTABLE(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_mutable)
#define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE))
-/* Nonzero means that this class type is a non-POD class. */
+/* Nonzero means that this class type is a non-POD class. */
#define CLASSTYPE_NON_POD_P(NODE) (TYPE_LANG_SPECIFIC (NODE)->non_pod_class)
+/* Nonzero means that this class contains pod types whose default
+ initialization is not a zero initialization (namely, pointers to
+ data members). */
+#define CLASSTYPE_NON_ZERO_INIT_P(NODE) (TYPE_LANG_SPECIFIC (NODE)->non_zero_init)
+
/* Nonzero if this class is "nearly empty", i.e., contains only a
virtual function table pointer. */
#define CLASSTYPE_NEARLY_EMPTY_P(NODE) \
(TYPE_LANG_SPECIFIC (NODE)->nearly_empty_p)
+/* Nonzero if this class contains an empty subobject. */
+#define CLASSTYPE_CONTAINS_EMPTY_CLASS_P(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->contains_empty_class_p)
+
/* A list of class types of which this type is a friend. The
TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the
case of a template friend. */
@@ -1524,13 +1540,21 @@ struct lang_type
#define CLASSTYPE_DECLARED_CLASS(NODE) \
(TYPE_LANG_SPECIFIC (NODE)->declared_class)
-/* Nonzero if this class has const members which have no specified initialization. */
-#define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->const_needs_init)
-
-/* Nonzero if this class has ref members which have no specified initialization. */
-#define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) \
- (TYPE_LANG_SPECIFIC (NODE)->ref_needs_init)
+/* Nonzero if this class has const members
+ which have no specified initialization. */
+#define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE) \
+ ? TYPE_LANG_SPECIFIC (NODE)->const_needs_init : 0)
+#define SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE, VALUE) \
+ (TYPE_LANG_SPECIFIC (NODE)->const_needs_init = (VALUE))
+
+/* Nonzero if this class has ref members
+ which have no specified initialization. */
+#define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE) \
+ ? TYPE_LANG_SPECIFIC (NODE)->ref_needs_init : 0)
+#define SET_CLASSTYPE_REF_FIELDS_NEED_INIT(NODE, VALUE) \
+ (TYPE_LANG_SPECIFIC (NODE)->ref_needs_init = (VALUE))
/* Nonzero if this class is included from a header file which employs
`#pragma interface', and it is not included in its implementation file. */
@@ -1590,7 +1614,7 @@ struct lang_type
#define CLEAR_BINFO_MARKED(NODE) \
(TREE_VIA_VIRTUAL (NODE) \
? CLEAR_CLASSTYPE_MARKED (BINFO_TYPE (NODE)) \
- : (TREE_LANG_FLAG_0 (NODE) = 0))
+ : (void)(TREE_LANG_FLAG_0 (NODE) = 0))
/* Nonzero means that this class is on a path leading to a new vtable. */
#define BINFO_VTABLE_PATH_MARKED(NODE) \
@@ -1629,12 +1653,10 @@ struct lang_type
#define SET_BINFO_PUSHDECLS_MARKED(NODE) SET_BINFO_VTABLE_PATH_MARKED (NODE)
#define CLEAR_BINFO_PUSHDECLS_MARKED(NODE) CLEAR_BINFO_VTABLE_PATH_MARKED (NODE)
-/* Nonzero if this BINFO is a primary base class.
+/* Nonzero if this BINFO is a primary base class. Note, this can be
+ set for non-canononical virtual bases. For a virtual primary base
+ you might also need to check whether it is canonical. */
- In the TYPE_BINFO hierarchy, this flag is never set for a base
- class of a non-primary virtual base. This flag is only valid for
- paths (given by BINFO_INHERITANCE_CHAIN) that really exist in the
- final object. */
#define BINFO_PRIMARY_P(NODE) \
(BINFO_PRIMARY_BASE_OF (NODE) != NULL_TREE)
@@ -1665,6 +1687,12 @@ struct lang_type
/* Used by various search routines. */
#define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
+/* The std::type_info variable representing this class, or NULL if no
+ such variable has been created. This field is only set for the
+ TYPE_MAIN_VARIANT of the class. */
+#define CLASSTYPE_TYPEINFO_VAR(NODE) \
+ (TYPE_LANG_SPECIFIC (NODE)->typeinfo_var)
+
/* Accessor macros for the vfield slots in structures. */
/* The virtual function pointer fields that this type contains. For a
@@ -2549,32 +2577,6 @@ extern int flag_new_for_scope;
member function. [expr.unary.op]/3 */
#define PTRMEM_OK_P(NODE) TREE_LANG_FLAG_0 (NODE)
-/* A pointer-to-function member type looks like:
-
- struct {
- __P __pfn;
- ptrdiff_t __delta;
- };
-
- If __pfn is NULL, it is a NULL pointer-to-member-function.
-
- (Because the vtable is always the first thing in the object, we
- don't need its offset.) If the function is virtual, then PFN is
- one plus twice the index into the vtable; otherwise, it is just a
- pointer to the function.
-
- Unfortunately, using the lowest bit of PFN doesn't work in
- architectures that don't impose alignment requirements on function
- addresses, or that use the lowest bit to tell one ISA from another,
- for example. For such architectures, we use the lowest bit of
- DELTA instead of the lowest bit of the PFN, and DELTA will be
- multiplied by 2. */
-enum ptrmemfunc_vbit_where_t
-{
- ptrmemfunc_vbit_in_pfn,
- ptrmemfunc_vbit_in_delta
-};
-
/* Get the POINTER_TYPE to the METHOD_TYPE associated with this
pointer to member function. TYPE_PTRMEMFUNC_P _must_ be true,
before using this macro. */
@@ -3748,7 +3750,8 @@ extern void finish_function_body PARAMS ((tree));
extern tree finish_function PARAMS ((int));
extern tree start_method PARAMS ((tree, tree, tree));
extern tree finish_method PARAMS ((tree));
-extern void hack_incomplete_structures PARAMS ((tree));
+extern void maybe_register_incomplete_var PARAMS ((tree));
+extern void complete_vars PARAMS ((tree));
extern void finish_stmt PARAMS ((void));
extern void print_other_binding_stack PARAMS ((struct binding_level *));
extern void revert_static_member_fn PARAMS ((tree));
@@ -3815,6 +3818,7 @@ extern tree coerce_delete_type PARAMS ((tree));
extern void comdat_linkage PARAMS ((tree));
extern void import_export_vtable PARAMS ((tree, tree, int));
extern void import_export_decl PARAMS ((tree));
+extern void import_export_tinfo PARAMS ((tree, tree, int));
extern tree build_cleanup PARAMS ((tree));
extern void finish_file PARAMS ((void));
extern tree reparse_absdcl_as_expr PARAMS ((tree, tree));
@@ -3903,6 +3907,7 @@ extern tree build_aggr_init PARAMS ((tree, tree, int));
extern int is_aggr_type PARAMS ((tree, int));
extern tree get_aggr_from_typedef PARAMS ((tree, int));
extern tree get_type_value PARAMS ((tree));
+extern tree build_forced_zero_init PARAMS ((tree));
extern tree build_member_call PARAMS ((tree, tree, tree));
extern tree build_offset_ref PARAMS ((tree, tree));
extern tree resolve_offset_ref PARAMS ((tree));
@@ -3910,7 +3915,7 @@ extern tree build_new PARAMS ((tree, tree, tree, int));
extern tree build_vec_init PARAMS ((tree, tree, int));
extern tree build_x_delete PARAMS ((tree, int, tree));
extern tree build_delete PARAMS ((tree, tree, special_function_kind, int, int));
-extern void push_base_cleanups PARAMS ((void));
+extern void perform_base_cleanups PARAMS ((void));
extern tree build_vbase_delete PARAMS ((tree, tree));
extern tree build_vec_delete PARAMS ((tree, tree, special_function_kind, int));
extern tree create_temporary_var PARAMS ((tree));
@@ -3956,7 +3961,6 @@ extern int cp_type_qual_from_rid PARAMS ((tree));
extern const char *cxx_init PARAMS ((const char *));
extern void cxx_finish PARAMS ((void));
extern void cxx_init_options PARAMS ((void));
-extern void cxx_post_options PARAMS ((void));
/* in method.c */
extern void init_method PARAMS ((void));
@@ -4047,7 +4051,7 @@ extern tree get_tinfo_decl PARAMS((tree));
extern tree get_typeid PARAMS((tree));
extern tree build_dynamic_cast PARAMS((tree, tree));
extern void emit_support_tinfos PARAMS((void));
-extern int tinfo_decl_p PARAMS((tree, void *));
+extern int unemitted_tinfo_decl_p PARAMS((tree, void *));
extern int emit_tinfo_decl PARAMS((tree *, void *));
/* in search.c */
@@ -4056,10 +4060,9 @@ extern int types_overlap_p PARAMS ((tree, tree));
extern tree get_vbase PARAMS ((tree, tree));
extern tree get_dynamic_cast_base_type PARAMS ((tree, tree));
extern void type_access_control PARAMS ((tree, tree));
-extern void skip_type_access_control PARAMS ((void));
-extern void reset_type_access_control PARAMS ((void));
extern int accessible_p PARAMS ((tree, tree));
extern tree lookup_field PARAMS ((tree, tree, int, int));
+extern tree lookup_nested_field PARAMS ((tree, int));
extern int lookup_fnfields_1 PARAMS ((tree, tree));
extern tree lookup_fnfields PARAMS ((tree, tree, int));
extern tree lookup_member PARAMS ((tree, tree, int, int));
@@ -4081,6 +4084,7 @@ extern tree lookup_conversions PARAMS ((tree));
extern tree binfo_for_vtable PARAMS ((tree));
extern tree binfo_from_vbase PARAMS ((tree));
extern tree look_for_overrides_here PARAMS ((tree, tree));
+extern int check_final_overrider PARAMS ((tree, tree));
extern tree dfs_walk PARAMS ((tree,
tree (*) (tree, void *),
tree (*) (tree, void *),
@@ -4093,8 +4097,6 @@ extern tree dfs_walk_real PARAMS ((tree,
extern tree dfs_unmark PARAMS ((tree, void *));
extern tree markedp PARAMS ((tree, void *));
extern tree unmarkedp PARAMS ((tree, void *));
-extern tree dfs_skip_nonprimary_vbases_unmarkedp PARAMS ((tree, void *));
-extern tree dfs_skip_nonprimary_vbases_markedp PARAMS ((tree, void *));
extern tree dfs_unmarked_real_bases_queue_p PARAMS ((tree, void *));
extern tree dfs_marked_real_bases_queue_p PARAMS ((tree, void *));
extern tree dfs_skip_vbases PARAMS ((tree, void *));
@@ -4165,6 +4167,7 @@ extern tree finish_qualified_call_expr PARAMS ((tree, tree));
extern tree finish_unary_op_expr PARAMS ((enum tree_code, tree));
extern tree finish_id_expr PARAMS ((tree));
extern void save_type_access_control PARAMS ((tree));
+extern void reset_type_access_control PARAMS ((void));
extern void decl_type_access_control PARAMS ((tree));
extern int begin_function_definition PARAMS ((tree, tree));
extern tree begin_constructor_declarator PARAMS ((tree, tree));
@@ -4218,6 +4221,7 @@ extern void end_input PARAMS ((void));
/* in tree.c */
extern void init_tree PARAMS ((void));
extern int pod_type_p PARAMS ((tree));
+extern int zero_init_p PARAMS ((tree));
extern tree canonical_type_variant PARAMS ((tree));
extern void unshare_base_binfos PARAMS ((tree));
extern int member_p PARAMS ((tree));
@@ -4349,6 +4353,7 @@ extern tree pfn_from_ptrmemfunc PARAMS ((tree));
extern tree type_after_usual_arithmetic_conversions PARAMS ((tree, tree));
extern tree composite_pointer_type PARAMS ((tree, tree, tree, tree,
const char*));
+extern tree merge_types PARAMS ((tree, tree));
extern tree check_return_expr PARAMS ((tree));
#define cp_build_binary_op(code, arg1, arg2) \
build_binary_op(code, arg1, arg2, 1)
@@ -4362,6 +4367,7 @@ extern int abstract_virtuals_error PARAMS ((tree, tree));
#define my_friendly_assert(EXP, N) (void) \
(((EXP) == 0) ? (fancy_abort (__FILE__, __LINE__, __FUNCTION__), 0) : 0)
+extern tree force_store_init_value PARAMS ((tree, tree));
extern tree store_init_value PARAMS ((tree, tree));
extern tree digest_init PARAMS ((tree, tree, tree *));
extern tree build_scoped_ref PARAMS ((tree, tree));