From 1456deafd7978b7201704ac822231c9ac4f260fe Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 9 Oct 2003 01:44:57 -0400 Subject: [PATCH] stmt.c (resolve_asm_operand_names): Call check_unique_operand_names here. * stmt.c (resolve_asm_operand_names): Call check_unique_operand_names here. (expand_asm_operands): Not here. (parse_input_constraint): No longer static. * tree.h: Declare it. * coverage.c (build_ctr_info_value): Use build_decl to make a VAR_DECL. (create_coverage): Likewise. java/ * parse.y (patch_assignment): Use make_node to create a BLOCK. * parse.h (BUILD_PTR_FROM_NAME): Use make_node to create a POINTER_TYPE. cp/ * tree.c (build_cplus_new): Use build_decl to create a VAR_DECL. (build_target_expr_with_type): Likewise. * pt.c (instantiate_class_template): Sanity check that our enclosing class has been instantiated. From-SVN: r72255 --- gcc/ChangeLog | 12 ++++++++++++ gcc/coverage.c | 5 ++--- gcc/cp/ChangeLog | 8 ++++++++ gcc/cp/pt.c | 13 ++++++++++++- gcc/cp/tree.c | 4 ++-- gcc/java/ChangeLog | 6 ++++++ gcc/java/parse.h | 2 +- gcc/java/parse.y | 3 ++- gcc/stmt.c | 9 +++------ gcc/tree.h | 2 ++ 10 files changed, 50 insertions(+), 14 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f4e78fc78c3..32165693ab1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2003-10-09 Jason Merrill + + * coverage.c (build_ctr_info_value): Use build_decl to make a + VAR_DECL. + (create_coverage): Likewise. + + * stmt.c (resolve_asm_operand_names): Call check_unique_operand_names + here. + (expand_asm_operands): Not here. + (parse_input_constraint): No longer static. + * tree.h: Declare it. + 2003-10-08 Kaz Kojima * config/sh/t-linux (SHLIB_LINK): Override to use a linker script diff --git a/gcc/coverage.c b/gcc/coverage.c index e6f4129dd79..b02c97c15d6 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -637,7 +637,7 @@ build_ctr_info_value (unsigned int counter, tree type) array_type = build_array_type (TREE_TYPE (TREE_TYPE (fields)), array_type); - array = build (VAR_DECL, array_type, NULL_TREE, NULL_TREE); + array = build_decl (VAR_DECL, NULL_TREE, array_type); TREE_STATIC (array) = 1; DECL_NAME (array) = get_identifier (XSTR (ctr_labels[counter], 0)); assemble_variable (array, 0, 0, 0); @@ -824,8 +824,7 @@ create_coverage (void) gcov_info_value = build_gcov_info (); - gcov_info = build (VAR_DECL, TREE_TYPE (gcov_info_value), - NULL_TREE, NULL_TREE); + gcov_info = build_decl (VAR_DECL, NULL_TREE, TREE_TYPE (gcov_info_value)); DECL_INITIAL (gcov_info) = gcov_info_value; TREE_STATIC (gcov_info) = 1; diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e5955264af7..b7cf0299843 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2003-10-09 Jason Merrill + + * tree.c (build_cplus_new): Use build_decl to create a VAR_DECL. + (build_target_expr_with_type): Likewise. + + * pt.c (instantiate_class_template): Sanity check that our + enclosing class has been instantiated. + 2003-10-08 Giovanni Bajo * cp_tree.h: Added TFF_NO_FUNCTION_ARGUMENTS. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index f0dc0e13368..909eede693d 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -5182,7 +5182,18 @@ instantiate_class_template (tree type) SET_ANON_AGGR_TYPE_P (type); pbinfo = TYPE_BINFO (pattern); - + +#ifdef ENABLE_CHECKING + if (DECL_CLASS_SCOPE_P (TYPE_MAIN_DECL (pattern)) + && ! COMPLETE_TYPE_P (TYPE_CONTEXT (type)) + && ! TYPE_BEING_DEFINED (TYPE_CONTEXT (type))) + /* We should never instantiate a nested class before its enclosing + class; we need to look up the nested class by name before we can + instantiate it, and that lookup should instantiate the enclosing + class. */ + abort (); +#endif + if (BINFO_BASETYPES (pbinfo)) { tree base_list = NULL_TREE; diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 0c729d6118c..109f7e52f18 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -269,7 +269,7 @@ build_cplus_new (tree type, tree init) && TREE_CODE (TREE_OPERAND (fn, 0)) == FUNCTION_DECL && DECL_CONSTRUCTOR_P (TREE_OPERAND (fn, 0))); - slot = build (VAR_DECL, type); + slot = build_decl (VAR_DECL, NULL_TREE, type); DECL_ARTIFICIAL (slot) = 1; DECL_CONTEXT (slot) = current_function_decl; layout_decl (slot, 0); @@ -311,7 +311,7 @@ build_target_expr_with_type (tree init, tree type) if (TREE_CODE (init) == TARGET_EXPR) return init; - slot = build (VAR_DECL, type); + slot = build_decl (VAR_DECL, NULL_TREE, type); DECL_ARTIFICIAL (slot) = 1; DECL_CONTEXT (slot) = current_function_decl; layout_decl (slot, 0); diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 25e70c2578b..d2b6d26ff0c 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,9 @@ +2003-10-09 Jason Merrill + + * parse.y (patch_assignment): Use make_node to create a BLOCK. + * parse.h (BUILD_PTR_FROM_NAME): Use make_node to create a + POINTER_TYPE. + 2003-10-06 Mark Mitchell * Make-lang.in (java.info): Replace with ... diff --git a/gcc/java/parse.h b/gcc/java/parse.h index 023410842b2..70d2b1806b6 100644 --- a/gcc/java/parse.h +++ b/gcc/java/parse.h @@ -154,7 +154,7 @@ extern tree stabilize_reference (tree); /* Quickly build a temporary pointer on hypothetical type NAME. */ #define BUILD_PTR_FROM_NAME(ptr, name) \ do { \ - ptr = build (POINTER_TYPE, NULL_TREE); \ + ptr = make_node (POINTER_TYPE); \ TYPE_NAME (ptr) = name; \ } while (0) diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 541e2b2429a..144ac7e52cf 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -12913,10 +12913,11 @@ patch_assignment (tree node, tree wfl_op1) { tree tmp = build_decl (VAR_DECL, get_identifier (""), TREE_TYPE (new_rhs)); - tree block = build (BLOCK, TREE_TYPE (new_rhs), NULL); + tree block = make_node (BLOCK); tree assignment = build (MODIFY_EXPR, TREE_TYPE (new_rhs), tmp, fold (new_rhs)); DECL_CONTEXT (tmp) = current_function_decl; + TREE_TYPE (block) = TREE_TYPE (new_rhs); BLOCK_VARS (block) = tmp; BLOCK_EXPR_BODY (block) = build (COMPOUND_EXPR, TREE_TYPE (new_rhs), assignment, tmp); diff --git a/gcc/stmt.c b/gcc/stmt.c index 72746dfc2b3..718f2558e7d 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -391,8 +391,6 @@ struct stmt_status GTY(()) static int using_eh_for_cleanups_p = 0; static int n_occurrences (int, const char *); -static bool parse_input_constraint (const char **, int, int, int, int, - const char * const *, bool *, bool *); static bool decl_conflicts_with_clobbers_p (tree, const HARD_REG_SET); static void expand_goto_internal (tree, rtx, rtx); static int expand_fixup (tree, rtx, rtx); @@ -1253,7 +1251,7 @@ parse_output_constraint (const char **constraint_p, int operand_num, /* Similar, but for input constraints. */ -static bool +bool parse_input_constraint (const char **constraint_p, int input_num, int ninputs, int noutputs, int ninout, const char * const * constraints, @@ -1465,9 +1463,6 @@ expand_asm_operands (tree string, tree outputs, tree inputs, if (! check_operand_nalternatives (outputs, inputs)) return; - if (! check_unique_operand_names (outputs, inputs)) - return; - string = resolve_asm_operand_names (string, outputs, inputs); /* Collect constraints. */ @@ -1975,6 +1970,8 @@ resolve_asm_operand_names (tree string, tree outputs, tree inputs) const char *c; tree t; + check_unique_operand_names (outputs, inputs); + /* Substitute [] in input constraint strings. There should be no named operands in output constraints. */ for (t = inputs; t ; t = TREE_CHAIN (t)) diff --git a/gcc/tree.h b/gcc/tree.h index a2a04a7cafc..d46e60ac376 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2977,6 +2977,8 @@ extern void emit_nop (void); extern void expand_computed_goto (tree); extern bool parse_output_constraint (const char **, int, int, int, bool *, bool *, bool *); +extern bool parse_input_constraint (const char **, int, int, int, int, + const char * const *, bool *, bool *); extern void expand_asm_operands (tree, tree, tree, tree, int, location_t); extern tree resolve_asm_operand_names (tree, tree, tree); extern int any_pending_cleanups (void); -- 2.30.2