OSDN Git Service

* cp/cp-tree.h (struct cp_language_function): Remove x_result_rtx.
[pf3gnuchains/gcc-fork.git] / gcc / cp / cp-tree.h
index 373114f..1a6c518 100644 (file)
@@ -21,6 +21,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
 #include "function.h"
+#include "hashtab.h"
 #include "splay-tree.h"
 #include "varray.h"
 
@@ -31,38 +32,32 @@ Boston, MA 02111-1307, USA.  */
 
 /* Usage of TREE_LANG_FLAG_?:
    0: BINFO_MARKED (BINFO nodes).
-      COMPOUND_STMT_NO_SCOPE (in COMPOUND_STMT).
+      IDENTIFIER_MARKED (IDENTIFIER_NODEs)
       NEW_EXPR_USE_GLOBAL (in NEW_EXPR).
       DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR).
       LOOKUP_EXPR_GLOBAL (in LOOKUP_EXPR).
-      TREE_NEGATED_INT (in INTEGER_CST).
       TREE_INDIRECT_USING (in NAMESPACE_DECL).
-      IDENTIFIER_MARKED (used by search routines).
       LOCAL_BINDING_P (in CPLUS_BINDING)
       ICS_USER_FLAG (in _CONV)
       CLEANUP_P (in TRY_BLOCK)
       AGGR_INIT_VIA_CTOR_P (in AGGR_INIT_EXPR)
-      SCOPE_BEGIN_P (in SCOPE_STMT)
       CTOR_BEGIN_P (in CTOR_STMT)
-      DECL_PRETTY_FUNCTION_P (in VAR_DECL)
       BV_USE_VCALL_INDEX_P (in the BINFO_VIRTUALS TREE_LIST)
+      PTRMEM_OK_P (in ADDR_EXPR, OFFSET_REF)
    1: IDENTIFIER_VIRTUAL_P.
       TI_PENDING_TEMPLATE_FLAG.
       TEMPLATE_PARMS_FOR_INLINE.
       DELETE_EXPR_USE_VEC (in DELETE_EXPR).
       (TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out).
       TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (in _TYPE).
-      C_DECLARED_LABEL_FLAG (in LABEL_DECL)
       INHERITED_VALUE_BINDING_P (in CPLUS_BINDING)
       BASELINK_P (in TREE_LIST)
       ICS_ELLIPSIS_FLAG (in _CONV)
-      STMT_IS_FULL_EXPR_P (in _STMT)
       BINFO_ACCESS (in BINFO)
       BV_GENERATE_THUNK_WITH_VTABLE_P (in TREE_LIST)
    2: IDENTIFIER_OPNAME_P.
       TYPE_POLYMORHPIC_P (in _TYPE)
       ICS_THIS_FLAG (in _CONV)
-      STMT_LINENO_FOR_FN_P (in _STMT)
       BINDING_HAS_LEVEL_P (in CPLUS_BINDING)
       BINFO_OVERRIDE_ALONG_VIRTUAL_PATH_P (in BINFO)
    3: TYPE_USES_VIRTUAL_BASECLASSES (in a class TYPE).
@@ -71,17 +66,14 @@ Boston, MA 02111-1307, USA.  */
       (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out).
       ICS_BAD_FLAG (in _CONV)
       FN_TRY_BLOCK_P (in TRY_BLOCK)
-      SCOPE_NO_CLEANUPS_P (in SCOPE_STMT)
       IDENTIFIER_CTOR_OR_DTOR_P (in IDENTIFIER_NODE)
    4: BINFO_NEW_VTABLE_MARKED.
       TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
           or FIELD_DECL).
       NEED_TEMPORARY_P (in REF_BIND, BASE_CONV)
-      SCOPE_PARTIAL_P (in SCOPE_STMT)
       IDENTIFIER_TYPENAME_P (in IDENTIFIER_NODE)
-   5: BINFO_PRIMARY_MARKED_P (in BINFO)
-   6: BINFO_VBASE_PRIMARY_P (in BINFO)
-      BINFO_ACCESS (in BINFO)
+   5: C_IS_RESERVED_WORD (in IDENTIFIER_NODE)
+   6: BINFO_ACCESS (in BINFO)
 
    Usage of TYPE_LANG_FLAG_?:
    0: C_TYPE_FIELDS_READONLY (in RECORD_TYPE or UNION_TYPE).
@@ -110,7 +102,10 @@ Boston, MA 02111-1307, USA.  */
       DECL_THUNK_P (in a member FUNCTION_DECL)
 
    Usage of language-independent fields in a language-dependent manner:
