diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2003-07-25 16:52:47 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2003-07-25 16:52:47 +0000 |
commit | c7b62f147297c2bb303b4bce35d3ac88124832c5 (patch) | |
tree | dc0c0e9ab0bb147892d110a05424f33755c89968 /gcc/cp/typeck2.c | |
parent | 42eaed4985c166c90a52b9b24a7d53193cb8b933 (diff) | |
download | gcc-c7b62f147297c2bb303b4bce35d3ac88124832c5.zip gcc-c7b62f147297c2bb303b4bce35d3ac88124832c5.tar.gz gcc-c7b62f147297c2bb303b4bce35d3ac88124832c5.tar.bz2 |
cp-tree.h (build_compound_expr): Take LHS & RHS args.
* cp-tree.h (build_compound_expr): Take LHS & RHS args.
(build_x_compound_expr_from_list): Declare.
* typeck.c (build_x_compound_expr_from_list): New.
(build_x_compound_expr): Adjust.
(build_compound_expr): Remove unreachable code. Take two
parameters, adjust.
* decl.c (grok_reference_init): Use
build_x_compound_expr_from_list.
(expand_static_init): Adjust build_compound_expr call.
(cxx_maybe_build_cleanup): Likewise.
* init.c (perform_member_init): Use
build_x_compound_expr_from_list.
(build_new_1): Likewise.
(build_vec_delete): Adjust build_compound_expr calls.
(build_vbase_delete): Likewise.
* typeck2.c (store_init_value): Use
build_x_compound_expr_from_list.
(build_functional_cast): Likewise.
From-SVN: r69794
Diffstat (limited to 'gcc/cp/typeck2.c')
-rw-r--r-- | gcc/cp/typeck2.c | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 8d1209c..a27df4f 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -330,15 +330,8 @@ store_init_value (tree decl, tree init) && TREE_TYPE (init) != unknown_type_node) { if (TREE_CODE (decl) == RESULT_DECL) - { - if (TREE_CHAIN (init)) - { - warning ("comma expression used to initialize return value"); - init = build_compound_expr (init); - } - else - init = TREE_VALUE (init); - } + init = build_x_compound_expr_from_list (init, + "return value initializer"); else if (TREE_CODE (init) == TREE_LIST && TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE) { @@ -346,17 +339,8 @@ store_init_value (tree decl, tree init) return NULL_TREE; } else - { - /* We get here with code like `int a (2);' */ - - if (TREE_CHAIN (init) != NULL_TREE) - { - pedwarn ("initializer list being treated as compound expression"); - init = build_compound_expr (init); - } - else - init = TREE_VALUE (init); - } + /* We get here with code like `int a (2);' */ + init = build_x_compound_expr_from_list (init, "initializer"); } /* End of special C++ code. */ @@ -1160,11 +1144,7 @@ build_functional_cast (tree exp, tree parms) if (parms == NULL_TREE) parms = integer_zero_node; else - { - if (TREE_CHAIN (parms) != NULL_TREE) - pedwarn ("initializer list being treated as compound expression"); - parms = build_compound_expr (parms); - } + parms = build_x_compound_expr_from_list (parms, "functional cast"); return build_c_cast (type, parms); } |