aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2002-10-11 16:50:44 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2002-10-11 16:50:44 +0000
commit8e3df2def72d65c27249128842fe14ef00695b6b (patch)
tree9c2e122fd8114e13c9a7e7b1f586fcf1e369c77d /gcc/cp/decl2.c
parent98ddd678f0a8bee7c9a0673089f14c4d0448f6cd (diff)
downloadgcc-8e3df2def72d65c27249128842fe14ef00695b6b.zip
gcc-8e3df2def72d65c27249128842fe14ef00695b6b.tar.gz
gcc-8e3df2def72d65c27249128842fe14ef00695b6b.tar.bz2
NEWS: Document removal of "new X = ..." extension.
* NEWS: Document removal of "new X = ..." extension. * class.c (initialize_array): Set TREE_HAS_CONSTRUCTOR on brace-enclosed initializers. * cp-tree.h (CP_AGGREGATE_TYPE_P): New macro. (initialize_local_var): Remove declaration. (expand_static_init): Likewise. * decl.c (next_initializable_field): New function. (reshape_init): Likewise. (check_initializer): Use them. Build dynamic initializer for aggregates here too. (initialize_local_var): Simplify, and incorporate cleanup insertion code as well. (destroy_local_var): Remove. (cp_finish_decl): Tidy. (expand_static_init): Fold checks for whether or not a variable needs initialization into this function. Simplify. * decl2.c (do_static_initialization): Simplify. * init.c (build_init): Do not set TREE_SIDE_EFFECTS when it will be done for us automatically. (expand_default_init): Handle brace-enclosed initializers correctly. (expand_aggr_init_1): Remove RTL-generation code. (build_vec_init): Remove "new X = ..." support. * parse.y (new_initializer): Likewise. * rtti.c (get_pseudo_ti_init): Set TREE_HAS_CONSTRUCTOR on brace-enclosed initializer. (create_pseudo_type_info): Likewise. * typeck2.c (store_init_value): Don't try to handle digest_init being called more than once. (digest_init): Tidy handling of brace-enclosed initializers. * g++.dg/init/array1.C: Remove invalid braces. * g++.dg/init/brace1.C: New test. * g++.dg/init/copy2.C: Likewise. * g++.dg/init/copy3.C: Likewise. * g++.old-deja/g++.ext/arrnew.C: Change WARNING to ERROR. * g++.old-deja/g++.mike/p9129.C: Add ERROR on invalid use of braces. From-SVN: r58053
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r--gcc/cp/decl2.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index cab1c01..afa65a0 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -2508,34 +2508,24 @@ finish_static_initialization_or_destruction (guard_if_stmt)
DECL_STATIC_FUNCTION_P (current_function_decl) = 0;
}
-/* Generate code to do the static initialization of DECL. The
- initialization is INIT. If DECL may be initialized more than once
- in different object files, GUARD is the guard variable to
- check. PRIORITY is the priority for the initialization. */
+/* Generate code to do the initialization of DECL, a VAR_DECL with
+ static storage duration. The initialization is INIT. */
static void
do_static_initialization (decl, init)
tree decl;
tree init;
{
- tree expr;
tree guard_if_stmt;
/* Set up for the initialization. */
guard_if_stmt
= start_static_initialization_or_destruction (decl,
/*initp=*/1);
-
- /* Do the initialization itself. */
- if (IS_AGGR_TYPE (TREE_TYPE (decl))
- || TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
- expr = build_aggr_init (decl, init, 0);
- else
- {
- expr = build (INIT_EXPR, TREE_TYPE (decl), decl, init);
- TREE_SIDE_EFFECTS (expr) = 1;
- }
- finish_expr_stmt (expr);
+
+ /* Perform the initialization. */
+ if (init)
+ finish_expr_stmt (init);
/* If we're using __cxa_atexit, register a a function that calls the
destructor for the object. */
@@ -2567,7 +2557,7 @@ do_static_destruction (decl)
/* Actually do the destruction. */
guard_if_stmt = start_static_initialization_or_destruction (decl,
- /*initp=*/0);
+ /*initp=*/0);
finish_expr_stmt (build_cleanup (decl));
finish_static_initialization_or_destruction (guard_if_stmt);
}