-   
+
+   TREE_USED
+     This field is BINFO_INDIRECT_PRIMARY_P in a BINFO.
+
    TYPE_ALIAS_SET
      This field is used by TYPENAME_TYPEs, TEMPLATE_TYPE_PARMs, and so
      forth as a substitute for the mark bits provided in `lang_type'.
@@ -119,8 +114,8 @@ Boston, MA 02111-1307, USA.  */
    TYPE_BINFO
      For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO.
      For a TYPENAME_TYPE, this is TYPENAME_TYPE_FULLNAME.
-     For a TEMPLATE_TEMPLATE_PARM, this is
-     TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.
+     For a TEMPLATE_TEMPLATE_PARM or BOUND_TEMPLATE_TEMPLATE_PARM,
+     this is TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.
 
   BINFO_VIRTUALS
      For a binfo, this is a TREE_LIST.  The BV_DELTA of each node
@@ -150,7 +145,7 @@ Boston, MA 02111-1307, USA.  */
      in both ABIs.
 
    DECL_ARGUMENTS
-     For a VAR_DECL this is DECL_ANON_UNION_ELEMS.  
+     For a VAR_DECL this is DECL_ANON_UNION_ELEMS.
 
    DECL_VINDEX
      This field is NULL for a non-virtual function.  For a virtual
@@ -159,7 +154,7 @@ Boston, MA 02111-1307, USA.  */
      a virtual function is declared, but before it is known what
      function is overriden, this field is the error_mark_node.
 
-     Temporarily, it may be set to a TREE_LIST whose TREE_VALUE is 
+     Temporarily, it may be set to a TREE_LIST whose TREE_VALUE is
      the virtual function this one overrides, and whose TREE_CHAIN is
      the old DECL_VINDEX.  */
 
@@ -171,37 +166,37 @@ Boston, MA 02111-1307, USA.  */
 ({  const tree __t = NODE;                                     \
     enum tree_code __c = TREE_CODE(__t);                       \
     if (__c != VAR_DECL && __c != FUNCTION_DECL)               \
-      tree_check_failed (__t, VAR_DECL, __FILE__,              \
-                        __LINE__, __PRETTY_FUNCTION__);        \
+      tree_check_failed (__t, VAR_DECL, __FILE__, __LINE__,    \
+                        __FUNCTION__);                         \
     __t; })
 
 #define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE)                  \
 ({  const tree __t = NODE;                                     \
     enum tree_code __c = TREE_CODE(__t);                       \
-    if (__c != VAR_DECL                                        \
-       && __c != FUNCTION_DECL                                 \
+    if (__c != VAR_DECL                                        \
+       && __c != FUNCTION_DECL                         \
         && __c != PARM_DECL)                                   \
-      tree_check_failed (__t, VAR_DECL, __FILE__,              \
-                        __LINE__, __PRETTY_FUNCTION__);        \
+      tree_check_failed (__t, VAR_DECL, __FILE__, __LINE__,    \
+                        __FUNCTION__);                         \
     __t; })
 
 #define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE)            \
 ({  const tree __t = NODE;                                     \
     enum tree_code __c = TREE_CODE(__t);                       \
-    if (__c != VAR_DECL                                        \
+    if (__c != VAR_DECL                                        \
        && __c != FUNCTION_DECL                                 \
        && __c != TYPE_DECL                                     \
        && __c != TEMPLATE_DECL)                                \
-      tree_check_failed (__t, VAR_DECL, __FILE__,              \
-                        __LINE__, __PRETTY_FUNCTION__);        \
+      tree_check_failed (__t, VAR_DECL, __FILE__, __LINE__,    \
+                        __FUNCTION__);                         \
     __t; })
 
 #define RECORD_OR_UNION_TYPE_CHECK(NODE)                       \
 ({  const tree __t = NODE;                                     \
     enum tree_code __c = TREE_CODE(__t);                       \
     if (__c != RECORD_TYPE && __c != UNION_TYPE)               \
-      tree_check_failed (__t, RECORD_TYPE, __FILE__,           \
-                        __LINE__, __PRETTY_FUNCTION__);        \
+      tree_check_failed (__t, RECORD_TYPE, __FILE__, __LINE__, \
+                        __FUNCTION__);                         \
     __t; })
 
 #else /* not ENABLE_TREE_CHECKING, or not gcc */
@@ -288,8 +283,21 @@ struct lang_identifier
   tree class_value;
   tree class_template_info;
   struct lang_id2 *x;
+  enum rid rid_code;
 };
 
+/* In an IDENTIFIER_NODE, nonzero if this identifier is actually a
+   keyword.  C_RID_CODE (node) is then the RID_* value of the keyword,
+   and C_RID_YYCODE is the token number wanted by Yacc.  */
+
+#define C_IS_RESERVED_WORD(id) TREE_LANG_FLAG_5 (id)
+#define C_RID_CODE(id) \
+  (((struct lang_identifier *) (id))->rid_code)
+
+extern const short rid_to_yy[RID_MAX];
+#define C_RID_YYCODE(id) \
+  rid_to_yy[((struct lang_identifier *) (id))->rid_code]
+
 #define LANG_IDENTIFIER_CAST(NODE) \
        ((struct lang_identifier*)IDENTIFIER_NODE_CHECK (NODE))
 
@@ -299,14 +307,14 @@ struct lang_id2
   tree error_locus;
 };
 
-typedef struct 
+typedef struct
 {
   tree t;
   int new_type_flag;
   tree lookups;
 } flagged_type_tree;
 
-typedef struct 
+typedef struct
 {
   struct tree_common common;
   HOST_WIDE_INT index;
@@ -318,7 +326,7 @@ typedef struct
 typedef struct ptrmem_cst
 {
   struct tree_common common;
-  /* This isn't used, but the middle-end expects all constants to have 
+  /* This isn't used, but the middle-end expects all constants to have
      this field.  */
   struct rtx_def *rtl;
   tree member;
@@ -383,11 +391,6 @@ typedef struct ptrmem_cst
     && DECL_NAME (NODE) != NULL_TREE                   \
     && MAIN_NAME_P (DECL_NAME (NODE)))
 
-/* Returns non-zero iff ID_NODE is an IDENTIFIER_NODE whose name is
-   `main'.  */
-#define MAIN_NAME_P(ID_NODE) \
-   (strcmp (IDENTIFIER_POINTER (ID_NODE), "main") == 0)
-
 
 struct tree_binding
 {
@@ -467,7 +470,7 @@ struct tree_srcloc
 /* The IDENTIFIER_VALUE is the value of the IDENTIFIER_BINDING, or
    NULL_TREE if there is no binding.  */
 #define IDENTIFIER_VALUE(NODE)                 \
-  (IDENTIFIER_BINDING (NODE)                   \
+  (IDENTIFIER_BINDING (NODE)                   \
    ? BINDING_VALUE (IDENTIFIER_BINDING (NODE)) \
    : NULL_TREE)
 
@@ -479,15 +482,6 @@ struct tree_srcloc
 #define IDENTIFIER_CLASS_VALUE(NODE) \
   (LANG_IDENTIFIER_CAST (NODE)->class_value)
 
-/* The amount of time used by the file whose special "time identifier"
-   is NODE, represented as an INTEGER_CST.  See get_time_identifier.  */
-#define TIME_IDENTIFIER_TIME(NODE) IDENTIFIER_BINDING(NODE)
-
-/* For a "time identifier" this is a INTEGER_CST.  The
-   TREE_INT_CST_LOW is 1 if the corresponding file is "interface only".
-   The TRE_INT_CST_HIGH is 1 if it is "interface unknown".  */
-#define TIME_IDENTIFIER_FILEINFO(NODE) IDENTIFIER_CLASS_VALUE (NODE)
-
 /* TREE_TYPE only indicates on local and class scope the current
    type. For namespace scope, the presence of a type in any namespace
    is indicated with global_type_node, and the real type behind must
@@ -499,7 +493,7 @@ struct tree_srcloc
 
 #define LANG_ID_FIELD(NAME,NODE)                       \
   (LANG_IDENTIFIER_CAST (NODE)->x                      \
-   ? LANG_IDENTIFIER_CAST (NODE)->x->NAME : 0)  
+   ? LANG_IDENTIFIER_CAST (NODE)->x->NAME : 0)
 
 #define SET_LANG_ID(NODE,VALUE,NAME)                                     \
   (LANG_IDENTIFIER_CAST (NODE)->x == 0                           \
@@ -565,7 +559,6 @@ enum cp_tree_index
     CPTI_JAVA_CHAR_TYPE,
     CPTI_JAVA_BOOLEAN_TYPE,
 
-    CPTI_VOID_ZERO,
     CPTI_WCHAR_DECL,
     CPTI_VTABLE_ENTRY_TYPE,
     CPTI_DELTA_TYPE,
@@ -584,7 +577,7 @@ enum cp_tree_index
     CPTI_VMI_CLASS_DESC_TYPE,
     CPTI_PTM_DESC_TYPE,
     CPTI_BASE_DESC_TYPE,
-    
+
     CPTI_CLASS_TYPE,
     CPTI_RECORD_TYPE,
     CPTI_UNION_TYPE,
@@ -600,6 +593,7 @@ enum cp_tree_index
     CPTI_TINFO_VAR_ID,
     CPTI_ABORT_FNDECL,
     CPTI_GLOBAL_DELETE_FNDECL,
+    CPTI_AGGR_TAG,
 
     CPTI_ACCESS_DEFAULT,
     CPTI_ACCESS_PUBLIC,
@@ -657,7 +651,6 @@ extern tree cp_global_trees[CPTI_MAX];
 #define java_char_type_node            cp_global_trees[CPTI_JAVA_CHAR_TYPE]
 #define java_boolean_type_node         cp_global_trees[CPTI_JAVA_BOOLEAN_TYPE]
 
-#define void_zero_node                 cp_global_trees[CPTI_VOID_ZERO]
 #define wchar_decl_node                        cp_global_trees[CPTI_WCHAR_DECL]
 #define vtable_entry_type              cp_global_trees[CPTI_VTABLE_ENTRY_TYPE]
 /* The type used to represent an offset by which to adjust the `this'
@@ -694,6 +687,7 @@ extern tree cp_global_trees[CPTI_MAX];
 #define tinfo_var_id                    cp_global_trees[CPTI_TINFO_VAR_ID]
 #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]
 
 /* Define the sets of attributes that member functions and baseclasses
    can have.  These are sensible combinations of {public,private,protected}
@@ -788,12 +782,6 @@ extern tree cp_global_trees[CPTI_MAX];
 
 /* Global state.  */
 
-struct stmt_tree {
-  tree x_last_stmt;
-  tree x_last_expr_type;
-  int stmts_are_full_exprs_p; 
-};
-
 struct saved_scope {
   tree old_bindings;
   tree old_namespace;
@@ -804,7 +792,6 @@ struct saved_scope {
   varray_type lang_base;
   tree *lang_stack;
   tree lang_name;
-  tree x_function_parms;
   tree template_parms;
   tree x_previous_class_type;
   tree x_previous_class_values;
@@ -817,7 +804,7 @@ struct saved_scope {
   int x_processing_explicit_instantiation;
   int need_pop_function_context;
 
-  struct stmt_tree x_stmt_tree;
+  struct stmt_tree_s x_stmt_tree;
 
   struct binding_level *class_bindings;
   struct binding_level *bindings;
@@ -853,7 +840,6 @@ struct saved_scope {
 /* Parsing a function declarator leaves a list of parameter names
    or a chain or parameter decls here.  */
 
-#define current_function_parms scope_chain->x_function_parms
 #define current_template_parms scope_chain->template_parms
 
 #define processing_template_decl scope_chain->x_processing_template_decl
@@ -883,30 +869,25 @@ extern struct saved_scope *scope_chain;
 
 /* Global state pertinent to the current function.  */
 
-struct language_function
+struct cp_language_function
 {
+  struct language_function base;
+
   tree x_ctor_label;
   tree x_dtor_label;
   tree x_current_class_ptr;
   tree x_current_class_ref;
   tree x_eh_spec_try_block;
-  tree x_scope_stmt_stack;
   tree x_in_charge_parm;
 
   tree *x_vcalls_possible_p;
 
-  struct rtx_def *x_result_rtx;
-
   int returns_value;
   int returns_null;
-  int parms_stored;
   int in_function_try_handler;
   int x_expanding_p;
-  int name_declared;
   int vtbls_set_up_p;
 
-  struct stmt_tree x_stmt_tree;
-
   struct named_label_use_list *x_named_label_uses;
   struct named_label_list *x_named_labels;
   struct binding_level *bindings;
@@ -916,7 +897,8 @@ struct language_function
 
 /* The current C++-specific per-function global variables.  */
 
-#define cp_function_chain (cfun->language)
+#define cp_function_chain \
+  ((struct cp_language_function *) (cfun->language))
 
 /* In a destructor, the point at which all derived class destroying
    has been done, just before any base class destroying will be done.  */
@@ -937,33 +919,11 @@ struct language_function
 #define current_class_ref \
   (cfun ? cp_function_chain->x_current_class_ref : NULL_TREE)
 
-/* Information about the current statement tree.  */
-
-#define current_stmt_tree                      \
-  (cfun                                                \
-   ? &cp_function_chain->x_stmt_tree           \
-   : &scope_chain->x_stmt_tree)
-
-/* When building a statement-tree, this is the last statement added to
-   the tree.  */
-
-#define last_tree current_stmt_tree->x_last_stmt
-
-/* The type of the last expression-statement we have seen.  This is
-   required because the type of a statement-expression is the type of
-   the last expression statement.  */
-
-#define last_expr_type current_stmt_tree->x_last_expr_type
-
 /* The TRY_BLOCK for the exception-specifiers for the current
    function, if any.  */
 
 #define current_eh_spec_try_block cp_function_chain->x_eh_spec_try_block
 
-/* The stack of SCOPE_STMTs for the current function.  */
-
-#define current_scope_stmt_stack cp_function_chain->x_scope_stmt_stack
-
 /* The `__in_chrg' parameter for the current function.  Only used for
    destructors.  */
 
@@ -985,19 +945,6 @@ struct language_function
 
 #define current_function_returns_null cp_function_chain->returns_null
 
-#define current_function_just_assigned_this \
-  cp_function_chain->just_assigned_this
-
-#define current_function_parms_stored \
-  cp_function_chain->parms_stored
-
-/* One if we have already declared __FUNCTION__ (and related
-   variables) in the current function.  Two if we are in the process
-   of doing so.  */
-
-#define current_function_name_declared \
-  cp_function_chain->name_declared
-
 /* Nonzero if we have already generated code to initialize virtual
    function tables in this function.  */
 
@@ -1014,22 +961,13 @@ struct language_function
 
 #define doing_semantic_analysis_p() (!expanding_p)
 
-/* Non-zero if we should treat statements as full expressions.  In
-   particular, this variable is no-zero if at the end of a statement
-   we should destroy any temporaries created during that statement.
-   Similarly, if, at the end of a block, we should destroy any local
-   variables in this block.  Normally, this variable is non-zero,
-   since those are the normal semantics of C++.
-
-   However, in order to represent aggregate initialization code as
-   tree structure, we use statement-expressions.  The statements
-   within the statement expression should not result in cleanups being
-   run until the entire enclosing statement is complete.  */
+#define in_function_try_handler cp_function_chain->in_function_try_handler
 
-#define stmts_are_full_exprs_p \
-  current_stmt_tree->stmts_are_full_exprs_p
+/* Nonzero if __FUNCTION__ and its ilk have been declared in this
+   function.  */
 
-#define in_function_try_handler cp_function_chain->in_function_try_handler
+#define function_name_declared_p \
+  (cp_function_chain->base.x_function_name_declared_p)
 
 extern tree current_function_return_value;
 extern tree global_namespace;
@@ -1052,6 +990,14 @@ extern int flag_cond_mismatch;
 
 extern int flag_no_asm;
 
+/* Nonzero means don't recognize any extended keywords.  */
+
+extern int flag_no_gnu_keywords;
+
+/* Nonzero means recognize the named operators from C++98.  */
+
+extern int flag_operator_names;
+
 /* For cross referencing.  */
 
 extern int flag_gnu_xref;
@@ -1189,8 +1135,8 @@ extern int name_mangling_version;
    would normally be, for use with WINE.  */
 extern int flag_short_wchar;
 
-/* Nonzero if squashed mangling is to be performed. 
-   This uses the B and K codes to reference previously seen class types 
+/* Nonzero if squashed mangling is to be performed.
+   This uses the B and K codes to reference previously seen class types
    and class qualifiers.       */
 extern int flag_do_squangling;
 
@@ -1202,10 +1148,6 @@ extern int flag_use_repository;
    required.  */
 extern int flag_optional_diags;
 
-/* Nonzero means do not consider empty argument prototype to mean function
-   takes no arguments.  */
-extern int flag_strict_prototype;
-
 /* Nonzero means output .vtable_{entry,inherit} for use in doing vtable gc.  */
 extern int flag_vtable_gc;
 
@@ -1266,12 +1208,11 @@ enum languages { lang_c, lang_cplusplus, lang_java };
   (TREE_CODE (t) == TEMPLATE_TYPE_PARM         \
    || TREE_CODE (t) == TYPENAME_TYPE           \
    || TREE_CODE (t) == TYPEOF_TYPE             \
-   || (TREE_CODE (t) == TEMPLATE_TEMPLATE_PARM \
-       && TYPE_TEMPLATE_INFO (t))              \
+   || TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM    \
    || TYPE_LANG_FLAG_5 (t))
 
-/* Set IS_AGGR_TYPE for T to VAL.  T must be a class, struct, or 
-   union type.  */ 
+/* Set IS_AGGR_TYPE for T to VAL.  T must be a class, struct, or
+   union type.  */
 #define SET_IS_AGGR_TYPE(T, VAL) \
   (TYPE_LANG_FLAG_5 (T) = (VAL))
 
@@ -1296,7 +1237,7 @@ enum languages { lang_c, lang_cplusplus, lang_java };
 /* The type qualifiers for this type, including the qualifiers on the
    elements for an array type.  */
 #define CP_TYPE_QUALS(NODE)                    \
-  ((TREE_CODE (NODE) != ARRAY_TYPE)            \
+  ((TREE_CODE (NODE) != ARRAY_TYPE)            \
    ? TYPE_QUALS (NODE) : cp_type_quals (NODE))
 
 /* Nonzero if this type is const-qualified.  */
@@ -1414,10 +1355,10 @@ struct lang_type
      of this by updating the size of this bitfield whenever you add or
      remove a flag.  */
   unsigned dummy : 8;
-      
+
   int vsize;
-  int vfield_parent;
 
+  tree primary_base;
   tree vfields;
   tree vbases;
   tree tags;
@@ -1459,7 +1400,7 @@ struct lang_type
    has a two-argument array operator delete.  */
 #define TYPE_VEC_NEW_USES_COOKIE(NODE)         \
   (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (NODE)       \
-   || (TYPE_LANG_SPECIFIC (NODE)               \
+   || (TYPE_LANG_SPECIFIC (NODE)               \
        && TYPE_VEC_DELETE_TAKES_SIZE (NODE)))
 
 /* Nonzero means that this _CLASSTYPE node defines ways of converting
@@ -1573,7 +1514,7 @@ struct lang_type
 #define SET_CLASSTYPE_MARKED2(NODE)   SET_CLASSTYPE_MARKED_N(NODE, 1)
 #define CLEAR_CLASSTYPE_MARKED2(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 1)
 #define SET_CLASSTYPE_MARKED3(NODE)   SET_CLASSTYPE_MARKED_N(NODE, 2)
-#define CLEAR_CLASSTYPE_MARKED3(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 2)        
+#define CLEAR_CLASSTYPE_MARKED3(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 2)
 #define SET_CLASSTYPE_MARKED4(NODE)   SET_CLASSTYPE_MARKED_N(NODE, 3)
 #define CLEAR_CLASSTYPE_MARKED4(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 3)
 #define SET_CLASSTYPE_MARKED5(NODE)   SET_CLASSTYPE_MARKED_N(NODE, 4)
@@ -1587,34 +1528,16 @@ struct lang_type
    nested member class templates.  */
 #define CLASSTYPE_TAGS(NODE)           (TYPE_LANG_SPECIFIC(NODE)->tags)
 
-/* If this value is non-negative, it is the index (in the
-   TYPE_BINFO_BASETYPES) for the base-class whose vtable pointer we
-   are reusing.  For example, in D : B1, B2, PARENT would be 0, if D's
-   vtable came from B1, 1, if D's vtable came from B2.  */
-#define CLASSTYPE_VFIELD_PARENT(NODE)  (TYPE_LANG_SPECIFIC(NODE)->vfield_parent)
-
 /* Nonzero if NODE has a primary base class, i.e., a base class with
-   which it shares the virtual fucntion table pointer.  */
+   which it shares the virtual function table pointer.  */
 #define CLASSTYPE_HAS_PRIMARY_BASE_P(NODE) \
-  (CLASSTYPE_VFIELD_PARENT (NODE) != -1)
+  (CLASSTYPE_PRIMARY_BINFO (NODE) != NULL_TREE)
 
 /* If non-NULL, this is the binfo for the primary base class, i.e.,
    the base class which contains the virtual function table pointer
    for this class.  */
 #define CLASSTYPE_PRIMARY_BINFO(NODE) \
-  (BINFO_PRIMARY_BINFO (TYPE_BINFO (NODE)))
-
-/* If non-NULL, this is the binfo for the primary base of BINFO.  Note
-   that in a complex hierarchy the resulting BINFO may not actually
-   *be* primary.  In particular if the resulting BINFO is a virtual
-   base, and it occurs elsewhere in the hierarchy, then this
-   occurrence may not actually be a primary base in the complete
-   object.  Check BINFO_PRIMARY_MARKED_P to be sure.  */
-#define BINFO_PRIMARY_BINFO(NODE)                                      \
-  (CLASSTYPE_HAS_PRIMARY_BASE_P (BINFO_TYPE (NODE))                    \
-   ? BINFO_BASETYPE (NODE,                                             \
-                    CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (NODE)))       \
-   : NULL_TREE)
+  (TYPE_LANG_SPECIFIC (NODE)->primary_base)
 
 /* The number of virtual functions present in this class' virtual
    function table.  */
@@ -1634,8 +1557,8 @@ struct lang_type
    binfo_for_vbase.  C is the most derived class for the hierarchy
    containing BINFO.  */
 #define CANONICAL_BINFO(BINFO, C)              \
-  (TREE_VIA_VIRTUAL (BINFO)                    \
-   ? binfo_for_vbase (BINFO_TYPE (BINFO), C)   \
+  (TREE_VIA_VIRTUAL (BINFO)                    \
+   ? binfo_for_vbase (BINFO_TYPE (BINFO), C)   \
    : BINFO)
 
 /* Number of direct baseclasses of NODE.  */
@@ -1760,7 +1683,7 @@ struct lang_type
 /* Any subobject that needs a new vtable must have a vptr and must not
    be a primary base (since it would then use the vtable from a
    derived class.)  */
-#define SET_BINFO_NEW_VTABLE_MARKED(B, C)                               \
+#define SET_BINFO_NEW_VTABLE_MARKED(B, C)                               \
   (BINFO_NEW_VTABLE_MARKED (B, C) = 1,                                  \
    my_friendly_assert (!BINFO_PRIMARY_MARKED_P (B), 20000517),          \
    my_friendly_assert (CLASSTYPE_VFIELDS (BINFO_TYPE (B)) != NULL_TREE,  \
@@ -1777,11 +1700,8 @@ struct lang_type
    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_MARKED_P(NODE) TREE_LANG_FLAG_5 (NODE)
-
-/* Nonzero if the virtual baseclass with the type given by this BINFO
-   is primary *somewhere* in the hierarchy.  */
-#define BINFO_VBASE_PRIMARY_P(NODE) TREE_LANG_FLAG_6 (NODE)
+#define BINFO_PRIMARY_MARKED_P(NODE) \
+  (BINFO_PRIMARY_BASE_OF (NODE) != NULL_TREE)
 
 /* The index in the VTT where this subobject's sub-VTT can be found.
    NULL_TREE if there is no sub-VTT.  */
@@ -1791,10 +1711,21 @@ struct lang_type
    found.  NULL_TREE if there is no secondary vptr in the VTT.  */
 #define BINFO_VPTR_INDEX(NODE) TREE_VEC_ELT ((NODE), 9)
 
+/* The binfo of which NODE is a primary base.  (This is different from
+   BINFO_INHERITANCE_CHAIN for virtual base because a virtual base is
+   sometimes a primary base for a class for which it is not an
+   immediate base.)  */
+#define BINFO_PRIMARY_BASE_OF(NODE) TREE_VEC_ELT ((NODE), 10)
+
 /* Nonzero if this binfo declares a virtual function which is
    overridden along a virtual path.  */
 #define BINFO_OVERRIDE_ALONG_VIRTUAL_PATH_P(NODE) TREE_LANG_FLAG_2 (NODE)
 
+/* Nonzero if this binfo is an indirect primary base, i.e. a virtual
+   base that is a primary base of some of other class in the
+   hierarchy.  */
+#define BINFO_INDIRECT_PRIMARY_P(NODE) TREE_USED (NODE)
+
 /* Used by various search routines.  */
 #define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
 \f
@@ -1866,11 +1797,13 @@ struct lang_type
 #define CAN_HAVE_FULL_LANG_DECL_P(NODE)                \
   (!(TREE_CODE ((NODE)) == VAR_DECL            \
      || TREE_CODE ((NODE)) == CONST_DECL       \
-     || TREE_CODE ((NODE)) == FIELD_DECL       \
+     || TREE_CODE ((NODE)) == FIELD_DECL       \
      || TREE_CODE ((NODE)) == USING_DECL))
 
 struct lang_decl_flags
 {
+  struct c_lang_decl base;
+
   ENUM_BITFIELD(languages) language : 8;
 
   unsigned operator_attr : 1;
@@ -1899,8 +1832,6 @@ struct lang_decl_flags
   unsigned generate_with_vtable_p : 1;
   unsigned dummy : 1;
 
-  tree context;
-
   union {
     /* In a FUNCTION_DECL, VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this
        is DECL_TEMPLATE_INFO.  */
@@ -1924,14 +1855,17 @@ struct lang_decl_flags
   } u2;
 };
 
+struct unparsed_text;
+
 struct lang_decl
 {
   struct lang_decl_flags decl_flags;
 
   tree befriending_classes;
 
-  /* In a FUNCTION_DECL, this is DECL_SAVED_TREE.  */
-  tree saved_tree;
+  /* For a virtual FUNCTION_DECL, this is DECL_VIRTUAL_CONTEXT.  For a
+     non-virtual FUNCTION_DECL, this is DECL_FRIEND_CONTEXT.  */
+  tree context;
 
   /* In a FUNCTION_DECL, this is DECL_CLONED_FUNCTION.  */
   tree cloned_function;
@@ -1939,8 +1873,8 @@ struct lang_decl
   union
   {
     tree sorted_fields;
-    struct pending_inline *pending_inline_info;
-    struct language_function *saved_language_function;
+    struct unparsed_text *pending_inline_info;
+    struct cp_language_function *saved_language_function;
   } u;
 
   union {
@@ -1953,8 +1887,6 @@ struct lang_decl
   } u2;
 };
 
-/* An un-parsed default argument looks like an identifier.  */
-#define DEFARG_LENGTH(NODE)  (DEFAULT_ARG_CHECK(NODE)->identifier.length)
 #define DEFARG_POINTER(NODE) (DEFAULT_ARG_CHECK(NODE)->identifier.pointer)
 
 /* Non-zero if NODE is a _DECL with TREE_READONLY set.  */
@@ -1969,7 +1901,7 @@ struct lang_decl
    anything that isn't comdat, but we don't know for sure whether or
    not something is comdat until end-of-file.  */
 #define DECL_NEEDED_P(DECL)                                    \
-  ((at_eof && !DECL_COMDAT (DECL))                             \
+  ((at_eof && TREE_PUBLIC (DECL) && !DECL_COMDAT (DECL))       \
    || (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME ((DECL))))  \
    || (flag_syntax_only && TREE_USED ((DECL))))
 
@@ -1991,7 +1923,7 @@ struct lang_decl
 /* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a complete
    object.  */
 #define DECL_COMPLETE_CONSTRUCTOR_P(NODE)              \
-  (DECL_CONSTRUCTOR_P (NODE)                           \
+  (DECL_CONSTRUCTOR_P (NODE)                           \
    && DECL_NAME (NODE) == complete_ctor_identifier)
 
 /* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a base
@@ -2023,7 +1955,7 @@ struct lang_decl
 /* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete
    object.  */
 #define DECL_COMPLETE_DESTRUCTOR_P(NODE)               \
-  (DECL_DESTRUCTOR_P (NODE)                            \
+  (DECL_DESTRUCTOR_P (NODE)                            \
    && DECL_NAME (NODE) == complete_dtor_identifier)
 
 /* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a base
@@ -2035,13 +1967,14 @@ struct lang_decl
 /* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete
    object that deletes the object after it has been destroyed.  */
 #define DECL_DELETING_DESTRUCTOR_P(NODE)               \
-  (DECL_DESTRUCTOR_P (NODE)                            \
+  (DECL_DESTRUCTOR_P (NODE)                            \
    && DECL_NAME (NODE) == deleting_dtor_identifier)
 
 /* Nonzero if NODE (a FUNCTION_DECL) is a cloned constructor or
    destructor.  */
-#define DECL_CLONED_FUNCTION_P(NODE) \
-  (DECL_CLONED_FUNCTION (NODE) != NULL_TREE)
+#define DECL_CLONED_FUNCTION_P(NODE)           \
+  (DECL_LANG_SPECIFIC (NODE)                   \
+   && DECL_CLONED_FUNCTION (NODE) != NULL_TREE)
 
 /* If DECL_CLONED_FUNCTION_P holds, this is the function that was
    cloned.  */
@@ -2082,7 +2015,7 @@ struct lang_decl
    overloaded operator, ERROR_MARK is returned.  Since the numerical
    value of ERROR_MARK is zero, this macro can be used as a predicate
    to test whether or not NODE is an overloaded operator.  */
-#define DECL_OVERLOADED_OPERATOR_P(NODE)                       \
+#define DECL_OVERLOADED_OPERATOR_P(NODE)               \
   (IDENTIFIER_OPNAME_P (DECL_NAME ((NODE)))            \
    ? DECL_LANG_SPECIFIC (NODE)->u2.operator_code : ERROR_MARK)
 
@@ -2098,7 +2031,7 @@ struct lang_decl
 
 /* Non-zero for a FUNCTION_DECL that declares a type-info function.
    This only happens in the old abi.  */
-#define DECL_TINFO_FN_P(NODE)                                  \
+#define DECL_TINFO_FN_P(NODE)                                  \
   (TREE_CODE (NODE) == FUNCTION_DECL                           \
    && DECL_ARTIFICIAL (NODE)                                   \
    && DECL_LANG_SPECIFIC(NODE)->decl_flags.tinfo_fn_p)
@@ -2141,7 +2074,7 @@ struct lang_decl
 #define SHARED_MEMBER_P(NODE) \
   (TREE_CODE (NODE) == VAR_DECL || TREE_CODE (NODE) == TYPE_DECL \
    || TREE_CODE (NODE) == CONST_DECL)
-                               
+
 /* Nonzero for FUNCTION_DECL means that this decl is a non-static
    member function.  */
 #define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) \
@@ -2156,7 +2089,7 @@ struct lang_decl
    has `this' as const X *const.  */
 #define DECL_CONST_MEMFUNC_P(NODE)                                      \
   (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE)                              \
-   && CP_TYPE_CONST_P (TREE_TYPE (TREE_VALUE                            \
+   && CP_TYPE_CONST_P (TREE_TYPE (TREE_VALUE                            \
                                  (TYPE_ARG_TYPES (TREE_TYPE (NODE))))))
 
 /* Nonzero for FUNCTION_DECL means that this member function
@@ -2167,8 +2100,8 @@ struct lang_decl
                                  (TYPE_ARG_TYPES (TREE_TYPE (NODE))))))
 
 /* Nonzero for a DECL means that this member is a non-static member.  */
-#define DECL_NONSTATIC_MEMBER_P(NODE)          \
-  ((TREE_CODE (NODE) == FUNCTION_DECL          \
+#define DECL_NONSTATIC_MEMBER_P(NODE)          \
+  ((TREE_CODE (NODE) == FUNCTION_DECL          \
     && DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE))        \
    || TREE_CODE (NODE) == FIELD_DECL)
 
@@ -2221,18 +2154,18 @@ struct lang_decl
 
 /* For a non-member friend function, the class (if any) in which this
    friend was defined.  For example, given:
-   
+
      struct S { friend void f (); };
 
    the DECL_FRIEND_CONTEXT for `f' will be `S'.  */
 #define DECL_FRIEND_CONTEXT(NODE)                              \
   ((DECL_FRIEND_P (NODE) && !DECL_FUNCTION_MEMBER_P (NODE))    \
-   ? DECL_LANG_SPECIFIC (NODE)->decl_flags.context              \
+   ? DECL_LANG_SPECIFIC (NODE)->context                         \
    : NULL_TREE)
 
 /* Set the DECL_FRIEND_CONTEXT for NODE to CONTEXT.  */
 #define SET_DECL_FRIEND_CONTEXT(NODE, CONTEXT) \
-  (DECL_LANG_SPECIFIC (NODE)->decl_flags.context = (CONTEXT))
+  (DECL_LANG_SPECIFIC (NODE)->context = (CONTEXT))
 
 /* NULL_TREE in DECL_CONTEXT represents the global namespace. */
 #define CP_DECL_CONTEXT(NODE) \
@@ -2242,7 +2175,7 @@ struct lang_decl
 /* For a virtual function, the base where we find its vtable entry.
    For a non-virtual function, the base where it is defined.  */
 #define DECL_VIRTUAL_CONTEXT(NODE) \
-  (DECL_LANG_SPECIFIC (NODE)->decl_flags.context)
+  (DECL_LANG_SPECIFIC (NODE)->context)
 
 /* 1 iff NODE has namespace scope, including the global namespace.  */
 #define DECL_NAMESPACE_SCOPE_P(NODE)                           \
@@ -2258,6 +2191,10 @@ struct lang_decl
   (DECL_CONTEXT (NODE) \
    && TREE_CODE (DECL_CONTEXT (NODE)) == FUNCTION_DECL)
 
+/* 1 iff NODE is function-local, but for types.  */
+#define LOCAL_CLASS_P(NODE)                            \
+  (decl_function_context (TYPE_MAIN_DECL (NODE)) != NULL_TREE)
+
 /* For a NAMESPACE_DECL: the list of using namespace directives
    The PURPOSE is the used namespace, the value is the namespace
    that is the common ancestor. */
@@ -2298,7 +2235,7 @@ struct lang_decl
    but have not yet processed it.  */
 #define DECL_PENDING_INLINE_P(NODE) \
   (DECL_LANG_SPECIFIC (NODE)->decl_flags.pending_inline_p)
-   
+
 /* If DECL_PENDING_INLINE_P holds, this is the saved text of the
    function.  */
 #define DECL_PENDING_INLINE_INFO(NODE) \
@@ -2328,22 +2265,24 @@ struct lang_decl
    non-type template parameters.  */
 #define ENUM_TEMPLATE_INFO(NODE) (TYPE_BINFO (ENUMERAL_TYPE_CHECK (NODE)))
 
-/* Template information for a template template parameter.  */
+/* Template information for a bound template template parameter.  */
 #define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) (TYPE_BINFO (NODE))
 
 /* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE.  */
 #define TYPE_TEMPLATE_INFO(NODE)                       \
   (TREE_CODE (NODE) == ENUMERAL_TYPE                   \
-   ? ENUM_TEMPLATE_INFO (NODE) :                       \
-   (TREE_CODE (NODE) == TEMPLATE_TEMPLATE_PARM         \
-    ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE)      \
-    : CLASSTYPE_TEMPLATE_INFO (NODE)))
+   ? ENUM_TEMPLATE_INFO (NODE) :                       \
+   (TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM   \
+    ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) :    \
+    (TYPE_LANG_SPECIFIC (NODE)                         \
+     ? CLASSTYPE_TEMPLATE_INFO (NODE)                  \
+     : NULL_TREE)))
 
 /* Set the template information for an ENUMERAL_, RECORD_, or
    UNION_TYPE to VAL.  */
-#define SET_TYPE_TEMPLATE_INFO(NODE, VAL)      \
-  (TREE_CODE (NODE) == ENUMERAL_TYPE           \
-   ? (ENUM_TEMPLATE_INFO (NODE) = VAL)                 \
+#define SET_TYPE_TEMPLATE_INFO(NODE, VAL)      \
+  (TREE_CODE (NODE) == ENUMERAL_TYPE           \
+   ? (ENUM_TEMPLATE_INFO (NODE) = VAL)         \
    : (CLASSTYPE_TEMPLATE_INFO (NODE) = VAL))
 
 #define TI_TEMPLATE(NODE) (TREE_PURPOSE (NODE))
@@ -2356,7 +2295,7 @@ struct lang_decl
    arguments, then each entry in the TREE_VEC is itself a TREE_VEC,
    containing the template arguments for a single level.  The first
    entry in the outer TREE_VEC is the outermost level of template
-   parameters; the last is the innermost.  
+   parameters; the last is the innermost.
 
    It is incorrect to ever form a template argument vector containing
    only one level of arguments, but which is a TREE_VEC containing as
@@ -2382,7 +2321,7 @@ struct lang_decl
 /* The LEVELth level of the template ARGS.  The outermost level of of
    args is level 1, not level 0.  */
 #define TMPL_ARGS_LEVEL(ARGS, LEVEL)           \
-  (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (ARGS)       \
+  (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (ARGS)       \
    ? TREE_VEC_ELT ((ARGS), (LEVEL) - 1) : ARGS)
 
 /* Set the LEVELth level of the template ARGS to VAL.  This macro does
@@ -2401,9 +2340,9 @@ struct lang_decl
 
 /* Given a single level of template arguments in NODE, return the
    number of arguments.  */
-#define NUM_TMPL_ARGS(NODE)                            \
-  ((NODE) == NULL_TREE ? 0                             \
-   : (TREE_CODE (NODE) == TREE_VEC                     \
+#define NUM_TMPL_ARGS(NODE)                            \
+  ((NODE) == NULL_TREE ? 0                             \
+   : (TREE_CODE (NODE) == TREE_VEC                     \
       ? TREE_VEC_LENGTH (NODE) : list_length (NODE)))
 
 /* Returns the innermost level of template arguments in ARGS.  */
@@ -2421,7 +2360,7 @@ struct lang_decl
       template <class T> struct S { template <class U> void f(U); }
 
    the FUNCTION_DECL for S<int>::f<double> will have, as its
-   DECL_TI_TEMPLATE, `template <class U> S<int>::f<U>'. 
+   DECL_TI_TEMPLATE, `template <class U> S<int>::f<U>'.
 
    As a special case, for a member friend template of a template
    class, this value will not be a TEMPLATE_DECL, but rather a
@@ -2431,7 +2370,7 @@ struct lang_decl
      template <class T> struct S { friend void f<int>(int, double); }
 
    the DECL_TI_TEMPLATE will be a LOOKUP_EXPR for `f' and the
-   DECL_TI_ARGS will be {int}.  */ 
+   DECL_TI_ARGS will be {int}.  */
 #define DECL_TI_TEMPLATE(NODE)      TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE))
 
 /* The template arguments used to obtain this decl from the most
@@ -2442,7 +2381,7 @@ struct lang_decl
 #define DECL_TI_ARGS(NODE)          TI_ARGS (DECL_TEMPLATE_INFO (NODE))
 #define CLASSTYPE_TI_TEMPLATE(NODE) TI_TEMPLATE (CLASSTYPE_TEMPLATE_INFO (NODE))
 #define CLASSTYPE_TI_ARGS(NODE)     TI_ARGS (CLASSTYPE_TEMPLATE_INFO (NODE))
-#define ENUM_TI_TEMPLATE(NODE)                         \
+#define ENUM_TI_TEMPLATE(NODE)                 \
   TI_TEMPLATE (ENUM_TEMPLATE_INFO (NODE))
 #define ENUM_TI_ARGS(NODE)                     \
   TI_ARGS (ENUM_TEMPLATE_INFO (NODE))
@@ -2462,17 +2401,10 @@ struct lang_decl
    the class definition is complete.  */
 #define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE)
 
-/* In a FUNCTION_DECL, the saved representation of the body of the
-   entire function.  Usually a COMPOUND_STMT, but this may also be a
-   RETURN_INIT, CTOR_INITIALIZER, or TRY_BLOCK.  */
-#define DECL_SAVED_TREE(NODE) \
-  (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE))->saved_tree)
-
 /* In a FUNCTION_DECL, the saved language-specific per-function data.  */
 #define DECL_SAVED_FUNCTION_DATA(NODE) \
   (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE))->u.saved_language_function)
 
-#define COMPOUND_STMT_NO_SCOPE(NODE)   TREE_LANG_FLAG_0 (NODE)
 #define NEW_EXPR_USE_GLOBAL(NODE)      TREE_LANG_FLAG_0 (NODE)
 #define DELETE_EXPR_USE_GLOBAL(NODE)   TREE_LANG_FLAG_0 (NODE)
 #define DELETE_EXPR_USE_VEC(NODE)      TREE_LANG_FLAG_1 (NODE)
@@ -2483,9 +2415,6 @@ struct lang_decl
 #define AGGR_INIT_VIA_CTOR_P(NODE) \
   TREE_LANG_FLAG_0 (AGGR_INIT_EXPR_CHECK (NODE))
 
-/* Nonzero if this statement should be considered a full-expression.  */
-#define STMT_IS_FULL_EXPR_P(NODE) TREE_LANG_FLAG_1 ((NODE))
-
 /* The TYPE_MAIN_DECL for a class template type is a TYPE_DECL, not a
    TEMPLATE_DECL.  This macro determines whether or not a given class
    type is really a template type, as opposed to an instantiation or
@@ -2507,7 +2436,7 @@ struct lang_decl
 
 /* Nonzero if NODE is a TYPE_DECL that should not be visible because
    it is from a dependent base class.  */
-#define IMPLICIT_TYPENAME_TYPE_DECL_P(NODE)    \
+#define IMPLICIT_TYPENAME_TYPE_DECL_P(NODE)    \
   (TREE_CODE (NODE) == TYPE_DECL               \
    && DECL_ARTIFICIAL (NODE)                   \
    && IMPLICIT_TYPENAME_P (TREE_TYPE (NODE)))
@@ -2528,9 +2457,9 @@ struct lang_decl
 #define TYPE_POLYMORPHIC_P(NODE) (TREE_LANG_FLAG_2 (NODE))
 
 /* Nonzero if this class has a virtual function table pointer.  */
-#define TYPE_CONTAINS_VPTR_P(NODE)             \
-  (TYPE_POLYMORPHIC_P (NODE)                   \
-   || (vbase_offsets_in_vtable_p ()            \
+#define TYPE_CONTAINS_VPTR_P(NODE)             \
+  (TYPE_POLYMORPHIC_P (NODE)                   \
+   || (vbase_offsets_in_vtable_p ()            \
        && TYPE_USES_VIRTUAL_BASECLASSES (NODE)))
 
 extern int flag_new_for_scope;
@@ -2574,12 +2503,12 @@ extern int flag_new_for_scope;
 /* [basic.fundamental]
 
    Types  bool, char, wchar_t, and the signed and unsigned integer types
-   are collectively called integral types.  
+   are collectively called integral types.
 
    Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration
    types as well, which is incorrect in C++.  */
-#define CP_INTEGRAL_TYPE_P(TYPE)               \
-  (TREE_CODE ((TYPE)) == BOOLEAN_TYPE          \
+#define CP_INTEGRAL_TYPE_P(TYPE)               \
+  (TREE_CODE ((TYPE)) == BOOLEAN_TYPE          \
    || TREE_CODE ((TYPE)) == INTEGER_TYPE)
 
 /* [basic.fundamental]
@@ -2589,10 +2518,6 @@ extern int flag_new_for_scope;
 #define ARITHMETIC_TYPE_P(TYPE) \
   (CP_INTEGRAL_TYPE_P (TYPE) || TREE_CODE (TYPE) == REAL_TYPE)
 
-/* Mark which labels are explicitly declared.
-   These may be shadowed, and may be referenced from nested functions.  */
-#define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)
-
 /* Nonzero for _TYPE means that the _TYPE defines
    at least one constructor.  */
 #define TYPE_HAS_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1(NODE))
@@ -2617,13 +2542,6 @@ extern int flag_new_for_scope;
                                   && CONSTRUCTOR_ELTS (NODE) == NULL_TREE \
                                   && ! TREE_HAS_CONSTRUCTOR (NODE))
 
-#if 0
-/* Indicates that a NON_LVALUE_EXPR came from a C++ reference.
-   Used to generate more helpful error message in case somebody
-   tries to take its address.  */
-#define TREE_REFERENCE_EXPR(NODE) (TREE_LANG_FLAG_3(NODE))
-#endif
-
 /* Nonzero for _TYPE means that the _TYPE defines a destructor.  */
 #define TYPE_HAS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_2(NODE))
 
@@ -2641,15 +2559,15 @@ extern int flag_new_for_scope;
 #define TYPE_HAS_COMPLEX_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_complex_init_ref)
 
 /* Nonzero if TYPE has a trivial destructor.  From [class.dtor]:
-   
+
      A destructor is trivial if it is an implicitly declared
      destructor and if:
 
        - all of the direct base classes of its class have trivial
-         destructors, 
+         destructors,
 
        - for all of the non-static data members of its class that are
-         of class type (or array thereof), each such class has a 
+         of class type (or array thereof), each such class has a
         trivial destructor.  */
 #define TYPE_HAS_TRIVIAL_DESTRUCTOR(NODE) \
   (!TYPE_HAS_NONTRIVIAL_DESTRUCTOR (NODE))
@@ -2696,6 +2614,10 @@ extern int flag_new_for_scope;
 #define TYPE_PTRMEMFUNC_FLAG(NODE) \
   (TYPE_LANG_SPECIFIC(NODE)->ptrmemfunc_flag)
 
+/* Indicates when overload resolution may resolve to a pointer to
+   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 {
@@ -2746,7 +2668,7 @@ extern int flag_new_for_scope;
    function.
 
    (Of course, the exact values may differ depending on the mangling
-   scheme, sizes of types, and such.).  
+   scheme, sizes of types, and such.).
 
    Under the new ABI, we do:
 
@@ -2759,7 +2681,7 @@ extern int flag_new_for_scope;
    in the object.)  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.  */
-     
+
 /* 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.  */
@@ -2797,7 +2719,7 @@ extern int flag_new_for_scope;
 #define PTRMEM_CST_CLASS(NODE) \
   TYPE_PTRMEM_CLASS_TYPE (TREE_TYPE (PTRMEM_CST_CHECK (NODE)))
 
-/* For a pointer-to-member constant `X::Y' this is the _DECL for 
+/* For a pointer-to-member constant `X::Y' this is the _DECL for
    `Y'.  */
 #define PTRMEM_CST_MEMBER(NODE) (((ptrmem_cst_t)PTRMEM_CST_CHECK (NODE))->member)
 
@@ -2825,26 +2747,10 @@ extern int flag_new_for_scope;
 #define ANON_UNION_TYPE_P(NODE) \
   (TREE_CODE (NODE) == UNION_TYPE && ANON_AGGR_TYPE_P (NODE))
 
-/* For a VAR_DECL that is an anonymous union, these are the various
-   sub-variables that make up the anonymous union.  */
-#define DECL_ANON_UNION_ELEMS(NODE) DECL_ARGUMENTS ((NODE))
-
 #define UNKNOWN_TYPE LANG_TYPE
 
 /* Define fields and accessors for nodes representing declared names.  */
 
-#if 0
-/* C++: A derived class may be able to directly use the virtual
-   function table of a base class.  When it does so, it may
-   still have a decl node used to access the virtual function
-   table (so that variables of this type can initialize their
-   virtual function table pointers by name).  When such thievery
-   is committed, know exactly which base class's virtual function
-   table is the one being stolen.  This effectively computes the
-   transitive closure.  */
-#define DECL_VPARENT(NODE) ((NODE)->decl.arguments)
-#endif
-
 #define TYPE_WAS_ANONYMOUS(NODE) (TYPE_LANG_SPECIFIC (NODE)->was_anonymous)
 
 /* C++: all of these are overloaded!  These apply only to TYPE_DECLs.  */
@@ -2942,7 +2848,7 @@ extern int flag_new_for_scope;
 
       template <class T> struct S {
         template <class U> void f(U);
-       template <> void f(T); 
+       template <> void f(T);
       };
 
    the `S<int>::f<int>(int)' function will appear on the
@@ -2966,7 +2872,7 @@ extern int flag_new_for_scope;
 #define DECL_TEMPLATE_SPECIALIZATIONS(NODE)     DECL_SIZE(NODE)
 
 /* Nonzero for a DECL which is actually a template parameter.  */
-#define DECL_TEMPLATE_PARM_P(NODE)             \
+#define DECL_TEMPLATE_PARM_P(NODE)             \
   (DECL_LANG_FLAG_0 (NODE)                     \
    && (TREE_CODE (NODE) == CONST_DECL          \
        || TREE_CODE (NODE) == TYPE_DECL                \
@@ -3127,10 +3033,10 @@ extern int flag_new_for_scope;
    `this' pointer when this function is called.  */
 #define THUNK_DELTA(DECL) (DECL_CHECK (DECL)->decl.u1.i)
 
-/* An integer indicating how many bytes should be subtracted from the
+/* A tree indicating how many bytes should be subtracted from the
    vtable for the `this' pointer to find the vcall offset.  (The vptr
    is always located at offset zero from the f `this' pointer.)  If
-   zero, then there is no vcall offset.  */
+   NULL, then there is no vcall offset.  */
 #define THUNK_VCALL_OFFSET(DECL) \
   (DECL_LANG_SPECIFIC (DECL)->decl_flags.u2.vcall_offset)
 
@@ -3211,7 +3117,7 @@ typedef enum tmpl_spec_kind {
 
 /* The various kinds of access.  BINFO_ACCESS depends on these being
    two bit quantities.  The numerical values are important; they are
-   used to initialize RTTI data structures, so chaning them changes
+   used to initialize RTTI data structures, so changing them changes
    the ABI.  */
 typedef enum access_kind {
   ak_none = 0,             /* Inaccessible.  */
@@ -3238,10 +3144,13 @@ typedef enum special_function_kind {
   sfk_conversion           /* A conversion operator.  */
 } special_function_kind;
 
-/* Zero means prototype weakly, as in ANSI C (no args means nothing).
-   Each language context defines how this variable should be set.  */
-extern int strict_prototype;
-extern int strict_prototypes_lang_c, strict_prototypes_lang_cplusplus;
+/* Bitmask flags to pass to instantiate_type.  */
+typedef enum instantiate_type_flags {
+  itf_none = 0,               /* nothing special */
+  itf_complain = 1 << 0,      /* complain about errors */
+  itf_no_attributes = 1 << 1, /* ignore attributes on comparisons */
+  itf_ptrmem_ok = 1 << 2,     /* pointers to member ok (internal use) */
+} instantiate_type_flags;
 
 /* Non-zero means that if a label exists, and no other identifier
    applies, use the value of the label.  */
@@ -3250,10 +3159,6 @@ extern int flag_labels_ok;
 /* Nonzero means allow Microsoft extensions without a pedwarn.  */
 extern int flag_ms_extensions;
 
-/* Non-zero means to collect statistics which might be expensive
-   and to print them when we are done.  */
-extern int flag_detailed_statistics;
-
 /* Non-zero means warn in function declared in derived class has the
    same name as a virtual in the base class, but fails to match the
    type signature of any virtual function in the base class.  */
@@ -3272,7 +3177,7 @@ extern void declare_function_name               PARAMS ((void));
 extern void decl_attributes                     PARAMS ((tree, tree, tree));
 extern void init_function_format_info          PARAMS ((void));
 extern void record_function_format             PARAMS ((tree, tree, int, int, int));
-extern void check_function_format              PARAMS ((tree, tree, tree));
+extern void check_function_format              PARAMS ((int *, tree, tree, tree));
 /* Print an error message for invalid operands to arith operation CODE.
    NOP_EXPR is used as a special case (see truthvalue_conversion).  */
 extern void binary_op_error                     PARAMS ((enum tree_code));
@@ -3287,7 +3192,6 @@ extern tree convert_and_check                     PARAMS ((tree, tree));
 extern void overflow_warning                   PARAMS ((tree));
 extern void unsigned_conversion_warning                PARAMS ((tree, tree));
 extern void c_apply_type_quals_to_decl          PARAMS ((int, tree));
-extern unsigned int min_precision              PARAMS ((tree, int));
 
 /* Read the rest of the current #-directive line.  */
 #if USE_CPPLIB
@@ -3325,6 +3229,11 @@ extern tree integer_two_node, integer_three_node;
 
 extern tree anonymous_namespace_name;
 
+/* The number of function bodies which we are currently processing.
+   (Zero if we are at namespace scope, one inside the body of a
+   function, two inside the body of a function in a local class, etc.)  */
+extern int function_depth;
+
 /* in pt.c  */
 
 /* These values are used for the `STRICT' parameter to type_unfication and
@@ -3344,8 +3253,6 @@ typedef enum unification_kind_t {
 #define TINST_LINE(NODE) EXPR_WFL_LINENO (NODE)
 #define TINST_FILE(NODE) EXPR_WFL_FILENAME (NODE)
 
-extern void maybe_print_template_context       PARAMS ((void));
-
 /* in class.c */
 
 extern int current_class_depth;
@@ -3480,7 +3387,7 @@ extern varray_type local_classes;
 #define VTABLE_PFN_NAME                "__pfn"
 #define VTABLE_DELTA2_NAME     "__delta2"
 
-#define EXCEPTION_CLEANUP_NAME         "exception cleanup"
+#define EXCEPTION_CLEANUP_NAME "exception cleanup"
 
 /* The name used as a prefix for VTTs.  When the new ABI mangling
    scheme is implemented, this should be removed.  */
@@ -3498,7 +3405,7 @@ extern varray_type local_classes;
 #define VPTR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
                              && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')
 #define DESTRUCTOR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == JOINER \
-                                    && IDENTIFIER_POINTER (ID_NODE)[2] == '_') 
+                                    && IDENTIFIER_POINTER (ID_NODE)[2] == '_')
 
 #define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
   && IDENTIFIER_POINTER (ID_NODE)[2] == 't' \
@@ -3522,18 +3429,13 @@ extern varray_type local_classes;
 #endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */
 
 /* Store the vbase pointer field name for type TYPE into pointer BUF.  */
-#define FORMAT_VBASE_NAME(BUF,TYPE) do {                               \
+#define FORMAT_VBASE_NAME(BUF,TYPE) do {                               \
   char *wbuf = (char *) alloca (TYPE_ASSEMBLER_NAME_LENGTH (TYPE)      \
                         + sizeof (VBASE_NAME) + 1);                    \
   sprintf (wbuf, VBASE_NAME_FORMAT, TYPE_ASSEMBLER_NAME_STRING (TYPE));        \
   (BUF) = wbuf;                                                                \
 } while (0)
 
-/* Returns non-zero iff ID_NODE is an IDENTIFIER_NODE whose name is
-   `main'.  */
-#define MAIN_NAME_P(ID_NODE) \
-   (strcmp (IDENTIFIER_POINTER (ID_NODE), "main") == 0)
-
 /* Returns non-zero iff NODE is a declaration for the global function
    `main'.  */
 #define DECL_MAIN_P(NODE)                              \
@@ -3544,25 +3446,6 @@ extern varray_type local_classes;
 \f
 /* Things for handling inline functions.  */
 
-struct pending_inline
-{
-  struct pending_inline *next; /* pointer to next in chain */
-  int lineno;                  /* line number we got the text from */
-  const char *filename;                /* name of file we were processing */
-  tree fndecl;                 /* FUNCTION_DECL that brought us here */
-  int token;                   /* token we were scanning */
-  int token_value;             /* value of token we were scanning (YYSTYPE) */
-
-  char *buf;                   /* pointer to character stream */
-  int len;                     /* length of stream */
-  unsigned int can_free : 1;   /* free this after we're done with it? */
-  unsigned int deja_vu : 1;    /* set iff we don't want to see it again.  */
-  unsigned int interface : 2;  /* 0=interface 1=unknown 2=implementation */
-};
-
-/* in method.c */
-extern struct pending_inline *pending_inlines;
-
 /* Negative values means we know `this' to be of static type.  */
 
 extern int flag_this_is_variable;
@@ -3599,6 +3482,11 @@ extern int flag_inline_trees;
 
 extern int at_eof;
 
+/* Functions called along with real static constructors and destructors.  */
+
+extern tree static_ctors;
+extern tree static_dtors;
+
 enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
 
 /* Some macros for char-based bitfields.  */
@@ -3630,7 +3518,7 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
 
    These are used in global lookup to support elaborated types and
    qualifiers.
-   
+
    LOOKUP_PREFER_TYPES means not to accept objects, and possibly namespaces.
    LOOKUP_PREFER_NAMESPACES means not to accept objects, and possibly types.
    LOOKUP_PREFER_BOTH means class-or-namespace-name.
@@ -3658,7 +3546,7 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
 #define LOOKUP_TYPES_ONLY(f)  \
   (!((f) & LOOKUP_PREFER_NAMESPACES) && ((f) & LOOKUP_PREFER_TYPES))
 #define LOOKUP_QUALIFIERS_ONLY(f)     ((f) & LOOKUP_PREFER_BOTH)
-     
+
 
 /* These flags are used by the conversion code.
    CONV_IMPLICIT   :  Perform implicit conversions (standard and user-defined).
@@ -3667,7 +3555,7 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
    CONV_REINTERPRET:  Perform the explicit conversions for reinterpret_cast.
    CONV_PRIVATE    :  Perform upcasts to private bases.
    CONV_FORCE_TEMP :  Require a new temporary when converting to the same
-                     aggregate type.  */
+                     aggregate type.  */
 
 #define CONV_IMPLICIT    1
 #define CONV_STATIC      2
@@ -3727,8 +3615,6 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
                                   already been parsed.  */
 #define SF_INCLASS_INLINE    2  /* The function is an inline, defined
                                   in the class body.  */
-#define SF_EXPAND            4  /* Generate RTL for this function.  */
-
 
 /* Returns nonzero iff TYPE1 and TYPE2 are the same type, or if TYPE2
    is derived from TYPE1, or if TYPE2 is a pointer (reference) to a
@@ -3745,8 +3631,8 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
 #define TEMPLATE_PARM_ORIG_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->orig_level)
 #define TEMPLATE_PARM_DECL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->decl)
 
-/* These macros are for accessing the fields of TEMPLATE_TYPE_PARM 
-   and TEMPLATE_TEMPLATE_PARM nodes.  */
+/* These macros are for accessing the fields of TEMPLATE_TYPE_PARM,
+   TEMPLATE_TEMPLATE_PARM and BOUND_TEMPLATE_TEMPLATE_PARM nodes.  */
 #define TEMPLATE_TYPE_PARM_INDEX(NODE) (TYPE_FIELDS (NODE))
 #define TEMPLATE_TYPE_IDX(NODE) \
   (TEMPLATE_PARM_IDX (TEMPLATE_TYPE_PARM_INDEX (NODE)))
@@ -3773,19 +3659,19 @@ enum tree_string_flags
     TS_FUNC_SCOPE     = 1 <<  8, /* show function scope */
     TS_PEDANTIC_NAME  = 1 <<  9, /* pedantically name things */
     TS_TEMPLATE_PREFIX= 1 << 10, /* show template <parms> prefix */
-    
+
     /* Internal use flags */
     TS_TEMPLATE_PARM  = 1 << 11, /* decl is really a non-type template parm */
     TS_TEMPLATE_PLAIN = 1 << 12, /* don't decorate primary template_name */
-    
+
     TS_NEXT_BIT       = 13       /* next available bit */
 };
 
 /* Returns the TEMPLATE_DECL associated to a TEMPLATE_TEMPLATE_PARM
    node.  */
-#define TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL(NODE)     \
-  (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE)                 \
-   ? TYPE_TI_TEMPLATE (NODE)                           \
+#define TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL(NODE)     \
+  ((TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM)  \
+   ? TYPE_TI_TEMPLATE (NODE)                           \
    : TYPE_NAME (NODE))
 
 /* in lex.c  */
@@ -3814,7 +3700,6 @@ extern int check_dtor_name                        PARAMS ((tree, tree));
 extern int get_arglist_len_in_bytes            PARAMS ((tree));
 
 extern tree build_vfield_ref                   PARAMS ((tree, tree));
-extern tree resolve_scope_to_name              PARAMS ((tree, tree));
 extern tree build_scoped_method_call           PARAMS ((tree, tree, tree, tree));
 extern tree build_addr_func                    PARAMS ((tree));
 extern tree build_call                         PARAMS ((tree, tree));
@@ -3842,7 +3727,7 @@ extern tree build_vbase_path                      PARAMS ((enum tree_code, tree, tree, tree, int));
 extern tree build_vtbl_ref                     PARAMS ((tree, tree));
 extern tree build_vfn_ref                      PARAMS ((tree *, tree, tree));
 extern tree get_vtable_decl                     PARAMS ((tree, int));
-extern void add_method                         PARAMS ((tree, tree *, tree));
+extern void add_method                         PARAMS ((tree, tree, int));
 extern int currently_open_class                        PARAMS ((tree));
 extern tree currently_open_derived_class       PARAMS ((tree));
 extern tree get_vfield_offset                  PARAMS ((tree));
@@ -3858,7 +3743,7 @@ extern void push_nested_class                     PARAMS ((tree, int));
 extern void pop_nested_class                   PARAMS ((void));
 extern void push_lang_context                  PARAMS ((tree));
 extern void pop_lang_context                   PARAMS ((void));
-extern tree instantiate_type                   PARAMS ((tree, tree, int));
+extern tree instantiate_type                   PARAMS ((tree, tree, enum instantiate_type_flags));
 extern void print_class_statistics             PARAMS ((void));
 extern int first_vfun_index                     PARAMS ((tree));
 extern void build_self_reference               PARAMS ((void));
@@ -3872,6 +3757,7 @@ extern void note_name_declared_in_class         PARAMS ((tree, tree));
 extern tree get_vtbl_decl_for_binfo             PARAMS ((tree));
 extern tree in_charge_arg_for_name              PARAMS ((tree));
 extern tree get_vtt_name                        PARAMS ((tree));
+extern tree get_primary_binfo                   PARAMS ((tree));
 
 /* in cvt.c */
 extern tree convert_to_reference               PARAMS ((tree, tree, int, int, tree));
@@ -3919,6 +3805,8 @@ extern void pop_nested_namespace          PARAMS ((tree));
 extern void maybe_push_to_top_level            PARAMS ((int));
 extern void push_to_top_level                  PARAMS ((void));
 extern void pop_from_top_level                 PARAMS ((void));
+extern void push_switch                                PARAMS ((tree));
+extern void pop_switch                         PARAMS ((void));
 extern tree identifier_type_value              PARAMS ((tree));
 extern void set_identifier_type_value          PARAMS ((tree, tree));
 extern void pop_everything                     PARAMS ((void));
@@ -3930,9 +3818,6 @@ extern int duplicate_decls                        PARAMS ((tree, tree));
 extern tree pushdecl                           PARAMS ((tree));
 extern tree pushdecl_top_level                 PARAMS ((tree));
 extern void pushdecl_class_level               PARAMS ((tree));
-#if 0
-extern void pushdecl_nonclass_level            PARAMS ((tree));
-#endif
 extern tree pushdecl_namespace_level            PARAMS ((tree));
 extern tree push_using_decl                     PARAMS ((tree, tree));
 extern tree push_using_directive                PARAMS ((tree));
@@ -3942,14 +3827,9 @@ extern tree lookup_label                 PARAMS ((tree));
 extern tree declare_local_label                 PARAMS ((tree));
 extern tree define_label                       PARAMS ((const char *, int, tree));
 extern void check_goto                         PARAMS ((tree));
-extern void push_switch                                PARAMS ((void));
-extern void pop_switch                         PARAMS ((void));
 extern void define_case_label                  PARAMS ((void));
 extern tree getdecls                           PARAMS ((void));
 extern tree gettags                            PARAMS ((void));
-#if 0
-extern void set_current_level_tags_transparency        PARAMS ((int));
-#endif
 extern tree binding_for_name                    PARAMS ((tree, tree));
 extern tree namespace_binding                   PARAMS ((tree, tree));
 extern void set_namespace_binding               PARAMS ((tree, tree, tree));
@@ -4001,15 +3881,11 @@ extern tree start_enum                          PARAMS ((tree));
 extern tree finish_enum                                PARAMS ((tree));
 extern void build_enumerator                   PARAMS ((tree, tree, tree));
 extern int start_function                      PARAMS ((tree, tree, tree, int));
-extern void expand_start_early_try_stmts       PARAMS ((void));
-extern void store_parm_decls                   PARAMS ((void));
-extern void store_return_init                  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 tree maybe_build_cleanup                        PARAMS ((tree));
-extern void cplus_expand_expr_stmt             PARAMS ((tree));
 extern void finish_stmt                                PARAMS ((void));
 extern void replace_defarg                     PARAMS ((tree, tree));
 extern void print_other_binding_stack          PARAMS ((struct binding_level *));
@@ -4038,9 +3914,7 @@ extern int wrapup_globals_for_namespace         PARAMS ((tree, void *));
 extern tree cp_namespace_decls                  PARAMS ((tree));
 extern tree create_implicit_typedef             PARAMS ((tree, tree));
 extern tree maybe_push_decl                     PARAMS ((tree));
-extern void emit_local_var                      PARAMS ((tree));
 extern tree build_target_expr_with_type         PARAMS ((tree, tree));
-extern void make_rtl_for_local_static           PARAMS ((tree));
 extern int local_variable_p                     PARAMS ((tree));
 extern int nonstatic_local_decl_p               PARAMS ((tree));
 extern tree declare_global_var                  PARAMS ((tree, tree));
@@ -4067,11 +3941,11 @@ extern tree grokbitfield                        PARAMS ((tree, tree, tree));
 extern tree groktypefield                      PARAMS ((tree, tree));
 extern tree grokoptypename                     PARAMS ((tree, tree));
 extern int copy_assignment_arg_p               PARAMS ((tree, int));
-extern void cplus_decl_attributes              PARAMS ((tree, tree, tree)); 
+extern void cplus_decl_attributes              PARAMS ((tree, tree, tree));
 extern tree constructor_name_full              PARAMS ((tree));
 extern tree constructor_name                   PARAMS ((tree));
 extern void setup_vtbl_ptr                     PARAMS ((tree, tree));
-extern void defer_fn                           PARAMS ((tree));
+extern void defer_fn           PARAMS ((tree));
 extern tree get_temp_name                      PARAMS ((tree));
 extern void finish_anon_union                  PARAMS ((tree));
 extern tree finish_table                       PARAMS ((tree, tree, tree, int));
@@ -4089,7 +3963,6 @@ extern tree reparse_absdcl_as_casts               PARAMS ((tree, tree));
 extern tree build_expr_from_tree               PARAMS ((tree));
 extern tree reparse_decl_as_expr               PARAMS ((tree, tree));
 extern tree finish_decl_parsing                        PARAMS ((tree));
-extern tree check_cp_case_value                        PARAMS ((tree));
 extern void set_decl_namespace                  PARAMS ((tree, tree, int));
 extern tree current_decl_namespace              PARAMS ((void));
 extern void push_decl_namespace                 PARAMS ((tree));
@@ -4136,6 +4009,14 @@ extern const char *lang_decl_name                PARAMS ((tree, int));
 extern const char *cp_file_of                  PARAMS ((tree));
 extern int cp_line_of                          PARAMS ((tree));
 extern const char *language_to_string           PARAMS ((enum languages, int));
+extern void print_instantiation_context         PARAMS ((void));
+/* cp_printer is the type of a function which converts an argument into
+   a string for digestion by printf.  The cp_printer function should deal
+   with all memory management; the functions in errfn will not free
+   the char*s returned.  See error.c for an example use of this code.  */
+typedef const char *cp_printer                 PARAMS ((tree, int));
+extern cp_printer *cp_printers[256];
+
 
 /* in except.c */
 extern void init_exception_processing          PARAMS ((void));
@@ -4152,9 +4033,7 @@ extern void check_handlers                        PARAMS ((tree));
 
 /* in expr.c */
 extern void init_cplus_expand                  PARAMS ((void));
-extern void fixup_result_decl                  PARAMS ((tree, struct rtx_def *));
 extern int extract_init                                PARAMS ((tree, tree));
-extern void do_case                            PARAMS ((tree, tree));
 extern tree cplus_expand_constant               PARAMS ((tree));
 
 /* friend.c */
@@ -4174,7 +4053,6 @@ extern tree get_type_value                        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));
-extern tree decl_constant_value                        PARAMS ((tree));
 extern tree build_new                          PARAMS ((tree, tree, tree, int));
 extern tree build_vec_init                     PARAMS ((tree, tree, tree, tree, int));
 extern tree build_x_delete                     PARAMS ((tree, int, tree));
@@ -4197,45 +4075,34 @@ extern tree make_call_declarator                PARAMS ((tree, tree, tree, tree));
 extern void set_quals_and_spec                 PARAMS ((tree, tree, tree));
 extern void lang_init                          PARAMS ((void));
 extern void lang_finish                                PARAMS ((void));
-#if 0
-extern void reinit_lang_specific               PARAMS ((void));
-#endif
 extern void print_parse_statistics             PARAMS ((void));
-extern void extract_interface_info             PARAMS ((void));
 extern void do_pending_inlines                 PARAMS ((void));
-extern void process_next_inline                        PARAMS ((struct pending_inline *));
-extern struct pending_input *save_pending_input PARAMS ((void));
-extern void restore_pending_input              PARAMS ((struct pending_input *));
+extern void process_next_inline                        PARAMS ((struct unparsed_text *));
+
 extern void yyungetc                           PARAMS ((int, int));
-extern void reinit_parse_for_method            PARAMS ((int, tree));
-extern void reinit_parse_for_block             PARAMS ((int, struct obstack *));
+extern void snarf_method                       PARAMS ((tree));
+
 extern void check_for_missing_semicolon                PARAMS ((tree));
 extern void note_got_semicolon                 PARAMS ((tree));
 extern void note_list_got_semicolon            PARAMS ((tree));
 extern void do_pending_lang_change             PARAMS ((void));
-extern int identifier_type                     PARAMS ((tree));
 extern void see_typename                       PARAMS ((void));
 extern tree do_identifier                      PARAMS ((tree, int, tree));
 extern tree do_scoped_id                       PARAMS ((tree, int));
 extern tree identifier_typedecl_value          PARAMS ((tree));
-extern int real_yylex                          PARAMS ((void));
-extern int is_rid                              PARAMS ((tree));
 extern tree build_lang_decl                    PARAMS ((enum tree_code, tree, tree));
 extern void retrofit_lang_decl                 PARAMS ((tree));
 extern tree copy_decl                           PARAMS ((tree));
 extern void copy_lang_decl                     PARAMS ((tree));
 extern tree cp_make_lang_type                  PARAMS ((enum tree_code));
 extern tree make_aggr_type                     PARAMS ((enum tree_code));
-extern void dump_time_statistics               PARAMS ((void));
 extern void compiler_error                     PARAMS ((const char *, ...))
   ATTRIBUTE_PRINTF_1;
 extern void yyerror                            PARAMS ((const char *));
 extern void clear_inline_text_obstack          PARAMS ((void));
 extern void maybe_snarf_defarg                 PARAMS ((void));
-extern tree snarf_defarg                       PARAMS ((void));
 extern void add_defarg_fn                      PARAMS ((tree));
 extern void do_pending_defargs                 PARAMS ((void));
-extern int identifier_type                     PARAMS ((tree));
 extern void yyhook                             PARAMS ((int));
 extern int cp_type_qual_from_rid                PARAMS ((tree));
 
@@ -4244,7 +4111,7 @@ extern void init_method                           PARAMS ((void));
 extern char *build_overload_name               PARAMS ((tree, int, int));
 extern tree build_static_name                  PARAMS ((tree, tree));
 extern tree build_decl_overload_real            PARAMS ((tree, tree, tree, tree,
-                                                      tree, int)); 
+                                                      tree, int));
 extern void set_mangled_name_for_decl           PARAMS ((tree));
 extern tree build_typename_overload            PARAMS ((tree));
 extern tree build_overload_with_type           PARAMS ((tree, tree));
@@ -4299,10 +4166,9 @@ extern void mark_decl_instantiated               PARAMS ((tree, int));
 extern int more_specialized                    PARAMS ((tree, tree, tree));
 extern void mark_class_instantiated            PARAMS ((tree, int));
 extern void do_decl_instantiation              PARAMS ((tree, tree, tree));
-extern void do_type_instantiation              PARAMS ((tree, tree));
+extern void do_type_instantiation              PARAMS ((tree, tree, int));
 extern tree instantiate_decl                   PARAMS ((tree, int));
 extern tree get_bindings                       PARAMS ((tree, tree, tree));
-extern void add_tree                           PARAMS ((tree));
 extern void add_maybe_template                 PARAMS ((tree, tree));
 extern void pop_tinst_level                    PARAMS ((void));
 extern int more_specialized_class              PARAMS ((tree, tree));
@@ -4320,6 +4186,9 @@ extern int instantiate_pending_templates        PARAMS ((void));
 extern tree tsubst_default_argument             PARAMS ((tree, tree, tree));
 extern tree most_general_template              PARAMS ((tree));
 extern tree get_mostly_instantiated_function_type PARAMS ((tree, tree *, tree *));
+extern int problematic_instantiation_changed    PARAMS ((void));
+extern void record_last_problematic_instantiation PARAMS ((void));
+extern tree current_instantiation               PARAMS ((void));
 extern int processing_template_parmlist;
 
 /* in repo.c */
@@ -4352,7 +4221,6 @@ extern tree lookup_field                  PARAMS ((tree, tree, int, 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));
-extern tree lookup_nested_tag                  PARAMS ((tree, tree));
 extern tree get_matching_virtual               PARAMS ((tree, tree, int));
 extern void get_pure_virtuals                  PARAMS ((tree));
 extern tree init_vbase_pointers                        PARAMS ((tree, tree));
@@ -4370,11 +4238,11 @@ extern int at_function_scope_p                  PARAMS ((void));
 extern tree lookup_conversions                 PARAMS ((tree));
 extern tree binfo_for_vtable                   PARAMS ((tree));
 extern int  binfo_from_vbase                   PARAMS ((tree));
-extern tree dfs_walk                            PARAMS ((tree, 
+extern tree dfs_walk                            PARAMS ((tree,
                                                       tree (*)(tree, void *),
                                                       tree (*) (tree, void *),
                                                       void *));
-extern tree dfs_walk_real                      PARAMS ((tree, 
+extern tree dfs_walk_real                      PARAMS ((tree,
                                                       tree (*) (tree, void *),
                                                       tree (*) (tree, void *),
                                                       tree (*) (tree, void *),
@@ -4395,6 +4263,7 @@ extern tree binfo_for_vbase                     PARAMS ((tree, tree));
 extern void fixup_all_virtual_upcast_offsets    PARAMS ((tree));
 
 /* in semantics.c */
+extern void init_cp_semantics                   PARAMS ((void));
 extern void finish_expr_stmt                    PARAMS ((tree));
 extern tree begin_if_stmt                       PARAMS ((void));
 extern void finish_if_stmt_cond                 PARAMS ((tree, tree));
@@ -4474,49 +4343,15 @@ extern tree finish_base_specifier               PARAMS ((tree, tree));
 extern void finish_member_declaration           PARAMS ((tree));
 extern void check_multiple_declarators          PARAMS ((void));
 extern tree finish_typeof                      PARAMS ((tree));
-extern void add_decl_stmt                       PARAMS ((tree));
 extern void finish_decl_cleanup                 PARAMS ((tree, tree));
 extern void finish_named_return_value           PARAMS ((tree, tree));
-extern tree expand_stmt                         PARAMS ((tree));
 extern void expand_body                         PARAMS ((tree));
-extern void begin_stmt_tree                     PARAMS ((tree *));
-extern void finish_stmt_tree                    PARAMS ((tree *));
 extern void prep_stmt                           PARAMS ((tree));
-extern tree add_scope_stmt                      PARAMS ((int, int));
 extern void do_pushlevel                        PARAMS ((void));
 extern tree do_poplevel                         PARAMS ((void));
 extern void finish_mem_initializers             PARAMS ((tree));
 
-extern void genrtl_try_block                    PARAMS ((tree));
-extern void genrtl_handler                      PARAMS ((tree));
-extern void genrtl_catch_block                  PARAMS ((tree));
-extern void genrtl_ctor_stmt                    PARAMS ((tree));
-extern void genrtl_subobject                    PARAMS ((tree));
-extern void genrtl_decl_cleanup                 PARAMS ((tree, tree));
-extern tree genrtl_do_poplevel                  PARAMS ((void));
-extern void genrtl_do_pushlevel                 PARAMS ((void));
-extern void genrtl_clear_out_block              PARAMS ((void));
-extern void genrtl_goto_stmt                    PARAMS ((tree));
-extern void genrtl_expr_stmt                    PARAMS ((tree));
-extern void genrtl_decl_stmt                    PARAMS ((tree));
-extern void genrtl_if_stmt                      PARAMS ((tree));
-extern void genrtl_while_stmt                   PARAMS ((tree));
-extern void genrtl_do_stmt                      PARAMS ((tree));
-extern void genrtl_return_stmt                  PARAMS ((tree));
-extern void genrtl_for_stmt                     PARAMS ((tree));
-extern void genrtl_break_stmt                   PARAMS ((void));
-extern void genrtl_continue_stmt                PARAMS ((void));
-extern void genrtl_scope_stmt                   PARAMS ((tree));
-extern void genrtl_switch_stmt                  PARAMS ((tree));
-extern void genrtl_case_label                   PARAMS ((tree, tree));
-extern tree genrtl_begin_compound_stmt          PARAMS ((int));
-extern tree genrtl_finish_compound_stmt         PARAMS ((int));
-extern tree genrtl_compound_stmt                PARAMS ((tree));
-extern void genrtl_asm_stmt                     PARAMS ((tree, tree,
-                                                        tree, tree,
-                                                        tree));
-extern void genrtl_named_return_value           PARAMS ((tree,
-                                                        tree));
+extern void clear_out_block                     PARAMS ((void));
 extern tree begin_global_stmt_expr              PARAMS ((void));
 extern tree finish_global_stmt_expr             PARAMS ((tree));
 
@@ -4526,6 +4361,7 @@ extern void init_spew                             PARAMS ((void));
 extern int peekyylex                           PARAMS ((void));
 extern int yylex                               PARAMS ((void));
 extern tree arbitrate_lookup                   PARAMS ((tree, tree, tree));
+extern tree frob_opname                         PARAMS ((tree));
 
 /* in tree.c */
 extern void init_tree                          PARAMS ((void));
@@ -4570,7 +4406,7 @@ extern tree array_type_nelts_top          PARAMS ((tree));
 extern tree break_out_target_exprs             PARAMS ((tree));
 extern tree get_type_decl                      PARAMS ((tree));
 extern tree vec_binfo_member                   PARAMS ((tree, tree));
-extern tree decl_namespace_context             PARAMS ((tree));
+extern tree decl_namespace_context             PARAMS ((tree));
 extern tree lvalue_type                                PARAMS ((tree));
 extern tree error_type                         PARAMS ((tree));
 extern tree build_ptr_wrapper                  PARAMS ((void *));
@@ -4586,8 +4422,13 @@ extern void debug_binfo                          PARAMS ((tree));
 extern tree build_dummy_object                 PARAMS ((tree));
 extern tree maybe_dummy_object                 PARAMS ((tree, tree *));
 extern int is_dummy_object                     PARAMS ((tree));
-typedef tree (*walk_tree_fn)                    PARAMS ((tree *, int *, void *));
-extern tree walk_tree                           PARAMS ((tree *, walk_tree_fn, void *));
+extern tree walk_tree                           PARAMS ((tree *,
+                                                        walk_tree_fn,
+                                                        void *,
+                                                        htab_t));
+extern tree walk_tree_without_duplicates        PARAMS ((tree *,
+                                                        walk_tree_fn,
+                                                        void *));
 extern tree copy_tree_r                         PARAMS ((tree *, int *, void *));
 extern int cp_valid_lang_attribute             PARAMS ((tree, tree, tree, tree));
 extern tree make_ptrmem_cst                     PARAMS ((tree, tree));
@@ -4598,6 +4439,9 @@ extern void remap_save_expr                     PARAMS ((tree *, splay_tree, tre
 extern tree build_shared_int_cst                PARAMS ((int));
 extern special_function_kind special_function_p PARAMS ((tree));
 extern int count_trees                          PARAMS ((tree));
+extern int char_type_p                          PARAMS ((tree));
+extern void verify_stmt_tree                    PARAMS ((tree));
+extern tree find_tree                           PARAMS ((tree, tree));
 
 /* in typeck.c */
 extern int string_conv_p                       PARAMS ((tree, tree, int));
@@ -4654,9 +4498,6 @@ extern tree build_x_modify_expr                   PARAMS ((tree, enum tree_code, tree));
 extern tree build_modify_expr                  PARAMS ((tree, enum tree_code, tree));
 extern tree dubious_conversion_warnings         PARAMS ((tree, tree, const char *, tree, int));
 extern tree convert_for_initialization         PARAMS ((tree, tree, tree, int, const char *, tree, int));
-extern void c_expand_asm_operands              PARAMS ((tree, tree, tree, tree, int, const char *, int));
-extern void c_expand_return                    PARAMS ((tree));
-extern tree c_expand_start_case                        PARAMS ((tree));
 extern int comp_ptr_ttypes                     PARAMS ((tree, tree));
 extern int ptr_reasonably_similar              PARAMS ((tree, tree));
 extern tree build_ptrmemfunc                   PARAMS ((tree, tree, int));
@@ -4682,17 +4523,21 @@ extern tree binfo_or_else                       PARAMS ((tree, tree));
 extern void readonly_error                     PARAMS ((tree, const char *, int));
 extern int abstract_virtuals_error             PARAMS ((tree, tree));
 extern void incomplete_type_error              PARAMS ((tree, tree));
-extern void my_friendly_abort                  PARAMS ((int))
+extern void friendly_abort                     PARAMS ((int, const char *,
+                                                        int, const char *))
   ATTRIBUTE_NORETURN;
-extern void my_friendly_assert                 PARAMS ((int, int));
+
+#define my_friendly_abort(N) \
+  friendly_abort (N, __FILE__, __LINE__, __FUNCTION__)
+#define my_friendly_assert(EXP, N) (void) \
+ (((EXP) == 0) ? (friendly_abort (N, __FILE__, __LINE__, __FUNCTION__), 0) : 0)
+
 extern tree store_init_value                   PARAMS ((tree, tree));
 extern tree digest_init                                PARAMS ((tree, tree, tree *));
 extern tree build_scoped_ref                   PARAMS ((tree, tree));
 extern tree build_x_arrow                      PARAMS ((tree));
 extern tree build_m_component_ref              PARAMS ((tree, tree));
 extern tree build_functional_cast              PARAMS ((tree, tree));
-extern char *enum_name_string                  PARAMS ((tree, tree));
-extern void report_case_error                  PARAMS ((int, tree, tree, tree));
 extern void check_for_new_type                 PARAMS ((const char *, flagged_type_tree));
 extern tree add_exception_specifier             PARAMS ((tree, tree, int));
 
@@ -4723,7 +4568,7 @@ extern tree mangle_typeinfo_string_for_type     PARAMS ((tree));
 extern tree mangle_vtbl_for_type                PARAMS ((tree));
 extern tree mangle_vtt_for_type                 PARAMS ((tree));
 extern tree mangle_ctor_vtbl_for_type           PARAMS ((tree, tree));
-extern tree mangle_thunk                        PARAMS ((tree, tree, tree)); 
+extern tree mangle_thunk                        PARAMS ((tree, tree, tree));
 extern tree mangle_conv_op_name_for_type        PARAMS ((tree));
 extern tree mangle_guard_variable               PARAMS ((tree));