aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2004-07-06 02:20:16 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2004-07-05 22:20:16 -0400
commit5377d5ba398d4949af937fc025c1b01203aa3315 (patch)
treee36b5564359495ed12dc4107ed22bf65a3afddcc /gcc/cp
parentaac1d259ac0a17ccce902d1f151422554ee5f2d8 (diff)
downloadgcc-5377d5ba398d4949af937fc025c1b01203aa3315.zip
gcc-5377d5ba398d4949af937fc025c1b01203aa3315.tar.gz
gcc-5377d5ba398d4949af937fc025c1b01203aa3315.tar.bz2
langhooks-def.h (LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P): Extra arg.
* langhooks-def.h (LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P): Extra arg. * langhooks.h (var_mod_type_p): Likewise. * c-decl.c (finish_decl): Add extra arg to variably_modified_type_p. * expr.c (count_type_elements): Properly handle return from array_type_nelts and properly test for overflow. * gimplify.c (gimplify_init_constructor): Properly handle return from array_type_nelts. (gimplify_addr_expr): Remove redundant clear of TREE_SIDE_EFFECTS. * integrate.c (copy_decl_for_inlining): Correct comments. * tree-inline.c (remap_decl): Update comments, remove dead code, and copy DECL_FIELD_OFFSET and DECL_QUALIFIER, if they exist. (remap_type): Only remap if variably modified by vars in function being inlined. (copy_body_r): Use compatible_type langhooks to see when can fold. (setup_one_parameter): Don't remap type. (inline_forbidden_p_1): Add arg to variably_modified_type_p. * tree.c (recompute_tree_invarant_for_addr_expr): Properly compute TREE_INVARIANT for decl case. (find_var_from_fn): New function. (variably_modified_type_p): Add arg and call new function. * tree.h (variably_modified_type_p): Add extra arg. * cp/cp-lang.c (cp_var_mod_type_p): Add extra arg. * cp/decl.c (grokdeclarator): Extra arg to variably_modified_type_p. * cp/pt.c (check_instantiated_args, unify): Likewise. From-SVN: r84144
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/cp-lang.c12
-rw-r--r--gcc/cp/decl.c2
-rw-r--r--gcc/cp/pt.c4
4 files changed, 16 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1b48f3c..2d7f89d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2004-07-05 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * cp-lang.c (cp_var_mod_type_p): Add extra arg.
+ * decl.c (grokdeclarator): Extra arg to variably_modified_type_p.
+ * pt.c (check_instantiated_args, unify): Likewise.
+
2004-07-05 Phil Edwards <phil@codesourcery.com>
* Make-lang.in (check-c++, lang_checks): Add some comments.
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index 98b9458..5e403d8 100644
--- a/gcc/cp/cp-lang.c
+++ b/gcc/cp/cp-lang.c
@@ -38,7 +38,7 @@ static HOST_WIDE_INT cxx_get_alias_set (tree);
static bool cxx_warn_unused_global_decl (tree);
static tree cp_expr_size (tree);
static size_t cp_tree_size (enum tree_code);
-static bool cp_var_mod_type_p (tree);
+static bool cp_var_mod_type_p (tree, tree);
static int cxx_types_compatible_p (tree, tree);
static void cxx_initialize_diagnostics (diagnostic_context *);
@@ -307,17 +307,19 @@ cp_tree_size (enum tree_code code)
}
/* Returns true if T is a variably modified type, in the sense of C99.
+ FN is as passed to variably_modified_p.
This routine needs only check cases that cannot be handled by the
- language-independent logic in tree-inline.c. */
+ language-independent logic in tree.c. */
static bool
-cp_var_mod_type_p (tree type)
+cp_var_mod_type_p (tree type, tree fn)
{
/* If TYPE is a pointer-to-member, it is variably modified if either
the class or the member are variably modified. */
if (TYPE_PTR_TO_MEMBER_P (type))
- return (variably_modified_type_p (TYPE_PTRMEM_CLASS_TYPE (type))
- || variably_modified_type_p (TYPE_PTRMEM_POINTED_TO_TYPE (type)));
+ return (variably_modified_type_p (TYPE_PTRMEM_CLASS_TYPE (type), fn)
+ || variably_modified_type_p (TYPE_PTRMEM_POINTED_TO_TYPE (type),
+ fn));
/* All other types are not variably modified. */
return false;
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index bee0402..25ecca7 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -7329,7 +7329,7 @@ grokdeclarator (const cp_declarator *declarator,
if ((decl_context == FIELD || decl_context == PARM)
&& !processing_template_decl
- && variably_modified_type_p (type))
+ && variably_modified_type_p (type, NULL_TREE))
{
if (decl_context == FIELD)
error ("data member may not have variably modified type `%T'", type);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index ca52f65..5a644b4 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -8557,7 +8557,7 @@ check_instantiated_args (tree tmpl, tree args, tsubst_flags_t complain)
}
/* In order to avoid all sorts of complications, we do not
allow variably-modified types as template arguments. */
- else if (variably_modified_type_p (t))
+ else if (variably_modified_type_p (t, NULL_TREE))
{
if (complain & tf_error)
error ("`%T' is a variably modified type", t);
@@ -9732,7 +9732,7 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict)
the bound of the array will not be computable in an
instantiation. Besides, such types are not allowed in
ISO C++, so we can do as we please here. */
- if (variably_modified_type_p (arg))
+ if (variably_modified_type_p (arg, NULL_TREE))
return 1;
}